This is an archive of the discontinued LLVM Phabricator instance.

[CrashRecovery] Don't treat OutputDebugString as a crash
ClosedPublic

Authored by zturner on May 16 2017, 2:42 PM.

Details

Summary

After spending 2 days tracking down a bizarre silent program termination when using the SetupApi code path for locating the MSVC toolchain, we finally traced it down to this. Internal to the SetupApi com library, someone is calling OutputDebugString, which raises an exception so that the debugger can handle.

Honestly, we probably should not be using AddVectoredExceptionHandler in the first place. There are too many cases where RaiseException is used on purpose, and a library intends to catch it itself. By using AddVectoredExceptionHandler, we break all of these applications.

Regardless, this makes things better right now, and perhaps in the future we can look into using SetUnhandledExceptionFilter.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner created this revision.May 16 2017, 2:42 PM
zturner updated this revision to Diff 99209.May 16 2017, 2:48 PM

Also add the exception codes for printing a wide debugger string and setting a thread name.

rnk edited edge metadata.May 16 2017, 3:45 PM

I went ahead and did the "right" thing of using SEH instead: https://reviews.llvm.org/D33261

Unfortunately, mingw doesn't have SEH, so maybe we need this patch too. :(

I guess let's land it and I'll un-disable the unittest I wrote for this?

rnk accepted this revision.May 16 2017, 3:56 PM

lgtm

This revision is now accepted and ready to land.May 16 2017, 3:56 PM
This revision was automatically updated to reflect the committed changes.