This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
c++/1942: can not set breakpoint in constructor
- From: gnatsweb at spamit dot net
- To: gdb-gnats at sources dot redhat dot com
- Date: 11 May 2005 23:02:04 -0000
- Subject: c++/1942: can not set breakpoint in constructor
- Reply-to: gnatsweb at spamit dot net
>Number: 1942
>Category: c++
>Synopsis: can not set breakpoint in constructor
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed May 11 23:08:01 UTC 2005
>Closed-Date:
>Last-Modified:
>Originator: Eric Nadler
>Release: GNU gdb 6.3.50.20050511
>Organization:
>Environment:
Red Hat Linux AS 4
>Description:
Sorry, I wasn't able to add on to the older related tickets for this bug, numbers 1091 and 1193. To address the question in those tickets, I do still find that this fails.
I've used different flavors of g++ and gdb on different Linux and Solaris platforms. The most recent code was using Red Hat AS 4:
g++ (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
GNU gdb 6.3.50.20050511
>How-To-Repeat:
Here is my program:
#include <iostream>
#include <string>
using namespace std;
struct X {
X(const string&, int);
};
X::X(const string& message, int value) {
cout << message;
}
int main() {
X h("Hello", 1);
X w(" World", 2);
cout << endl;
}
And my attempt at setting a breakpoint and running the program. It
seems also
that recent builds of gdb set breakpoints that die when trying to use
"X::X".
Previous versions wouldn't break, but wouldn't die either.
/home/enadler/test/compilerbugs/linux $
/development/enadler/nobackup/apps/gdb-6.3.50.20050511/gdb/gdb a.out
GNU gdb 6.3.50.20050511
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i686-pc-linux-gnu"...Using host
libthread_db
library "/lib/tls/libthread_db.so.1".
(gdb) b X::X
[0] cancel
[1] all
?HERE
?HERE
> 1
Note: breakpoint -1 (disabled) also set at pc 0x0.
Breakpoint 1 at 0x0
Note: breakpoints -1 (disabled) and 1 also set at pc 0x0.
Breakpoint 2 at 0x0
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) b /home/enadler/test/compilerbugs/linux/noGDBConstructor.cc:9
Breakpoint 3 at 0x8048930: file noGDBConstructor.cc, line 9.
(gdb) b /home/enadler/test/compilerbugs/linux/noGDBConstructor.cc:10
Breakpoint 4 at 0x8048936: file noGDBConstructor.cc, line 10.
(gdb) b /home/enadler/test/compilerbugs/linux/noGDBConstructor.cc:16
Breakpoint 5 at 0x8048abb: file noGDBConstructor.cc, line 16.
(gdb) run
Starting program: /home/enadler/test/compilerbugs/linux/a.out
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x0: Input/output error.
(gdb) del 1
(gdb) del 2
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/enadler/test/compilerbugs/linux/a.out
Breakpoint 5, main () at noGDBConstructor.cc:16
16 cout << endl;
(gdb) c
Continuing.
Hello World
Program exited normally.
(gdb) quit
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: