public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/12568] New: GDB inserts breakpoint on constructor at location 0
@ 2011-03-11 6:19 ppluzhnikov at google dot com
2011-03-11 8:11 ` [Bug breakpoints/12568] " dje at google dot com
0 siblings, 1 reply; 2+ messages in thread
From: ppluzhnikov at google dot com @ 2011-03-11 6:19 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12568
Summary: GDB inserts breakpoint on constructor at location 0
Product: gdb
Version: unknown
Status: NEW
Severity: normal
Priority: P2
Component: breakpoints
AssignedTo: unassigned@sourceware.org
ReportedBy: ppluzhnikov@google.com
When using virtual inheritance, GCC emits in-charge (C1) and not-in-charge (C2)
constructors, at the same source file:line
One of these ctors could be garbage-collected by the linker, causing its line
table to start at location 0.
GDB does not ignore that line table, sets a breakpoint on 0, then gets:
Cannot insert breakpoint 1.
Error accessing memory address 0x0: Input/output error.
The problem reproduces with GDB 7.2.50.20110311-cvs and GCC
g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3
The problem does *not* reproduce with g++ (GCC) 4.6.0 20110219 (experimental),
because in that version C1 ctor calls C2, preventing C2 from being GCd by the
linker.
Repro steps:
/// --- foo.c
struct Foo
{
Foo(int z) { x = z; }
int x;
};
struct Bar: virtual public Foo
{
Bar(int x) : Foo(x) { }
};
int
main(int argc, char *argv[])
{
Foo f(42);
return f.x + argc;
}
// Calls C2 ctor, but is GCd by linker
void
deadfn()
{
Bar b(12);
}
/// --- foo.c
g++ -g foo.c -fno-inline -ffunction-sections -Wl,--gc-sections
nm a.out | grep Foo
0000000000400622 W _ZN3FooC1Ei ### Note: only C1 constructor present!
gdb ./a.out
GNU gdb (GDB) 7.2.50.20110311-cvs
Copyright (C) 2011 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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/a.out...done.
(gdb) b Foo::Foo
Breakpoint 1 at 0x0: file foo.c, line 3. (3 locations)
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x0000000000000000 foo.c:3
1.2 y 0x000000000000000b foo.c:3
1.3 y 0x000000000040062d in Foo::Foo(int) at
foo.c:3
(gdb) r
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x0: Input/output error.
Cannot insert breakpoint 1.
Error accessing memory address 0xb: Input/output error.
(gdb) q
--
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] 2+ messages in thread
* [Bug breakpoints/12568] GDB inserts breakpoint on constructor at location 0
2011-03-11 6:19 [Bug breakpoints/12568] New: GDB inserts breakpoint on constructor at location 0 ppluzhnikov at google dot com
@ 2011-03-11 8:11 ` dje at google dot com
0 siblings, 0 replies; 2+ messages in thread
From: dje at google dot com @ 2011-03-11 8:11 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12568
dje at google dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |dje at google dot com
Resolution| |DUPLICATE
--- Comment #1 from dje at google dot com 2011-03-11 08:11:32 UTC ---
Marking as dup.
*** This bug has been marked as a duplicate of bug 12528 ***
--
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] 2+ messages in thread
end of thread, other threads:[~2011-03-11 8:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-11 6:19 [Bug breakpoints/12568] New: GDB inserts breakpoint on constructor at location 0 ppluzhnikov at google dot com
2011-03-11 8:11 ` [Bug breakpoints/12568] " dje at google dot com
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).