1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

add a knob to turn off PrettyStackTrace globally. Patch by Zoltan

Varga!

llvm-svn: 75897
This commit is contained in:
Chris Lattner 2009-07-16 06:17:45 +00:00
parent 4939bd13ad
commit a9fcfe3d18
2 changed files with 12 additions and 1 deletions

View File

@ -19,6 +19,12 @@
namespace llvm { namespace llvm {
class raw_ostream; 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 /// PrettyStackTraceEntry - This class is used to represent a frame of the
/// "pretty" stack trace that is dumped when a program crashes. You can define /// "pretty" stack trace that is dumped when a program crashes. You can define
/// subclasses of this and declare them on the program stack: when they are /// subclasses of this and declare them on the program stack: when they are

View File

@ -19,6 +19,10 @@
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
using namespace llvm; using namespace llvm;
namespace llvm {
bool DisablePrettyStackTrace = false;
}
// FIXME: This should be thread local when llvm supports threads. // FIXME: This should be thread local when llvm supports threads.
static sys::ThreadLocal<const PrettyStackTraceEntry> PrettyStackTraceHead; static sys::ThreadLocal<const PrettyStackTraceEntry> PrettyStackTraceHead;
@ -75,6 +79,7 @@ static void CrashHandler(void *Cookie) {
} }
static bool RegisterCrashPrinter() { static bool RegisterCrashPrinter() {
if (!DisablePrettyStackTrace)
sys::AddSignalHandler(CrashHandler, 0); sys::AddSignalHandler(CrashHandler, 0);
return false; return false;
} }