dragosht
dragosht

Reputation: 3275

How do you determine what exception is thrown from an external library without debugging symbols?

I'm having some problems with a C++ piece of code similar to the one below:

try {

        /* some code here */

} catch(...) {

        /* ... */
}

I'm stepping through the code contained in the try block with the gdb and at some point something is being thrown. I cannot really know what it is because the function call that throws comes from a library and has no debugging symbols associated with it.

Is there a way for the gdb to determine what is being caught in the catch block ?

Upvotes: 2

Views: 159

Answers (1)

Per Johansson
Per Johansson

Reputation: 6887

You can try to call current_exception(), which if supported on your platform will return an exception_ptr for the current exception. It's not specified exactly what's contained in an exception_ptr however, but you could inspect it with x to see if you can figure something out.

It's also likely that some register contains the current exception data, but you didn't specify what architecture you're using.

Upvotes: 1

Related Questions