This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
setting breakpoints with C++ typedef names [was: Re: debug information]
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: Paul Pogonyshev <pogonyshev at gmx dot net>
- Cc: libstdc++ at gcc dot gnu dot org, gdb at sourceware dot org
- Date: Wed, 22 Nov 2006 13:03:41 +0100
- Subject: setting breakpoints with C++ typedef names [was: Re: debug information]
- References: <200611191342.48724.pogonyshev@gmx.net> <20061121100701.6b980f48.bkoz@redhat.com> <200611212225.28377.pogonyshev@gmx.net>
>
> But still function names include full type name: `b 'bar(basic_pod<int>)''.
> Not much of a problem in this case, but sometimes the full name is very
> long...
Oh. I finally understand you. Yes, this is a drag.
You want to be able to do:
(gdb) b bar(ipod)
instead of
(gdb) b bar(basic_pod<int>)
As you've noticed, this doesn't currently work. (x86-linux, mainline
gcc, gdb (6.5-13.fc6rh))
(gdb) b bar(ipod)
Function "bar(ipod)" not defined.
As you stated, you have to:
(gdb) b bar(basic_pod<int>)
Breakpoint 4 at 0x80489d7: file debug.cc, line 24.
I suggest reporting this to the gdb list (gdb@sourceware.org). You
might want to title that email something like "setting breakpoints with
C++ typedef names" or something more descriptive. Here, I've done that
for you.
To me, it looks like enough information is present in the debuginfo to
support this kind of usage. However, I am no expert in this area.
-benjamin
ps. Here's the test case
template<typename T>
struct basic_pod
{
typedef T value_type;
value_type _M_data;
};
typedef basic_pod<int> ipod;
void
bar(ipod p)
{
p._M_data = 0;
}
void
bar(int i)
{
++i;
}
int main()
{
ipod p;
bar(p); // b bar(ipod)
bar(5); // b bar(int)
return 0;
}