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.
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
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.
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.
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.