I have GDB attached to a process that is currently inside a catch(...) block.
Is there a known technique to access that thrown exception?
The program in question is a gcc/x86-64 binary, but I’m also curious about other builds.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As you say, you can re-throw it, so you can re-throw it inside another
try/catchblock with more specific clauses to extract the exception (and another...if you want as well). You can even do this inside another function so you can centralize your exception handling.Edit: I misunderstood the importance of
gdbin your question, but you can apply the idea I described. Make a function that re-throws the exception you can set a breakpoint in:Then in
gdbjust docall helper(). I just tested this to be sure it worked.Further edit: If you literally mean I’m running a program under gdb right now and you are not exiting
gdbuntil you are sure you can’t get the exception, then it’s time to look ateh_throw.ccand friends in thegccsource.__cxa_rethrowstarts with:You will have to examine all of those structures to figure out what’s buried inside.