summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilip Pizlo <fpizlo@apple.com>2013-11-03 00:29:47 +0000
committerFilip Pizlo <fpizlo@apple.com>2013-11-03 00:29:47 +0000
commit35a1e9414d48f52093679b4723578192cceeb3c5 (patch)
tree488cf27023ad7e3f9d801f4e6db25365c0c26b30
parentbc884fd9f7bdb64d250be639edc8dc85a20a1975 (diff)
downloadllvm-35a1e9414d48f52093679b4723578192cceeb3c5.tar.gz
llvm-35a1e9414d48f52093679b4723578192cceeb3c5.tar.bz2
llvm-35a1e9414d48f52093679b4723578192cceeb3c5.tar.xz
When LLVM is embedded in a larger application, it's not OK for LLVM to intercept crashes. LLVM already has
the ability to disable this functionality. This patch exposes it via the C API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193937 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm-c/Core.h6
-rw-r--r--lib/Support/PrettyStackTrace.cpp5
2 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h
index 690ffa9fdc..47d566c03e 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -434,6 +434,12 @@ void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler);
void LLVMResetFatalErrorHandler(void);
/**
+ * Disable LLVM's built-in stack trace code. This must be called before any
+ * other LLVM APIs; otherwise the results are undefined.
+ */
+void LLVMDisablePrettyStackTrace(void);
+
+/**
* @defgroup LLVMCCoreContext Contexts
*
* Contexts are execution states for the core LLVM IR system.
diff --git a/lib/Support/PrettyStackTrace.cpp b/lib/Support/PrettyStackTrace.cpp
index 315008ae81..d08abc8ce1 100644
--- a/lib/Support/PrettyStackTrace.cpp
+++ b/lib/Support/PrettyStackTrace.cpp
@@ -20,6 +20,7 @@
#include "llvm/Support/ThreadLocal.h"
#include "llvm/Support/Watchdog.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm-c/Core.h"
#ifdef HAVE_CRASHREPORTERCLIENT_H
#include <CrashReporterClient.h>
@@ -147,3 +148,7 @@ void PrettyStackTraceProgram::print(raw_ostream &OS) const {
OS << ArgV[i] << ' ';
OS << '\n';
}
+
+void LLVMDisablePrettyStackTrace() {
+ DisablePrettyStackTrace = true;
+}