I want to enable full logging of exception in my c++ program. All I want to do is to catch software/hardware exceptions in seh catch hanlder and then print full backtrace of exception (I am primarly interested in origin of exception - call stack is enough for me).
__try
{
difficult_task();
}
__except(my_seh_filter(GetExceptionInformation()))
{
// How to print full backtrace of exception here?
}
I know that I can print callstack (via StackWalk64
or CaptureStackBackTrace
) and I can get address/context of exception from GetExceptionInformation
. But I don't know how to get full backtrace of exception in catch handler. It seems like impossible because some special storage for storing exception backtrace is needed, because stack unwinding will change call stack. (SEH provides only states of registers and address of exception).