This is the mail archive of the 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]
Other format: [Raw text]

Re: RFA: MI tests: tolerate prototypes

> 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.
- Since GCC still doesn't really emit function types accurately, we
  won't always be able to correctly call pointed-to functions.  But
  this is true now, and the `maybe-prototyped' change wouldn't fix
  this either.

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