This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
Re: gdb/34: g++ v3 functions show as "inheritance2() ()"
- To: chastain at redhat dot com
- Subject: Re: gdb/34: g++ v3 functions show as "inheritance2() ()"
- From: Michael Elizabeth Chastain <chastain at cygnus dot com>
- Date: 26 Feb 2001 05:48:00 -0000
- Cc: gdb-prs at sources dot redhat dot com,
- Reply-To: Michael Elizabeth Chastain <chastain at cygnus dot com>
The following reply was made to PR gdb/34; it has been noted by GNATS.
From: Michael Elizabeth Chastain <chastain@cygnus.com>
To: gdb-gnats@sources.redhat.com
Cc:
Subject: Re: gdb/34: g++ v3 functions show as "inheritance2() ()"
Date: Sun, 25 Feb 2001 21:46:06 -0800
This is going to touch a lot of code.
Start with g++ v2. Here is output from stock Red Hat Linux 7
with the Red Hat versions of g++ 2.96 and gdb 5.0.
(gdb) break 'Foo::operator<(int) const'
Breakpoint 1 at 0x80486a5: file x5.cc, line 22.
(gdb) run
Starting program: /gehman/home/chastain/tmp/x5.v2
Breakpoint 1, Foo::operator< (this=0xbffff7c4, j=2) at x5.cc:22
22 return i_ < j;
Look, gdb ate my const! That's not good at all.
Here is output from a v3 gcc and a current cvs debugger:
(gdb) break 'Foo::operator<(int) const'
Breakpoint 1 at 0x8049513: file x5.cc, line 22.
(gdb) run
Starting program: /gehman/home/chastain/tmp/x5
Breakpoint 1, Foo::operator<(int) const (this=0xbffff7d4, j=2) at x5.cc:22
22 return i_ < j;
Here is the explanation. print_frame prints the function name followed
by a synthetic "(arg1, arg2, ...)" string.
This works great for C. It looks acceptable for this particular C++
function. But it looks bad for this:
(gdb) break marker1
Breakpoint 1 at 0x8048443: file /vittone/fsf/2001-02-24/source-src/gdb/testsuite/gdb.c++/ref-types.cc, line 6.
(gdb) run
Starting program: /vittone/fsf/2001-02-24/gehman/build-src-native/gdb/testsuite/gdb.c++/ref-types
Breakpoint 1, marker1() ()
at /vittone/fsf/2001-02-24/source-src/gdb/testsuite/gdb.c++/ref-types.cc:6
6 }
Here the name of the function is "marker1()" and the arg list is "()".
With g++ v2, the name of the function was "marker1", the arg list was "()",
and the output looked decent (except for eating the "const" markers).
So we have to decide what the output is going to look like.
I would like the output to look like this:
Breakpoint 1, Foo::operator< (this=0xbffff7c4, j=2) const at ...
Breakpoint 2, marker2 () at ...
Breakpoint 3, marker3 () const at ...
There is a catch here: this output is annotated. In line 1,
the annotations are:
frame-function-name
"Foo::operator<"
frame-args
" ("
arg-begin
"format"
arg-name-end
"="
arg-value
"0xbffff7c4"
arg-end
", "
arg-begin
"j"
arg-name-end
"="
arg-value
"2"
arg-end
")"
frame-source-begin
" at "
There is no annotation space available for the " const". I could shove
it into the last arg-end, but that's gross. Instead, I would like to
invent a new annotation mark, frame-function-qualifier:
arg-end
")"
frame-function-qualifier
" const"
frame-source-begin
" at "
After introducing that annotation mark, I can change print_frame to
print C++ functions in the natural way.