Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew STUBBS <andrew.stubbs@st.com>
To: GDB List <gdb@sourceware.org>
Subject: info functions bug?
Date: Tue, 21 Aug 2007 11:32:00 -0000	[thread overview]
Message-ID: <46CACD29.9060705@st.com> (raw)

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


             reply	other threads:[~2007-08-21 11:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-21 11:32 Andrew STUBBS [this message]
2007-08-21 12:04 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46CACD29.9060705@st.com \
    --to=andrew.stubbs@st.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox