Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@zwingli.cygnus.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: Andrew Cagney <ac131313@cygnus.com>,
	gdb-patches@sources.redhat.com, Jason Merrill <jason@redhat.com>
Subject: Re: RFA: MI tests: tolerate prototypes
Date: Fri, 08 Feb 2002 10:03:00 -0000	[thread overview]
Message-ID: <npbsezg880.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <20020207152709.A27386@nevyn.them.org>


Daniel Jacobowitz <drow@mvista.com> writes:
> > 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?

Jeez, it's not like this isn't confusing enough already without my
consistently writing the opposite of what I mean.  I meant to write:

        int f (s, f) short s; float f; { return s + f; }

That function will end up with pass-as types of `int' and `double', as
required by C's rules (which are not target-specific).  It will have
use-as types of `short' and `float'.  Seeing an apparently
unprototyped function definition in STABS, GDB would (under the
proposal) construct a prototyped type with `int' and `double' as its
argument types.

The drawback here is that GDB will print the function's type as `int f
(int, double)', instead of the more correct `int f ()'.  The benefit
is that GDB will be able to call all functions for which it can find
definitions correctly --- a benefit which my `maybe-prototyped'
proposal doesn't offer.


  reply	other threads:[~2002-02-08 18:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-03 13:04 Jim Blandy
2002-02-03 15:01 ` Daniel Jacobowitz
2002-02-05 15:54   ` Jim Blandy
2002-02-05 17:21     ` Daniel Jacobowitz
2002-02-05 20:30       ` Jim Blandy
2002-02-05 21:48         ` Daniel Jacobowitz
2002-02-06 10:48           ` Jim Blandy
2002-02-06 16:14             ` Andrew Cagney
2002-02-06 16:24               ` Daniel Jacobowitz
2002-02-07 11:01               ` Jim Blandy
2002-02-07 12:27                 ` Daniel Jacobowitz
2002-02-08 10:03                   ` Jim Blandy [this message]
2002-02-08  5:16       ` function pointer stabs (was Re: RFA: MI tests: tolerate prototypes) Jason Merrill
2002-02-08  7:44         ` Daniel Jacobowitz
2002-02-08 11:37           ` Jim Blandy
2002-02-08 14:51           ` Jim Blandy
2002-02-09 12:15             ` Jim Blandy
2002-02-09 14:13               ` Daniel Jacobowitz
2002-02-03 16:29 ` RFA: MI tests: tolerate prototypes Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=npbsezg880.fsf@zwingli.cygnus.com \
    --to=jimb@zwingli.cygnus.com \
    --cc=ac131313@cygnus.com \
    --cc=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jason@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox