[Support][Windows] Disable error dialog boxes when stack trace printing is enabled.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 26 Jan 2015 17:05:02 +0000 (17:05 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 26 Jan 2015 17:05:02 +0000 (17:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227094 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Windows/Signals.inc

index 35ba6f8e1bba7542cf4c558c79bafab4b5a34dcb..ad740c79a7a3ec5caf006289b669ef7cecf70dba 100644 (file)
@@ -279,6 +279,14 @@ void sys::DontRemoveFileOnSignal(StringRef Filename) {
 /// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or
 /// SIGSEGV) is delivered to the process, print a stack trace and then exit.
 void sys::PrintStackTraceOnErrorSignal() {
+  // Don't pop up any dialog boxes.
+  // We're already handling writing a "something went wrong" message.
+  _set_abort_behavior(0, _WRITE_ABORT_MSG);
+  // Disable Dr. Watson.
+  _set_abort_behavior(0, _CALL_REPORTFAULT);
+  // Disable standard error dialog box.
+  SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
+
   RegisterHandler();
   LeaveCriticalSection(&CriticalSection);
 }