Bug 316656 - GDB crashes when creating catchpoint
Summary: GDB crashes when creating catchpoint
Status: RESOLVED UPSTREAM
Alias: None
Product: kdevelop
Classification: Applications
Component: CPP Debugger (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR major
Target Milestone: 4.3.0
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-13 10:56 UTC by Alex Richardson
Modified: 2013-05-19 03:38 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Richardson 2013-03-13 10:56:32 UTC
I am using GNU gdb (GDB) SUSE (7.5.1-2.1.1)
Here is the contents of the GDB view:
gdb --interpreter=mi2 -quiet
(gdb) catch throw
catch throw
Catchpoint 2 (throw)
../../gdb/breakpoint.c:5816: internal-error: print_one_breakpoint_location: Assertion `b->loc == NULL || b->loc->next == NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
../../gdb/breakpoint.c:5816: internal-error: print_one_breakpoint_location: Assertion `b->loc == NULL || b->loc->next == NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]

Reproducible: Always

Steps to Reproduce:
1. Debug a program
2. enter "catch throw" GDB console or have that line in .gdbinit

Actual Results:  
Crash


Works fine when I use gdb on the command line
Comment 1 Niko Sams 2013-03-13 20:15:00 UTC
if you try doing exactly the same with gdb on the commandline (including --interpreter=-mi2), does it also not crash?
Comment 2 Alex Richardson 2013-03-13 23:07:12 UTC
Interesting, when I run it using interpreter==-mi2 I get the following if the program is already running:
(gdb) 
catch throw
&"catch throw\n"
~"Catchpoint 7 (throw)\n"
Abgebrochen (Speicherabzug geschrieben)

If the process is not running yet I get the following:

(gdb) 
catch throw
&"catch throw\n"
~"Catchpoint 5 (throw)\n"
=breakpoint-created,bkpt={number="5",type="breakpoint",disp="keep",enabled="y",addr="0x000000000050e200",what="exception throw",times="0",original-location="__cxa_throw"}
^done
(gdb) 

However then it aborts before hitting main. Seems like it is an upstream bug, although I could swear it has worked before.
Comment 3 Arjan van Olphen 2013-03-28 11:18:46 UTC
I have this same bug (using Eclipse) only when having forked the process and the breakpoint is set on the child as well and only when I have added C++ object (cpp-file) added to the C project.
I not sure if something special is done when adding a C++ object during linking.

Hope this helps finding actual problem.
Comment 4 Heggman 2013-05-15 07:54:04 UTC
I can confirm this bug (of gdb), too. I use emacs/GUD.
The crash does not occur when setting the catch point but only when break points are displayed.
This happens with "gdb -i=mi" same way as with "gdb --fullname"
Comment 5 Heggman 2013-05-15 08:41:47 UTC
I created a bug report for this towards gdb 
http://sourceware.org/bugzilla/show_bug.cgi?id=13898
Comment 6 Heggman 2013-05-15 08:45:57 UTC
Sorry I referenced the wrong bug. The right one is
http://sourceware.org/bugzilla/show_bug.cgi?id=15468
Comment 7 Kevin Funk 2013-05-16 17:39:57 UTC
Can we close as upstream bug, then?
Comment 8 Heggman 2013-05-18 00:21:04 UTC
From my point of view: yes.

Remark: Workaround is to use "break __cxa_throw" instead of "catch throw"