diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-26 14:55:36 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-26 14:55:36 +0000 |
commit | 71b1c76cdf349b1cc838336a62374ca8e06db5a0 (patch) | |
tree | 24ddbece1f9e2a5edc635a782348daef04da1fb1 /lib | |
parent | 16a0de5b4aa25dc54129841b82bdbe2601482fe9 (diff) | |
download | external_llvm-71b1c76cdf349b1cc838336a62374ca8e06db5a0.zip external_llvm-71b1c76cdf349b1cc838336a62374ca8e06db5a0.tar.gz external_llvm-71b1c76cdf349b1cc838336a62374ca8e06db5a0.tar.bz2 |
Improve our error handling on windows.
* Remove LLVM_ENABLE_CRT_REPORT. LLVM_DISABLE_CRASH_REPORT made it redundant.
* set Return to 1, so that we get a stack trace on failure.
* don't call _exit, so that we get a negative exit value and "not --crash"
correctly differentiates crashes and regular errors.
This is a bit experimental since the documentation on this interface is sparse.
It doesn't bring up a dialog on my windows setup, but feel free to revert
if it causes problem for your setup (and let me know what it is so that I
can try to fix this patch).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187206 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Support/Windows/Signals.inc | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/lib/Support/Windows/Signals.inc b/lib/Support/Windows/Signals.inc index 941aa28..bce83b9 100644 --- a/lib/Support/Windows/Signals.inc +++ b/lib/Support/Windows/Signals.inc @@ -193,34 +193,6 @@ static int AvoidMessageBoxHook(int ReportType, char *Message, int *Return) { return TRUE; } -/// CRTReportHook - Function called on a CRT debugging event. -static int CRTReportHook(int ReportType, char *Message, int *Return) { - // Don't cause a DebugBreak() on return. - if (Return) - *Return = 0; - - switch (ReportType) { - default: - case _CRT_ASSERT: - fprintf(stderr, "CRT assert: %s\n", Message); - // FIXME: Is there a way to just crash? Perhaps throw to the unhandled - // exception code? Perhaps SetErrorMode() handles this. - _exit(3); - break; - case _CRT_ERROR: - fprintf(stderr, "CRT error: %s\n", Message); - // FIXME: Is there a way to just crash? Perhaps throw to the unhandled - // exception code? Perhaps SetErrorMode() handles this. - _exit(3); - break; - case _CRT_WARN: - fprintf(stderr, "CRT warn: %s\n", Message); - break; - } - - // Don't call _CrtDbgReport. - return TRUE; -} #endif static void RegisterHandler() { @@ -253,19 +225,10 @@ static void RegisterHandler() { OldFilter = SetUnhandledExceptionFilter(LLVMUnhandledExceptionFilter); SetConsoleCtrlHandler(LLVMConsoleCtrlHandler, TRUE); -#ifdef _MSC_VER - const char *EnableMsgbox = getenv("LLVM_ENABLE_CRT_REPORT"); - if (!EnableMsgbox || strcmp("0", EnableMsgbox) == 0) { - // Setting a report hook overrides the default behavior of popping an "abort, - // retry, or ignore" dialog. - _CrtSetReportHook(AvoidMessageBoxHook); - } -#endif - // Environment variable to disable any kind of crash dialog. if (getenv("LLVM_DISABLE_CRASH_REPORT")) { #ifdef _MSC_VER - _CrtSetReportHook(CRTReportHook); + _CrtSetReportHook(AvoidMessageBoxHook); #endif SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | |