Bug 329758

Summary: Implement automatically breaking on exception throw
Product: [Applications] kdevelop Reporter: Alexander <ashaduri>
Component: CPP DebuggerAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: wishlist CC: niko.sams, vlas.puhov
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alexander 2014-01-09 10:46:15 UTC
Hello,
I frequently have a situation when I want to the debugger to break on a thrown exception. It a very common situation because all my ASSERT statements, out-of-bounds access conditions and so on throw exceptions.

The problem is that currently it's quite cumbersome to do. You have to set a breakpoint somewhere in main(), run a program until the execution breaks, go to GDB tool view, type "catch throw", then continue debugging. And you have to do this each time you start the program, which is quite tiring.

I propose a checkbox (or something) somewhere in GDB options (or the main menu) to automatically break on exception throw.

VS has this feature (along with choosing which types of exceptions or common conditions to break on). Qt Creator has automatic breaking on qWarning() and similar calls. Ideally, KDevelop could also have a list of functions to break on.

Reproducible: Always

Steps to Reproduce:
See details.



KDevelop git master, gdb-7.6.50, openSUSE 12.2 x86-64.
Comment 1 Vlas Puhov 2014-01-09 15:49:03 UTC
Git commit 184e3a0bfb83e29574493f11faa2f66d120a941b by Vlas Puhov.
Committed on 09/01/2014 at 15:36.
Pushed by vpuhov into branch 'master'.

Show locations for all breakpoints even if they have neither
file nor line information.

Otherwise we'll be showing valid breakpoints with empty locations. Also
these breakpoints now'll be automatically inserted on debugger's restarts.

M  +1    -1    debuggers/gdb/breakpointcontroller.cpp
M  +4    -0    debuggers/gdb/unittests/gdbtest.cpp

http://commits.kde.org/kdevelop/184e3a0bfb83e29574493f11faa2f66d120a941b
Comment 2 Vlas Puhov 2014-01-09 16:00:16 UTC
   I don't  think it's a good idea to implement a GUI for this...
Have you tried adding "catch throw" command into .gdbinit file? It works perfectly for me.
   Anyway it's not an issue any more as "catch throw" breakpoint (__cxa_throw) should be reinserted automatically on debugger's restart.
Comment 3 Alexander 2014-01-09 19:58:17 UTC
Thanks.

I do really think that a GUI is a good idea though, since __cxa_throw is anything but intuitive, especially for the new users. Especially since you don't have access to the GDB prompt until you actually run the program and break somewhere before the exception is thrown.
Comment 4 Alexander 2014-01-09 20:12:42 UTC
I just noticed that you can indeed set the breakpoints before GDB is run. Still, an ordinary user has no way of knowing about __cxa_throw.