This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: MI tests: tolerate prototypes
On Thu, Feb 07, 2002 at 02:03:20PM -0500, Jim Blandy wrote:
>
> > Jim, my preference here is more along your proposal - have an explicit
> > ``prototype-unknown'' state.
> >
> > From memory the last time this came up I also suggested here that
> > changing the default behavour across GDB is probably a good thing. I
> > don't think this is something that individual targets should be
> > deciding. Instead GDB should exibit consistent behavour across
> > host/target combinations, the decision being made on the basis of the
> > debug info.
>
> Well, I wouldn't call it target-specific. The compromise we're making
> is more like this:
>
> GCC's STABS describe prototyped function types as if they were
> non-prototyped function types. However, it does provide accurate
> pass-as types for function definitions. This means that GDB can
> correctly call functions under STABS if it reads function definition
> types *as if* they were prototyped, using the pass-as types as the
> argument types.
>
> The downsides of this proposal:
>
> - GDB will print function argument types incorrectly. For example,
> suppose we have the following function definition:
>
> int f (short s, float f) { return s + f; }
>
> Since the arguments' pass-as types for `s' and `f' are `int' and
> `double', GDB will print f's type as `int f(int, double)'. This is
> weird, but it's a direct consequence of lying about the type.
Clarification: If f were not prototyped, this would be true. So it's a
very small price to pay, IMHO. If it is prototyped, the pass-as type
for f will be float, right?
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer