summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/.gitignore3
-rw-r--r--lldb/source/Host/windows/ProcessLauncherWindows.cpp7
-rw-r--r--lldb/source/lldb.cpp20
-rw-r--r--lldb/test/CMakeLists.txt20
-rwxr-xr-xlldb/test/dotest.py8
5 files changed, 57 insertions, 1 deletions
diff --git a/lldb/.gitignore b/lldb/.gitignore
index d5638220f3b..4b15010a569 100644
--- a/lldb/.gitignore
+++ b/lldb/.gitignore
@@ -15,6 +15,9 @@
*.orig
# Byte compiled python modules.
*.pyc
+*.pyproj
+*.sln
+*.suo
# vim swap files
.*.swp
.sw?
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index f470d580e2d..12e03e14b23 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -38,6 +38,13 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info, Erro
startupinfo.hStdInput = stdin_handle;
startupinfo.hStdOutput = stdout_handle;
+ const char *hide_console_var = getenv("LLDB_LAUNCH_INFERIORS_WITHOUT_CONSOLE");
+ if (hide_console_var && llvm::StringRef(hide_console_var).equals_lower("true"))
+ {
+ startupinfo.dwFlags |= STARTF_USESHOWWINDOW;
+ startupinfo.wShowWindow = SW_HIDE;
+ }
+
DWORD flags = CREATE_NEW_CONSOLE;
if (launch_info.GetFlags().Test(eLaunchFlagDebug))
flags |= DEBUG_ONLY_THIS_PROCESS;
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 ();
diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index 4ded160f1e0..49c2f4892e8 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -42,6 +42,24 @@ set(LLDB_TEST_COMMON_ARGS
-u CFLAGS
)
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+ set(LLDB_TEST_DEBUG_TEST_CRASHES
+ 0
+ CACHE BOOL "(Windows only) Enables debugging of tests in the test suite by showing the crash dialog when lldb crashes")
+
+ set(LLDB_TEST_HIDE_CONSOLE_WINDOWS
+ 1
+ CACHE BOOL "(Windows only) Hides the console window for an inferior when it is launched through the test suite")
+
+ if (LLDB_TEST_DEBUG_TEST_CRASHES)
+ set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS} --enable-crash-dialog)
+ endif()
+
+ if (NOT LLDB_TEST_HIDE_CONSOLE_WINDOWS)
+ set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS} --show-inferior-console)
+ endif()
+endif()
+
add_python_test_target(check-lldb-single
${LLDB_SOURCE_DIR}/test/dotest.py
"${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
@@ -51,7 +69,7 @@ add_python_test_target(check-lldb-single
set(LLDB_DOSEP_ARGS -o;\"-q;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}\")
# If tests crash cause LLDB to crash, or things are otherwise unstable, or if machine-parsable
-# output is desired (i.e. in continuous integration contexts) check-lldb-sep is a better target.
+# output is desired (i.e. in continuous integration contexts) check-lldb-single is a better target.
add_python_test_target(check-lldb
${LLDB_SOURCE_DIR}/test/dosep.py
"${LLDB_DOSEP_ARGS}"
diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py
index bea5d373f09..8b029e5f861 100755
--- a/lldb/test/dotest.py
+++ b/lldb/test/dotest.py
@@ -554,6 +554,10 @@ def parseOptionsAndInitTestdirs():
X('-v', 'Do verbose mode of unittest framework (print out each test case invocation)')
X('-w', 'Insert some wait time (currently 0.5 sec) between consecutive test cases')
X('-T', 'Obtain and dump svn information for this checkout of LLDB (off by default)')
+ group.add_argument('--enable-crash-dialog', dest='disable_crash_dialog', action='store_false', help='(Windows only) When LLDB crashes, display the Windows crash dialog.')
+ group.add_argument('--show-inferior-console', dest='hide_inferior_console', action='store_false', help='(Windows only) When launching an inferior, dont hide its console window.')
+ group.set_defaults(disable_crash_dialog=True)
+ group.set_defaults(hide_inferior_console=True)
# Remove the reference to our helper function
del X
@@ -775,6 +779,10 @@ def parseOptionsAndInitTestdirs():
if args.sharp:
count = args.sharp
+ if sys.platform.startswith('win32'):
+ os.environ['LLDB_DISABLE_CRASH_DIALOG'] = str(args.disable_crash_dialog)
+ os.environ['LLDB_LAUNCH_INFERIORS_WITHOUT_CONSOLE'] = str(args.hide_inferior_console)
+
if do_help == True:
usage(parser)
OpenPOWER on IntegriCloud