This is the mail archive of the gdb@sourceware.org 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]

setting breakpoints with C++ typedef names [was: Re: debug information]


> 
> 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;
}


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