From: Jim Blandy <jimb@zwingli.cygnus.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: Jason Merrill <jason@redhat.com>, gdb-patches@sources.redhat.com
Subject: Re: function pointer stabs (was Re: RFA: MI tests: tolerate prototypes)
Date: Fri, 08 Feb 2002 14:51:00 -0000 [thread overview]
Message-ID: <np8za3egbs.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <20020208104402.A15801@nevyn.them.org>
I've been looking at Sun's STABS manual, which seems to only be
available from:
http://www.cs.ucsb.edu/facilities/software/cc-info/stabs.ps
That manual suggests that Sun's compiler emits an N_FUN stab of the
form:
.stabs "foo:F<returntype>;<argtype>;<argtype>;..."
even for non-prototyped functions. So the presence of argument types
separated by semicolons still doesn't reliably tell us that the
function was defined in prototype form, as I (and apparently
stabsread.c) assumed it did. It seems to me that this duplicates the
information provided by the N_RSYM and N_PSYM stabs. Whatever.
GDB parses this form already. We just need to be aware that its
presence does *not* mean "This function was declared in prototype
form."
For types, Sun emits the 'f' type descriptor for unprototyped function
types, and the 'g' type descriptor for prototyped function types. The
form seems to be:
"g" RETURN-TYPE ARGUMENT-TYPE * "#"
The examples in the manual are:
int (*fptr) (int, float)
.stabs "fptr:G(0,21)=*(0,22)=g(0,3)(0,3)(0,17)#"
The second (0,3) is for first argument int, and (0,17) is for second
argument float. [sic] More examples:
typedef int (*func_type) (int (*) (int, float), float);
struct a {
int x;
my_type* (*fptr1) (int (*) (int, float), float);
char y;
};
int (*xptr) (int (*) (), int (*) (void), int);
// Note int(*)() is function with unknown parameter types
.stabs "func_type:t(0,22)=*(0,23)=g(0,3)(0,50)=*(0,51)=
g(0,3)(0,3)(0,17)#(0,17)#",
N_LSYM,0x0,0x4,0x40
.stabs "a:T(0,24)=s12x:(0,3),0,32;fptr1:(0,25)=*(0,26)=g(0,27)=
*(0,3)(0,40)=*(0,41)=g(0,3)(0,3)(0,17)#(0,17)#,32,32;y:(0,1),64,8;;",
N_LSYM,0x0,0xc,0x1
.stabs "xptr:G(0,28)=*(0,29)=g(0,3)(0,60)=*(0,61)=f(0,3)(0,62)=*(0,63)=
g(0,3)(0,20)#(0,3)#",N_GSYM,0x0,0x4,0x0
But in this case, 'f' really does mean "non-prototyped function", and
'g' really does mean "prototyped function." So we can get accurate
information here.
I'd be happy if someone would double-check my reading.
next prev parent reply other threads:[~2002-02-08 22:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-03 13:04 RFA: MI tests: tolerate prototypes 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
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 [this message]
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=np8za3egbs.fsf@zwingli.cygnus.com \
--to=jimb@zwingli.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