<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;"><div><div>On Nov 2, 2013, at 9:15 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;">Brilliant. Could you revert the API addition of<br>LLVMDisablePrettyStackTrace() in r193937 while we figure this out?<br></div></blockquote><div dir="auto"><br></div><div dir="auto">I'd rather not. Without this function, it's impossible for a C API client to embed LLVM.<br><div dir="auto"></div></div><div dir="auto"><br></div><div dir="auto">I agree that there is a better solution out there, but I'd rather have this as a stop-gap until then. Is there any real harm to having this in the tree in the meantime? Because there is clear harm on my end from removing it - namely, the usual crash recording machinery for OS X applications doesn't work as soon as LLVM is embedded.</div><div dir="auto"><br></div><div dir="auto">-Filip</div><div dir="auto"><br></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>The new approach will be a step towards cleaning up libclang as well:<br><br>tools/libclang/CIndex.cpp- // Disable pretty stack trace functionality,<br>which will otherwise be a very<br>tools/libclang/CIndex.cpp- // poor citizen of the world and set up all<br>sorts of signal handlers.<br>tools/libclang/CIndex.cpp: llvm::DisablePrettyStackTrace = true;<br><br>Thanks for noticing the issue and starting on a solution!<br><br>Alp.<br><br><br>On 03/11/2013 04:10, Filip Pizlo wrote:<br><blockquote type="cite"><br>On Nov 2, 2013, at 9:07 PM, Alp Toker <<a href="mailto:alp@nuanti.com">alp@nuanti.com</a><br><<a href="mailto:alp@nuanti.com">mailto:alp@nuanti.com</a>>> wrote:<br><br><blockquote type="cite">Could we make this the default, then provide<br>LLVMEnablePrettyStackTrace() instead?<br></blockquote><br>I like this.<br><br><blockquote type="cite"><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></blockquote><br>Right, and we could also do the same thing for the fatal error<br>handler. The default fatal error handler does exit(1), which is<br>clearly not right for embedders.<br><br>It seems like both the pretty stack traces and the fatal error handler<br>could be manually enabled by those clients that depend on it.<br><br><blockquote type="cite"><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:<span class="Apple-converted-space"> </span><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<br>to intercept crashes. LLVM already has<span class="Apple-converted-space"> </span><br>the ability to disable this functionality. This patch exposes it<br>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:<br><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<br>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:<br><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><span class="Apple-converted-space"> </span><<a href="mailto:llvm-commits@cs.uiuc.edu">mailto:llvm-commits@cs.uiuc.edu</a>><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote><br>--<span class="Apple-converted-space"> </span><br><a href="http://www.nuanti.com/">http://www.nuanti.com</a><span class="Apple-converted-space"> </span><<a href="http://www.nuanti.com/">http://www.nuanti.com/</a>><br>the browser experts<br></blockquote><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>