add a knob to turn off PrettyStackTrace globally. Patch by Zoltan
authorChris Lattner <sabre@nondot.org>
Thu, 16 Jul 2009 06:17:45 +0000 (06:17 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 16 Jul 2009 06:17:45 +0000 (06:17 +0000)
Varga!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75897 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/PrettyStackTrace.h
lib/Support/PrettyStackTrace.cpp

index 909d286f28b63bcd7b400991844342ddd355c580..0db84e1a14c6b9da06be4952de9de24a5a77ebef 100644 (file)
 
 namespace llvm {
   class raw_ostream;
+
+  /// DisablePrettyStackTrace - Set this to true to disable this module. This
+  /// might be neccessary if the host application installs its own signal
+  /// handlers which conflict with the ones installed by this module.
+  /// Defaults to false.
+  extern bool DisablePrettyStackTrace;
   
   /// PrettyStackTraceEntry - This class is used to represent a frame of the
   /// "pretty" stack trace that is dumped when a program crashes. You can define
index 14290a1284fee36e1e7fc4fde72f48de11c9723f..536d9b023fc268883ea98f54e0428034d2961705 100644 (file)
 #include "llvm/ADT/SmallString.h"
 using namespace llvm;
 
+namespace llvm {
+  bool DisablePrettyStackTrace = false;
+}
+
 // FIXME: This should be thread local when llvm supports threads.
 static sys::ThreadLocal<const PrettyStackTraceEntry> PrettyStackTraceHead;
 
@@ -75,7 +79,8 @@ static void CrashHandler(void *Cookie) {
 }
 
 static bool RegisterCrashPrinter() {
-  sys::AddSignalHandler(CrashHandler, 0);
+  if (!DisablePrettyStackTrace)
+    sys::AddSignalHandler(CrashHandler, 0);
   return false;
 }