This is the mail archive of the gdb-prs@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]

[Bug breakpoints/12528] New: Should we handle constructors that aregarbage collected but their debug info isn't?


http://sourceware.org/bugzilla/show_bug.cgi?id=12528

           Summary: Should we handle constructors that are garbage
                    collected but their debug info isn't?
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dje@google.com


This is a general problem which normally isn't significant (YMMV).
But in the case of constructors it can happen in real world code.

GCC can emit two copies of a constructor, and then with -ffunction-sections
-Wl,--gc-sections one copy may get thrown away.  However the associated debug
info won't get thrown away, leading to gdb lossage.

$ cat c1c2.cc

class foo
{
 public:
  foo (int x);
  int _x;
};

class foo2 : public foo
{
 public:
  foo2 (int x);
};

foo::foo (int x)
  : _x (x)
{
}

foo2::foo2 (int x)
  : foo (x)
{ // line 21
}

int
main ()
{
  foo2 bar (3);
  return 0;
}
$ g++ -g -ffunction-sections -Wl,--gc-sections c1c2.cc
$ gdb a.out
[...]
(gdb) b 21
Breakpoint 1 at 0x20: file c1c2.cc, line 22. (2 locations)
(gdb) i b
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   <MULTIPLE>
1.1                         y     0x0000000000000020 c1c2.cc:22
1.2                         y     0x00000000004005c8 in foo2::foo2(int)
                                               at c1c2.cc:22
(gdb) r
Starting program: /home/dje/src/play/a.out
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x20: Input/output error.

(gdb)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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