<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Nov 2, 2013, at 9:07 PM, Alp Toker <<a href="mailto:alp@nuanti.com">alp@nuanti.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Could we make this the default, then provide<br>LLVMEnablePrettyStackTrace() instead?<br></div></blockquote><div dir="auto"><br></div><div dir="auto">I like this.</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>By definition the C API is for embedding, and embedders don't expect<br>each API they use to install global signal handlers.<br></div></blockquote><div dir="auto"><br></div><div dir="auto">Right, and we could also do the same thing for the fatal error handler.  The default fatal error handler does exit(1), which is clearly not right for embedders.</div><div dir="auto"><br></div><div dir="auto">It seems like both the pretty stack traces and the fatal error handler could be manually enabled by those clients that depend on it.</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>Alp.<br><br><br>On 03/11/2013 00:29, Filip Pizlo wrote:<br><blockquote type="cite">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">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<span class="Apple-converted-space"> </span><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">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">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>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote><br>--<span class="Apple-converted-space"> </span><br><a href="http://www.nuanti.com/">http://www.nuanti.com</a><br>the browser experts</div></blockquote></div><br></body></html>