Bug 329758 - Implement automatically breaking on exception throw
Summary: Implement automatically breaking on exception throw
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: CPP Debugger (show other bugs)
Version: git master
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-09 10:46 UTC by Alexander
Modified: 2014-01-09 20:12 UTC (History)
2 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 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.