List Info

Thread: Breakpoint menus with overloaded constructors




Breakpoint menus with overloaded constructors
user name
2008-01-03 15:36:38
Breakpoint menus don't seem to work with overloaded
constructors.  Is that a
known problem?

They can be found with completion, however:

(gdb) b 'A::A(<TAB><TAB>
A::A(double)  A::A(int)     
(gdb) b 'A::A(



GNU gdb 6.7.50.20080103-cvs
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/l
icenses/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"...
(gdb) b A::A
[0] cancel
[1] all
?HERE
?HERE
> 1
Note: breakpoint -1 (disabled) also set at pc 0x0.
Breakpoint 1 at 0x0
Note: breakpoints -1 (disabled) and 1 also set at pc 0x0.
Breakpoint 2 at 0x0
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted
breakpoints.
(gdb) info break
Num     Type           Disp Enb  Address    What
1       breakpoint     keep y 0x00000000 
2       breakpoint     keep y 0x00000000 
(gdb) 


-- 
Nick                                           http://www.inet.net.n
z/~nickrob


/*  -*- compile-command: "cc -g -o overgdb overgdb.cc
-lstdc++"; -*- */

#include <iostream>

using namespace std;

class A
{
public:
A (int a)
{
  cout << "int" << endl;
}

A (double b)
{
  cout << "double" << endl;
}
};

main ()
{
  A *a, *b;
  a = new A (6);
  b = new A (10.11);
}

Re: Breakpoint menus with overloaded constructors
country flaguser name
United States
2008-01-04 06:53:10
On Fri, Jan 04, 2008 at 10:36:38AM +1300, Nick Roberts
wrote:
> 
> Breakpoint menus don't seem to work with overloaded
constructors.  Is that a
> known problem?

Yes, it's been broken since before I started working on
GDB.
> Note: breakpoint -1 (disabled) also set at pc 0x0.
> Breakpoint 1 at 0x0
> Note: breakpoints -1 (disabled) and 1 also set at pc
0x0.
> Breakpoint 2 at 0x0

Though they look a bit more broken than I remember, now. 
Vladimir,
have you seen this before?

-- 
Daniel Jacobowitz
CodeSourcery

Re: Breakpoint menus with overloaded constructors
country flaguser name
United States
2008-01-04 05:41:26
On Friday 04 January 2008 15:53:10 Daniel Jacobowitz wrote:
> On Fri, Jan 04, 2008 at 10:36:38AM +1300, Nick Roberts
wrote:
> > 
> > Breakpoint menus don't seem to work with
overloaded constructors.  Is that a
> > known problem?
> 
> Yes, it's been broken since before I started working on
GDB.
> > Note: breakpoint -1 (disabled) also set at pc
0x0.
> > Breakpoint 1 at 0x0
> > Note: breakpoints -1 (disabled) and 1 also set at
pc 0x0.
> > Breakpoint 2 at 0x0
> 
> Though they look a bit more broken than I remember,
now.  Vladimir,
> have you seen this before?

I have not, and I'm don't know offhand what could be wrong.
I'll take
a look, but not earlier than Monday.

- Volodya



Re: Breakpoint menus with overloaded constructors
user name
2008-01-07 15:44:20
 > Ok, I have no clue :-(. breakpoint.c calls
decode_line_1 with "A::A".
 > It gets to sals back, both are zeroed. This is not
something I've ever
 > touched, and I don't know what could be the problem.

If I set breakpoints in the overloaded constructors
(AZA::AZA) and similar
overloaded methods (AZA::BZB) I get:

  (gdb) inf break
  Num Type           Disp Enb Address    What
  1   breakpoint     keep y   0x08048890 in AZA at
overgdb.cc:12
  2   breakpoint     keep y   0x080488c8 in AZA at
overgdb.cc:17
  3   breakpoint     keep y   0x080488f4 in AZA::BZB(int) at
overgdb.cc:22
  4   breakpoint     keep y   0x0804892c in AZA::BZB(double)
at overgdb.cc:27

which presumably should be:

  (gdb) inf break
  Num Type           Disp Enb Address    What
  1   breakpoint     keep y   0x08048890 in AZA::AZA at
overgdb.cc:12
  2   breakpoint     keep y   0x080488c8 in AZA::AZA at
overgdb.cc:17
  3   breakpoint     keep y   0x080488f4 in AZA::BZB(int) at
overgdb.cc:22
  4   breakpoint     keep y   0x0804892c in AZA::BZB(double)
at overgdb.cc:27


So I wonder if GDB is reading the symbol information
correctly.

readelf gives me:

 <2><5d00>: Abbrev Number: 53
(DW_TAG_subprogram)
     DW_AT_sibling     : <5d19>	
     DW_AT_external    : 1	
     DW_AT_name        : AZA	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 15	
     DW_AT_declaration : 1	
 <2><5d19>: Abbrev Number: 54
(DW_TAG_subprogram)
     DW_AT_sibling     : <5d40>	
     DW_AT_external    : 1	
     DW_AT_name        : BZB	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 20	
     DW_AT_MIPS_linkage_name: _ZN3AZA3BZBEi	
     DW_AT_declaration : 1	

i.e. no linkage for AZA but I'm not sure how GDB links the
methods AZA and
BZB to the class AZA.



-- 
Nick                                           http://www.inet.net.n
z/~nickrob

Re: Breakpoint menus with overloaded constructors
country flaguser name
United States
2008-01-07 15:54:33
On Tue, Jan 08, 2008 at 10:44:20AM +1300, Nick Roberts
wrote:
> i.e. no linkage for AZA but I'm not sure how GDB links
the methods AZA and
> BZB to the class AZA.

Poorly.  I have some patches for this special case, but
they're not
fully baked yet.  I really hope I'll be back to them this
month.

-- 
Daniel Jacobowitz
CodeSourcery

Re: Breakpoint menus with overloaded constructors
user name
2008-01-07 17:19:36
 > which presumably should be:
 > 
 >   (gdb) inf break
 >   Num Type           Disp Enb Address    What
 >   1   breakpoint     keep y   0x08048890 in AZA::AZA
at overgdb.cc:12
 >   2   breakpoint     keep y   0x080488c8 in AZA::AZA
at overgdb.cc:17
 >   3   breakpoint     keep y   0x080488f4 in
AZA::BZB(int) at overgdb.cc:22
 >   4   breakpoint     keep y   0x0804892c in
AZA::BZB(double) at overgdb.cc:27

I mean:

   (gdb) inf break
   Num Type           Disp Enb Address    What
   1   breakpoint     keep y   0x08048890 in AZA::AZA(int)
at overgdb.cc:12
   2   breakpoint     keep y   0x080488c8 in
AZA::AZA(double) at overgdb.cc:17
   3   breakpoint     keep y   0x080488f4 in AZA::BZB(int)
at overgdb.cc:22
   4   breakpoint     keep y   0x0804892c in
AZA::BZB(double) at overgdb.cc:27

of course.

-- 
Nick                                           http://www.inet.net.n
z/~nickrob

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )