public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/10966] New: Something fishy with constructors
@ 2009-11-16 18:38 ppluzhnikov at google dot com
  2009-11-16 18:42 ` [Bug c++/10966] " ppluzhnikov at google dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ppluzhnikov at google dot com @ 2009-11-16 18:38 UTC (permalink / raw)
  To: gdb-prs

There is something fishy going on with constructors.

--- cut ---
struct Foo {
#if DEFAULT_CONSTRUCTOR
  Foo() { x = 0; }
#endif
  Foo(const char *xx) : x(xx) { }
  const char *bar() { return x; }
  const char *x;
};

int main()
{
  Foo f("abc");
  const char *s = f.bar();
}
--- cut ---

g++ -g foo.cc -o foo1
g++ -g foo.cc -o foo2 -DDEFAULT_CONSTRUCTOR



gdb-cvs -nx ./foo1
GNU gdb (GDB) 7.0.50.20091116-cvs
...
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 /usr/local/google/tmp/b1844402/foo1...done.
(gdb) b Foo::bar
Breakpoint 1 at 0x400584: file foo.cc, line 6.
(gdb) b Foo::Foo
(gdb)                 ### problem 1: why didn't this set a breakpoint?



gdb64-cvs -q -nx ./foo2
Reading symbols from /usr/local/google/tmp/b1844402/foo2...done.
(gdb) b Foo::Foo
../../src/gdb/breakpoint.c:4797: internal-error: set_raw_breakpoint: Assertion
`sal.pspace != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.


Both problems also exist in 6.8 and official 7.0 release, though the second
problem does not result in a crash, merely in bogus breakpoints being
inserted:

GNU gdb (GDB) 7.0
Copyright (C) 2009 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 /usr/local/google/tmp/b1844402/foo2...done.
(gdb) b Foo::Foo
Breakpoint 1 at 0x0
Note: breakpoint 1 also set at pc 0x0.
Breakpoint 2 at 0x0
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb)

-- 
           Summary: Something fishy with constructors
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: ppluzhnikov at google dot com
        ReportedBy: ppluzhnikov at google dot com
                CC: gdb-prs at sourceware dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2010-03-15 17:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-16 18:38 [Bug c++/10966] New: Something fishy with constructors ppluzhnikov at google dot com
2009-11-16 18:42 ` [Bug c++/10966] " ppluzhnikov at google dot com
2009-11-16 18:53 ` pedro at codesourcery dot com
2009-11-16 19:14 ` pedro at codesourcery dot com
2009-11-16 19:38 ` keiths at redhat dot com
2009-11-16 20:07 ` pedro at codesourcery dot com
2009-11-16 20:13 ` pedro at codesourcery dot com
2010-01-22 20:24 ` tromey at redhat dot com
2010-03-15 17:33 ` tromey at redhat 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).