bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gdb-7.2 c++ break points


From: kousiknandy
Subject: Re: gdb-7.2 c++ break points
Date: Wed, 5 Jan 2011 02:07:37 -0800 (PST)
User-agent: G2/1.0

Noticing the same problem, is there any workaround? The one noted in OP doesn't 
work for me. 

$ cat 5.cpp
namespace foo {
    int bar (void)  {return __LINE__;}
    int bar (int n) { return n;}
} ;

int main (int ac, char **av)
{
    return foo::bar(__LINE__) - foo::bar();
}

$ g++4 -g -o 5 5.cpp
$ gdb  ./5
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from 5...done.
(gdb) b 'foo::bar'      <------------------------ breaks for foo::bar(void)
Breakpoint 1 at 0x80483cf: file 5.cpp, line 2.
(gdb) b 'foo::bar()'    <------------------------ can't parse "()"
Junk at end of arguments.
(gdb) b 'foo::bar(int)' <------------------------ can't parse "(int)"
Junk at end of arguments.
(gdb) b 'foo::bar(      <------------------------ TAB shows following options 
foo::bar()     foo::bar(int)

I tried "set debug parser" but no useful information can be obtained. 
Interestingly, "disassemble" seems to work:

(gdb) disassemble /m 'foo::bar(int)',+1
Dump of assembler code from 0x80483d6 to 0x80483d7:
3           int bar (int n) { return n;}
   0x080483d6 <foo::bar(int)+0>:        push   %ebp
   0x080483d7 <foo::bar(int)+1>:        mov    %esp,%ebp
End of assembler dump.
(gdb) disassemble /m 'foo::bar()',+1
Dump of assembler code from 0x80483cc to 0x80483cd:
2           int bar (void)  {return __LINE__;}
   0x080483cc <foo::bar()+0>:   push   %ebp
   0x080483cd <foo::bar()+1>:   mov    %esp,%ebp
End of assembler dump.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]