<div dir="ltr"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">+ * Disable LLVM's built-in stack trace code. This must be called before any</span><br style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">
<span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">+ * other LLVM APIs; otherwise the results are undefined.</span><br><div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">I wonder if we have any other functions that "must be called before any other LLVM APIs". It seems likely to provoke confusion. Can you narrow it down to a single "init" function that this must be called before?</span></div>
<div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">-- Sean Silva</span></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sat, Nov 2, 2013 at 8:29 PM, Filip Pizlo <span dir="ltr"><<a href="mailto:fpizlo@apple.com" target="_blank">fpizlo@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: fpizlo<br>
Date: Sat Nov  2 19:29:47 2013<br>
New Revision: 193937<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=193937&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=193937&view=rev</a><br>
Log:<br>
When LLVM is embedded in a larger application, it's not OK for LLVM to intercept crashes.  LLVM already has<br>
the ability to disable this functionality.  This patch exposes it via the C API.<br>
<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm-c/Core.h<br>
    llvm/trunk/lib/Support/PrettyStackTrace.cpp<br>
<br>
Modified: llvm/trunk/include/llvm-c/Core.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=193937&r1=193936&r2=193937&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=193937&r1=193936&r2=193937&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/include/llvm-c/Core.h (original)<br>
+++ llvm/trunk/include/llvm-c/Core.h Sat Nov  2 19:29:47 2013<br>
@@ -434,6 +434,12 @@ void LLVMInstallFatalErrorHandler(LLVMFa<br>
 void LLVMResetFatalErrorHandler(void);<br>
<br>
 /**<br>
+ * Disable LLVM's built-in stack trace code. This must be called before any<br>
+ * other LLVM APIs; otherwise the results are undefined.<br>
+ */<br>
+void LLVMDisablePrettyStackTrace(void);<br>
+<br>
+/**<br>
  * @defgroup LLVMCCoreContext Contexts<br>
  *<br>
  * Contexts are execution states for the core LLVM IR system.<br>
<br>
Modified: llvm/trunk/lib/Support/PrettyStackTrace.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PrettyStackTrace.cpp?rev=193937&r1=193936&r2=193937&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PrettyStackTrace.cpp?rev=193937&r1=193936&r2=193937&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/Support/PrettyStackTrace.cpp (original)<br>
+++ llvm/trunk/lib/Support/PrettyStackTrace.cpp Sat Nov  2 19:29:47 2013<br>
@@ -20,6 +20,7 @@<br>
 #include "llvm/Support/ThreadLocal.h"<br>
 #include "llvm/Support/Watchdog.h"<br>
 #include "llvm/Support/raw_ostream.h"<br>
+#include "llvm-c/Core.h"<br>
<br>
 #ifdef HAVE_CRASHREPORTERCLIENT_H<br>
 #include <CrashReporterClient.h><br>
@@ -147,3 +148,7 @@ void PrettyStackTraceProgram::print(raw_<br>
     OS << ArgV[i] << ' ';<br>
   OS << '\n';<br>
 }<br>
+<br>
+void LLVMDisablePrettyStackTrace() {<br>
+  DisablePrettyStackTrace = true;<br>
+}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>