[llvm] r193937 - When LLVM is embedded in a larger application, it's not OK for LLVM to intercept crashes. LLVM already has

Filip Pizlo fpizlo at apple.com
Sat Nov 2 17:29:48 PDT 2013


Author: fpizlo
Date: Sat Nov  2 19:29:47 2013
New Revision: 193937

URL: http://llvm.org/viewvc/llvm-project?rev=193937&view=rev
Log:
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.


Modified:
    llvm/trunk/include/llvm-c/Core.h
    llvm/trunk/lib/Support/PrettyStackTrace.cpp

Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=193937&r1=193936&r2=193937&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Sat Nov  2 19:29:47 2013
@@ -434,6 +434,12 @@ void LLVMInstallFatalErrorHandler(LLVMFa
 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.

Modified: llvm/trunk/lib/Support/PrettyStackTrace.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PrettyStackTrace.cpp?rev=193937&r1=193936&r2=193937&view=diff
==============================================================================
--- llvm/trunk/lib/Support/PrettyStackTrace.cpp (original)
+++ llvm/trunk/lib/Support/PrettyStackTrace.cpp Sat Nov  2 19:29:47 2013
@@ -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_
     OS << ArgV[i] << ' ';
   OS << '\n';
 }
+
+void LLVMDisablePrettyStackTrace() {
+  DisablePrettyStackTrace = true;
+}





More information about the llvm-commits mailing list