DEV Community

Cover image for Optimizing C++ Exception Debugging with GDB: Effective Strategies for Troubleshooting
Francis
Francis

Posted on

Optimizing C++ Exception Debugging with GDB: Effective Strategies for Troubleshooting

In a large project, exceptions may be thrown in various places, and when encountering crashes or exceptions, it’s crucial to address two main issues:

Exception Source: Determine where the exception is thrown.
Exception Handling: Identify where the exception is caught.
Exceptions can be triggered by custom code or thrown by underlying libraries, making it challenging to pinpoint the exact location.

Fortunately, GDB provides two essential commands for handling these situations:

To catch exceptions thrown: catch throw
To catch exceptions caught: catch catch

Image description

More detail: https://light-city.medium.com/how-to-use-gdb-to-debug-exceptions-with-zero-experience-5d61e4b7d14e

Top comments (0)