This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: software archaeology: fixing method calls


Jim Blandy writes:

> - For TYPE_CODE_FUNC, the types of the arguments are stored in
>   `fields', just as if they were members of a structure. This lets us
>   store the names of the arguments.
> 
> - However, for TYPE_CODE_METHOD, the types of the arguments are stored
>   in `type_specific.arg_types'.
> 
> Why is this?

I don't know why, but I saw this too -- this was my first CR a long
time ago.  I traced it back to Michael Tiemann's original design.
It may come from a time before ordinary C functions had parameters.

> However, this means that invoking functions that expect reference
> arguments is impossible if you don't know the types of the arguments:
> you can't tell whether to pass boo's value (1), or boo's address
> (&boo).

Hmmm, if a function expects a reference argument, then it's written
in a language like C++ or Java where all functions are prototyped.
I guess the user would still lose if they compiled that source file
with no debugging information.

> - We could change the definition of TYPE_CODE_METHOD to put the
>   arguments in the same place TYPE_CODE_FUNCTION does.

I prefer this too.

Michael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]