public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/12528] New: Should we handle constructors that are garbage collected but their debug info isn't?
@ 2011-03-01 22:18 dje at google dot com
  2011-03-11  8:12 ` [Bug breakpoints/12528] " dje at google dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dje at google dot com @ 2011-03-01 22:18 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-19  8:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-01 22:18 [Bug breakpoints/12528] New: Should we handle constructors that are garbage collected but their debug info isn't? dje at google dot com
2011-03-11  8:12 ` [Bug breakpoints/12528] " dje at google dot com
2011-03-16 18:15 ` cvs-commit at gcc dot gnu.org
2011-03-16 18:16 ` cvs-commit at gcc dot gnu.org
2011-03-16 18:22 ` ppluzhnikov at google dot com
2014-09-19  8:59 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).