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]

info functions bug?


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


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