This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: software archaeology: fixing method calls
- To: gdb at sources dot redhat dot com, jimb at cygnus dot com
- Subject: Re: software archaeology: fixing method calls
- From: Michael Elizabeth Chastain <chastain at cygnus dot com>
- Date: Tue, 24 Apr 2001 13:38:22 -0700
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