aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-01-11 20:53:25 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-01-11 20:53:25 +0000
commit08713b37c367b9db29058092c46b41981a74ceff (patch)
treea03065a67e943f1b0586e673c352271e46fbd748
parentc8d12eee12bbd0dca3def72d52e410eaf4e61b2d (diff)
downloadexternal_llvm-08713b37c367b9db29058092c46b41981a74ceff.zip
external_llvm-08713b37c367b9db29058092c46b41981a74ceff.tar.gz
external_llvm-08713b37c367b9db29058092c46b41981a74ceff.tar.bz2
Disable the crash reporter when running lit tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147965 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Support/Unix/Signals.inc20
-rw-r--r--lib/Support/Windows/Signals.inc2
-rw-r--r--utils/lit/lit/TestingConfig.py2
3 files changed, 22 insertions, 2 deletions
diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc
index e286869..75b91ea 100644
--- a/lib/Support/Unix/Signals.inc
+++ b/lib/Support/Unix/Signals.inc
@@ -30,6 +30,10 @@
#include <dlfcn.h>
#include <cxxabi.h>
#endif
+#if HAVE_MACH_MACH_H
+#include <mach/mach.h>
+#endif
+
using namespace llvm;
static RETSIGTYPE SignalHandler(int Sig); // defined below.
@@ -261,6 +265,22 @@ static void PrintStackTrace(void *) {
/// SIGSEGV) is delivered to the process, print a stack trace and then exit.
void llvm::sys::PrintStackTraceOnErrorSignal() {
AddSignalHandler(PrintStackTrace, 0);
+
+#if defined(__APPLE__)
+ // Environment variable to disable any kind of crash dialog.
+ if (getenv("LLVM_DISABLE_CRASH_REPORT")) {
+ mach_port_t self = mach_task_self();
+
+ exception_mask_t mask = EXC_MASK_CRASH;
+
+ kern_return_t ret = task_set_exception_ports(self,
+ mask,
+ NULL,
+ EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES,
+ NULL);
+ (void)ret;
+ }
+#endif
}
diff --git a/lib/Support/Windows/Signals.inc b/lib/Support/Windows/Signals.inc
index 3a7e90b..38308f6 100644
--- a/lib/Support/Windows/Signals.inc
+++ b/lib/Support/Windows/Signals.inc
@@ -239,7 +239,7 @@ static void RegisterHandler() {
SetConsoleCtrlHandler(LLVMConsoleCtrlHandler, TRUE);
// Environment variable to disable any kind of crash dialog.
- if (getenv("LLVM_DISABLE_CRT_DEBUG")) {
+ if (getenv("LLVM_DISABLE_CRASH_REPORT")) {
#ifdef _MSC_VER
_CrtSetReportHook(CRTReportHook);
#endif
diff --git a/utils/lit/lit/TestingConfig.py b/utils/lit/lit/TestingConfig.py
index a92dca8..fe05109 100644
--- a/utils/lit/lit/TestingConfig.py
+++ b/utils/lit/lit/TestingConfig.py
@@ -16,11 +16,11 @@ class TestingConfig:
'PATH' : os.pathsep.join(litConfig.path +
[os.environ.get('PATH','')]),
'SYSTEMROOT' : os.environ.get('SYSTEMROOT',''),
+ 'LLVM_DISABLE_CRASH_REPORT' : '1',
}
if sys.platform == 'win32':
environment.update({
- 'LLVM_DISABLE_CRT_DEBUG' : '1',
'PATHEXT' : os.environ.get('PATHEXT',''),
'PYTHONUNBUFFERED' : '1',
'TEMP' : os.environ.get('TEMP',''),