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 c++/10966] New: Something fishy with constructors


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.


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