public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dje at google dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug breakpoints/12528] New: Should we handle constructors that are garbage collected but their debug info isn't?
Date: Tue, 01 Mar 2011 22:18:00 -0000	[thread overview]
Message-ID: <bug-12528-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2011-03-01 22:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 22:18 dje at google dot com [this message]
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

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=bug-12528-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).