]> granicus.if.org Git - clang/commitdiff
CrashRecovery: Add #pragma clang __debug handle_crash, useful when debugging
authorDaniel Dunbar <daniel@zuster.org>
Wed, 18 Aug 2010 23:09:23 +0000 (23:09 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 18 Aug 2010 23:09:23 +0000 (23:09 +0000)
CrashRecovery since it avoids sending a signal which may be intercepted by the
debugger.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111449 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Pragma.cpp

index 0ef87b96d3bad56377aa22d3bbe8d0b387285633..f0f3bce008d247ea3d44c46d1a217cec18503a5f 100644 (file)
@@ -20,6 +20,7 @@
 #include "clang/Lex/LexDiagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceManager.h"
+#include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <algorithm>
 using namespace clang;
@@ -708,6 +709,10 @@ struct PragmaDebugHandler : public PragmaHandler {
       llvm_unreachable("#pragma clang __debug llvm_unreachable");
     } else if (II->isStr("overflow_stack")) {
       DebugOverflowStack();
+    } else if (II->isStr("handle_crash")) {
+      llvm::CrashRecoveryContext *CRC =llvm::CrashRecoveryContext::GetCurrent();
+      if (CRC)
+        CRC->HandleCrash();
     } else {
       PP.Diag(Tok, diag::warn_pragma_debug_unexpected_command)
         << II->getName();