[CrashRecovery] Use SEH __try instead of VEH when available
authorReid Kleckner <rnk@google.com>
Wed, 17 May 2017 17:02:16 +0000 (17:02 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 17 May 2017 17:02:16 +0000 (17:02 +0000)
commit91fea018ee81a50483817c2d19f7c7074a6082ab
tree2973abe9c61b3ef4990dd5a55054abf717dcf8c3
parent4035ec59bf30bedce65ad8a6f81f966944654ac1
[CrashRecovery] Use SEH __try instead of VEH when available

Summary:
It avoids problems when other libraries raise exceptions. In particular,
OutputDebugString raises an exception that the debugger is supposed to
catch and suppress. VEH kicks in first right now, and that is entirely
incorrect.

Unfortunately, GCC does not support SEH, so I've kept the old buggy VEH
codepath around. We could fix it with SetUnhandledExceptionFilter, but
that is not per-thread, so a well-behaved library shouldn't set it.

Reviewers: zturner

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D33261

llvm-svn: 303274
llvm/lib/Support/CrashRecoveryContext.cpp
llvm/unittests/Support/CMakeLists.txt
llvm/unittests/Support/CrashRecoveryTest.cpp [new file with mode: 0644]