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 ?
You can try to
call current_exception(), which if supported on your platform will return anexception_ptrfor the current exception. It’s not specified exactly what’s contained in an exception_ptr however, but you could inspect it withxto 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.