[Support][Windows] Disable error dialog boxes when stack trace printing is enabled.

llvm-svn: 227094
This commit is contained in:
Michael J. Spencer 2015-01-26 17:05:02 +00:00
parent 831fc5e87d
commit f5215652d5
1 changed files with 8 additions and 0 deletions

View 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);
}