diff options
author | Zachary Turner <zturner@google.com> | 2014-12-12 18:10:52 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2014-12-12 18:10:52 +0000 |
commit | 555a7a6ad2267c196993839930e962588a1f62d0 (patch) | |
tree | f478902c29ca17717e54d699b42ec3490122525e /lldb/source/lldb.cpp | |
parent | 59aaa6c06b80bd7285573b407dad4f3e008351de (diff) | |
download | bcm5719-llvm-555a7a6ad2267c196993839930e962588a1f62d0.tar.gz bcm5719-llvm-555a7a6ad2267c196993839930e962588a1f62d0.zip |
Add a method to disable the Windows crash / assert dialogs.
When running the test suite on Windows, we can't have Windows popping
up dialogs when LLDB crashes in native code because it will hang
the test suite. This patch silences those dialogs by checking an
environment variable at startup and configuring Windows based on
its value.
This patch also adds an environment variable to force inferiors to
never spawn in their own console window. This is useful to prevent
new window spawm when running the test suite.
Reviewed by: Scott Graham
Differential Revision: http://reviews.llvm.org/D6628
llvm-svn: 224137
Diffstat (limited to 'lldb/source/lldb.cpp')
-rw-r--r-- | lldb/source/lldb.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lldb/source/lldb.cpp b/lldb/source/lldb.cpp index 0fe871aafde..2ac8296b4d0 100644 --- a/lldb/source/lldb.cpp +++ b/lldb/source/lldb.cpp @@ -83,6 +83,7 @@ #endif #if defined (_WIN32) +#include "lldb/Host/windows/windows.h" #include "Plugins/Process/Windows/DynamicLoaderWindows.h" #include "Plugins/Process/Windows/ProcessWindows.h" #endif @@ -118,6 +119,25 @@ lldb_private::Initialize () if (!g_inited) { g_inited = true; + +#if defined(_MSC_VER) + const char *disable_crash_dialog_var = getenv("LLDB_DISABLE_CRASH_DIALOG"); + if (disable_crash_dialog_var && llvm::StringRef(disable_crash_dialog_var).equals_lower("true")) + { + // This will prevent Windows from displaying a dialog box requiring user interaction when + // LLDB crashes. This is mostly useful when automating LLDB, for example via the test + // suite, so that a crash in LLDB does not prevent completion of the test suite. + ::SetErrorMode(GetErrorMode() | SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); + + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); + } +#endif + Log::Initialize(); HostInfo::Initialize(); Timer::Initialize (); |