Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* info functions bug?
@ 2007-08-21 11:32 Andrew STUBBS
  2007-08-21 12:04 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew STUBBS @ 2007-08-21 11:32 UTC (permalink / raw)
  To: GDB List

Hi,

There seems to be a problem with 'info functions'. It prints the return 
type of template functions twice.

Here's some example code:


template <typename TT>
TT& max(TT& a, TT& b)
{
   return (a>b ? a : b);
}

int
main()
{
   int a = 1, b = 2;
   float c = 1.1, d = 2.2;
   max(a,b);
   max(c,d);
   return 0;
}


This is correctly interpreted by nm and c++filt as follows:


$ nm -C a.out | grep max
88001878 W float& max<float>(float&, float&)
88001830 W int& max<int>(int&, int&)


But GDB gives a slightly different name:


(gdb) info functions max
All functions matching regular expression "max":

File t.cpp:
float &float& max<float>(float&, float&);
int &int& max<int>(int&, int&);


This name is not accepted when setting a breakpoint, but remove the 
extra return type and all is well:


(gdb) b float &float& max<float>(float&, float&)
Function "float &float& max<float>(float&, float&)" not defined.
(gdb) b float& max<float>(float&, float&)
Breakpoint 2 at 0x8800188a: file t.cpp, line 4.


(Irritatingly, 'break max' doesn't work - it doesn't even prompt.)

Presumably this is not the intended output for this type of function?

Andrew


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-21 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-21 11:32 info functions bug? Andrew STUBBS
2007-08-21 12:04 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox