KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In the event of an unhandled C++ exception I want to print: The message ( what() ) of the C++ exception A stack trace. In order to get the stack trace, I'm using SetUnhandledExceptionFilter in combination with the StackWalker library: struct FooStackWalker : StackWalker { virtual void OnCallstackEntry(CallstackEntryType, CallstackEntry &entry) override { std::cerr << entry.lineFileName << " (" << entry.lineNumber << "): " << entry.undFullName << std::endl; } }; LONG WINAPI UnhandledExceptionHandler(LPEXCEPTION_POINTERS pointers) { FooStackWalker walker; walker.ShowCallstack(::GetCurrentThread(), pointers->ContextRecord); ::TerminateProcess(::GetCurrentProcess(), 1); } int main() { ::SetUnhandledExceptionFilter(UnhandledExceptionHandler); } I've gotten the stack trace to print just fine, but now getting what is difficult. Is there some way I can decode the SEH exception as a C++ exception in order to call this member function before termination?
Tags (comma-separated)
Save Edits
Cancel