I am debugging code with exception throwing and exception handling. I would like gdb to break immediately when an exception is thrown, so i can inspect the state of the program and the call stack. How can I make gdb break when any exception is thrown?
Asked
Active
Viewed 1.1k times
1 Answers
34
You can do this with the catch throw
command. See here:
catch
eventStop when event occurs. The event can be any of the following:
throw
[regexp]
rethrow
[regexp]
catch
[regexp]The throwing, re-throwing, or catching of a C++ exception.
If regexp is given, then only exceptions whose type matches the regular expression will be caught.

Daniel Hershcovich
- 3,751
- 2
- 30
- 35