diff options
author | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2020-09-22 18:22:01 -0400 |
---|---|---|
committer | Alexandre Ganea <alexandre.ganea@ubisoft.com> | 2020-09-24 08:21:42 -0400 |
commit | 24f510570fedf2ac6ea421478c7500d777c8c3c6 (patch) | |
tree | b94d686471283e6a59a4132fd4c5a986fe2e6fa2 /llvm/lib/Support/CrashRecoveryContext.cpp | |
parent | 4da6927de47074f56531c2e7e2eecc4d6a1f09ec (diff) | |
download | llvm-24f510570fedf2ac6ea421478c7500d777c8c3c6.zip llvm-24f510570fedf2ac6ea421478c7500d777c8c3c6.tar.gz llvm-24f510570fedf2ac6ea421478c7500d777c8c3c6.tar.bz2 |
[Support] On Windows, ensure abort() can be catched several times in a row with CrashRecoveryContext
Before this patch, the CrashRecoveryContext would only catch the first abort(). Any further calls to abort() inside subsquent CrashRecoveryContexts would not be catched. This is because the Windows CRT removes the abort() handler before calling it.
This is part of https://reviews.llvm.org/D70378
Diffstat (limited to 'llvm/lib/Support/CrashRecoveryContext.cpp')
-rw-r--r-- | llvm/lib/Support/CrashRecoveryContext.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp index d4fd821..2a41754 100644 --- a/llvm/lib/Support/CrashRecoveryContext.cpp +++ b/llvm/lib/Support/CrashRecoveryContext.cpp @@ -95,6 +95,13 @@ static void uninstallExceptionOrSignalHandlers(); CrashRecoveryContextCleanup::~CrashRecoveryContextCleanup() {} +CrashRecoveryContext::CrashRecoveryContext() { + // On Windows, if abort() was previously triggered (and caught by a previous + // CrashRecoveryContext) the Windows CRT removes our installed signal handler, + // so we need to install it again. + sys::DisableSystemDialogsOnCrash(); +} + CrashRecoveryContext::~CrashRecoveryContext() { // Reclaim registered resources. CrashRecoveryContextCleanup *i = head; |