llvm.org GIT mirror llvm / 8d124b0
[Support] Ignore OutputDebugString exceptions in our crash recovery. Since we use AddVectoredExceptionHandler, we get notified of every exception that gets raised by a program. Sometimes these are not necessarily errors though, and this can be especially true when linking against a library that we have no control over, and may raise an exception internally which it intends to catch. In particular, the Windows API OutputDebugString does exactly this. It raises an exception inside of a __try / __except, giving the debugger a chance to handle the exception to print the message to the debug console. But this doesn't interoperate nicely with our vectored exception handler, which just sees another exception and decides that we need to terminate the program. Add a special case for this so that we ignore ODS exceptions and continue normally. Note that a better fix is to simply not use vectored exception handlers and use SEH instead, but given that MinGW doesn't support SEH, this is the only solution for MinGW. Differential Revision: https://reviews.llvm.org/D33260 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303219 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 3 years ago
1 changed file(s) with 8 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
163163
164164 static LONG CALLBACK ExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo)
165165 {
166 switch (ExceptionInfo->ExceptionRecord->ExceptionCode)
167 {
168 case DBG_PRINTEXCEPTION_C:
169 case DBG_PRINTEXCEPTION_WIDE_C:
170 case 0x406D1388: // set debugger thread name
171 return EXCEPTION_CONTINUE_EXECUTION;
172 }
173
166174 // Lookup the current thread local recovery object.
167175 const CrashRecoveryContextImpl *CRCI = CurrentContext->get();
168176