Index: packages/Python/lldbsuite/test/dotest.py =================================================================== --- packages/Python/lldbsuite/test/dotest.py +++ packages/Python/lldbsuite/test/dotest.py @@ -1310,8 +1310,8 @@ # Don't do debugserver tests on anything except OS X. configuration.dont_do_debugserver_test = "linux" in target_platform or "freebsd" in target_platform or "windows" in target_platform - # Don't do lldb-server (llgs) tests on anything except Linux. - configuration.dont_do_llgs_test = not ("linux" in target_platform) + # Don't do lldb-server (llgs) tests on anything except Linux and Windows. + configuration.dont_do_llgs_test = not ("linux" in target_platform) and not ("windows" in target_platform) # Collect tests from the specified testing directories. If a test # subdirectory filter is explicitly specified, limit the search to that Index: packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py +++ packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py @@ -104,6 +104,7 @@ # tests don't get skipped. # + @skipIfWindows # no auxv support. @llgs_test def test_supports_auxv_llgs(self): self.init_llgs_test() @@ -127,6 +128,7 @@ self.set_inferior_startup_launch() self.auxv_data_is_correct_size() + @skipIfWindows @llgs_test def test_auxv_data_is_correct_size_llgs(self): self.init_llgs_test() @@ -165,6 +167,7 @@ self.set_inferior_startup_launch() self.auxv_keys_look_valid() + @skipIfWindows @llgs_test def test_auxv_keys_look_valid_llgs(self): self.init_llgs_test() @@ -212,6 +215,7 @@ self.set_inferior_startup_launch() self.auxv_chunked_reads_work() + @skipIfWindows @llgs_test def test_auxv_chunked_reads_work_llgs(self): self.init_llgs_test() Index: packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py +++ packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py @@ -14,17 +14,18 @@ @skipIfDarwinEmbedded # lldb-server tests not updated to work on ios etc yet def attach_commandline_kill_after_initial_stop(self): + reg_expr = r"^\$[XW][0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" procs = self.prep_debug_monitor_and_inferior() self.test_sequence.add_log_lines([ "read packet: $k#6b", - {"direction": "send", "regex": r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}"}, + {"direction": "send", "regex": reg_expr}, ], True) if self.stub_sends_two_stop_notifications_on_kill: # Add an expectation for a second X result for stubs that send two # of these. self.test_sequence.add_log_lines([ - {"direction": "send", "regex": r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}"}, + {"direction": "send", "regex": reg_expr}, ], True) self.expect_gdbremote_sequence() Index: packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py +++ packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py @@ -1,6 +1,6 @@ from __future__ import print_function - +import json import gdbremote_testcase import lldbgdbserverutils from lldbsuite.support import seven @@ -20,9 +20,9 @@ info = self.parse_process_info_response(context) self.test_sequence.add_log_lines([ - 'read packet: $jModulesInfo:[{"file":"%s","triple":"%s"}]]#00' % ( - lldbutil.append_to_process_working_directory(self, "a.out"), - seven.unhexlify(info["triple"])), + 'read packet: $jModulesInfo:%s]#00' % json.dumps( + [{"file":lldbutil.append_to_process_working_directory(self, "a.out"), + "triple":seven.unhexlify(info["triple"])}]), {"direction": "send", "regex": r'^\$\[{(.*)}\]\]#[0-9A-Fa-f]{2}', "capture": {1: "spec"}}, Index: packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py +++ packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py @@ -175,12 +175,11 @@ self.build() self.qProcessInfo_contains_keys(set(['cputype', 'cpusubtype'])) - @skipUnlessPlatform(["linux"]) @llgs_test - def test_qProcessInfo_contains_triple_llgs_linux(self): + def test_qProcessInfo_contains_triple_ppid_llgs(self): self.init_llgs_test() self.build() - self.qProcessInfo_contains_keys(set(['triple'])) + self.qProcessInfo_contains_keys(set(['triple', 'parent-pid'])) @skipUnlessDarwin @debugserver_test @@ -203,9 +202,9 @@ # for the remote Host and Process. self.qProcessInfo_does_not_contain_keys(set(['triple'])) - @skipUnlessPlatform(["linux"]) + @skipIfDarwin @llgs_test - def test_qProcessInfo_does_not_contain_cputype_cpusubtype_llgs_linux(self): + def test_qProcessInfo_does_not_contain_cputype_cpusubtype_llgs(self): self.init_llgs_test() self.build() self.qProcessInfo_does_not_contain_keys(set(['cputype', 'cpusubtype'])) Index: packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py +++ packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py @@ -20,6 +20,7 @@ self.single_step_only_steps_one_instruction( use_Hc_packet=True, step_instruction="s") + @skipIfWindows # No pty support to test any inferior std -i/e/o @llgs_test @expectedFailureAndroid( bugnumber="llvm.org/pr24739", Index: packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py +++ packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py @@ -205,6 +205,11 @@ self.set_inferior_startup_launch() self.stop_reply_reports_multiple_threads(5) + # In the current implementation of llgs on Windows a response to a '\x03' packet causes the debugger + # of the native process to trigger a call to DebugBreakProcess. This will create a new thread to handle + # the exception debug event and one more stop thread will be notified to the delegate, i.e. llgs. + # Therefore, the tests below are all expected to fail on Windows. + @expectedFailureAll(oslist=["windows"]) @llgs_test def test_stop_reply_reports_multiple_threads_llgs(self): self.init_llgs_test() @@ -226,6 +231,7 @@ self.set_inferior_startup_launch() self.no_QListThreadsInStopReply_supplies_no_threads(5) + @expectedFailureAll(oslist=["windows"]) @llgs_test def test_no_QListThreadsInStopReply_supplies_no_threads_llgs(self): self.init_llgs_test() @@ -263,6 +269,7 @@ self.set_inferior_startup_launch() self.stop_reply_reports_correct_threads(5) + @expectedFailureAll(oslist=["windows"]) @llgs_test def test_stop_reply_reports_correct_threads_llgs(self): self.init_llgs_test() @@ -287,6 +294,7 @@ self.assertTrue(int(stop_reply_pcs[thread_id], 16) == int(threads_info_pcs[thread_id], 16)) + @expectedFailureAll(oslist=["windows"]) @llgs_test def test_stop_reply_contains_thread_pcs_llgs(self): self.init_llgs_test() Index: packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py +++ packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py @@ -55,7 +55,15 @@ # Wait until all threads have started. threads = self.wait_for_thread_count(thread_count, timeout_seconds=3) self.assertIsNotNone(threads) - self.assertEqual(len(threads), thread_count) + + # On Windows there can be additional threads spawned. For example, DebugBreakProcess will + # create a new thread from the debugged process to handle an exception event. So here we + # assert 'GreaterEqual' condition. + triple = self.dbg.GetSelectedPlatform().GetTriple() + if re.match(".*-.*-windows", triple): + self.assertGreaterEqual(len(threads), thread_count) + else: + self.assertEqual(len(threads), thread_count) # Grab stop reply for each thread via qThreadStopInfo{tid:hex}. stop_replies = {} @@ -102,7 +110,12 @@ def qThreadStopInfo_works_for_multiple_threads(self, thread_count): (stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(thread_count) - self.assertEqual(len(stop_replies), thread_count) + triple = self.dbg.GetSelectedPlatform().GetTriple() + # Consider one more thread created by calling DebugBreakProcess. + if re.match(".*-.*-windows", triple): + self.assertGreaterEqual(len(stop_replies), thread_count) + else: + self.assertEqual(len(stop_replies), thread_count) @debugserver_test def test_qThreadStopInfo_works_for_multiple_threads_debugserver(self): @@ -131,7 +144,13 @@ stop_replies.values()) if stop_reason != 0) # All but one thread should report no stop reason. - self.assertEqual(no_stop_reason_count, thread_count - 1) + triple = self.dbg.GetSelectedPlatform().GetTriple() + + # Consider one more thread created by calling DebugBreakProcess. + if re.match(".*-.*-windows", triple): + self.assertGreaterEqual(no_stop_reason_count, thread_count - 1) + else: + self.assertEqual(no_stop_reason_count, thread_count - 1) # Only one thread should should indicate a stop reason. self.assertEqual(with_stop_reason_count, 1) @@ -173,7 +192,8 @@ self.qThreadStopInfo_has_valid_thread_names(self.THREAD_COUNT, "a.out") # test requires OS with set, equal thread names by default. - @skipUnlessPlatform(["linux"]) + # Windows threads do not have a name property and use the process name by default. + @skipUnlessPlatform(["linux", "windows"]) @llgs_test def test_qThreadStopInfo_has_valid_thread_names_llgs(self): self.init_llgs_test() Index: packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py +++ packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py @@ -105,6 +105,7 @@ self.single_step_only_steps_one_instruction( use_Hc_packet=True, step_instruction="vCont;s") + @skipIfWindows # No pty support to test O* & I* notification packets. @llgs_test @expectedFailureAndroid( bugnumber="llvm.org/pr24739", @@ -136,6 +137,7 @@ self.single_step_only_steps_one_instruction( use_Hc_packet=False, step_instruction="vCont;s:{thread}") + @skipIfWindows # No pty support to test O* & I* notification packets. @llgs_test @expectedFailureAndroid( bugnumber="llvm.org/pr24739", Index: packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py +++ packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py @@ -158,6 +158,7 @@ self.build() self.inferior_print_exit() + @skipIfWindows # No pty support to test any inferior output @llgs_test @expectedFlakeyLinux("llvm.org/pr25652") def test_inferior_print_exit_llgs(self): @@ -436,6 +437,7 @@ self.targetHasAVX(), "Advanced Vector Extensions" in register_sets) + @expectedFailureAll(oslist=["windows"]) # no avx for now. @llgs_test def test_qRegisterInfo_contains_avx_registers_llgs(self): self.init_llgs_test() @@ -465,6 +467,7 @@ self.set_inferior_startup_launch() self.qThreadInfo_contains_thread() + @expectedFailureAll(oslist=["windows"]) # expect one more thread stopped @llgs_test def test_qThreadInfo_contains_thread_launch_llgs(self): self.init_llgs_test() @@ -480,6 +483,7 @@ self.set_inferior_startup_attach() self.qThreadInfo_contains_thread() + @expectedFailureAll(oslist=["windows"]) # expect one more thread stopped @llgs_test def test_qThreadInfo_contains_thread_attach_llgs(self): self.init_llgs_test() @@ -523,6 +527,7 @@ self.set_inferior_startup_launch() self.qThreadInfo_matches_qC() + @expectedFailureAll(oslist=["windows"]) # expect one more thread stopped @llgs_test def test_qThreadInfo_matches_qC_launch_llgs(self): self.init_llgs_test() @@ -538,6 +543,7 @@ self.set_inferior_startup_attach() self.qThreadInfo_matches_qC() + @expectedFailureAll(oslist=["windows"]) # expect one more thread stopped @llgs_test def test_qThreadInfo_matches_qC_attach_llgs(self): self.init_llgs_test() @@ -668,6 +674,7 @@ self.set_inferior_startup_launch() self.Hg_switches_to_3_threads() + @expectedFailureAll(oslist=["windows"]) # expect 4 threads @llgs_test def test_Hg_switches_to_3_threads_launch_llgs(self): self.init_llgs_test() @@ -683,6 +690,7 @@ self.set_inferior_startup_attach() self.Hg_switches_to_3_threads() + @expectedFailureAll(oslist=["windows"]) # expecting one more thread @llgs_test def test_Hg_switches_to_3_threads_attach_llgs(self): self.init_llgs_test() @@ -812,6 +820,7 @@ # expectations about fixed signal numbers. self.Hc_then_Csignal_signals_correct_thread(self.TARGET_EXC_BAD_ACCESS) + @skipIfWindows # no SIGSEGV support @llgs_test def test_Hc_then_Csignal_signals_correct_thread_launch_llgs(self): self.init_llgs_test() @@ -880,6 +889,7 @@ self.set_inferior_startup_launch() self.m_packet_reads_memory() + @skipIfWindows # No pty support to test any inferior output @llgs_test def test_m_packet_reads_memory_llgs(self): self.init_llgs_test() @@ -970,6 +980,7 @@ self.set_inferior_startup_launch() self.qMemoryRegionInfo_reports_code_address_as_executable() + @skipIfWindows # No pty support to test any inferior output @llgs_test def test_qMemoryRegionInfo_reports_code_address_as_executable_llgs(self): self.init_llgs_test() @@ -1035,6 +1046,7 @@ self.set_inferior_startup_launch() self.qMemoryRegionInfo_reports_stack_address_as_readable_writeable() + @skipIfWindows # No pty support to test any inferior output @llgs_test def test_qMemoryRegionInfo_reports_stack_address_as_readable_writeable_llgs( self): @@ -1100,6 +1112,7 @@ self.set_inferior_startup_launch() self.qMemoryRegionInfo_reports_heap_address_as_readable_writeable() + @skipIfWindows # No pty support to test any inferior output @llgs_test def test_qMemoryRegionInfo_reports_heap_address_as_readable_writeable_llgs( self): @@ -1252,6 +1265,7 @@ self.set_inferior_startup_launch() self.breakpoint_set_and_remove_work(want_hardware=False) + @skipIfWindows # No pty support to test any inferior output @llgs_test @expectedFlakeyLinux("llvm.org/pr25652") def test_software_breakpoint_set_and_remove_work_llgs(self): @@ -1389,6 +1403,7 @@ self.set_inferior_startup_launch() self.written_M_content_reads_back_correctly() + @skipIfWindows # No pty support to test any inferior output @llgs_test @expectedFlakeyLinux("llvm.org/pr25652") def test_written_M_content_reads_back_correctly_llgs(self): @@ -1564,6 +1579,7 @@ self.set_inferior_startup_launch() self.P_and_p_thread_suffix_work() + @skipIfWindows @llgs_test def test_P_and_p_thread_suffix_work_llgs(self): self.init_llgs_test() Index: packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py +++ packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py @@ -49,6 +49,7 @@ self.set_inferior_startup_launch() self.sid_is_same_without_setsid() + @skipIfWindows @llgs_test @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target @expectedFailureAll(oslist=['freebsd']) @@ -64,6 +65,7 @@ self.set_inferior_startup_launch() self.sid_is_different_with_setsid() + @skipIfWindows @llgs_test @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target def test_sid_is_different_with_setsid_llgs(self): @@ -78,6 +80,7 @@ self.set_inferior_startup_launch() self.sid_is_different_with_S() + @skipIfWindows @llgs_test @skipIfRemote # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target def test_sid_is_different_with_S_llgs(self): Index: packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py +++ packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py @@ -235,6 +235,10 @@ # Remote platforms don't support named pipe based port negotiation use_named_pipe = False + triple = self.dbg.GetSelectedPlatform().GetTriple() + if re.match(".*-.*-windows", triple): + self.skipTest("Remotely testing is not supported on Windows yet.") + # Grab the ppid from /proc/[shell pid]/stat err, retcode, shell_stat = self.run_platform_command( "cat /proc/$$/stat") @@ -260,6 +264,10 @@ # Remove if it's there. self.debug_monitor_exe = re.sub(r' \(deleted\)$', '', exe) else: + # Need to figure out how to create a named pipe on Windows. + if platform.system() == 'Windows': + use_named_pipe = False + self.debug_monitor_exe = get_lldb_server_exe() if not self.debug_monitor_exe: self.skipTest("lldb-server exe not found") Index: packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py +++ packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py @@ -37,6 +37,7 @@ self.build() self.inferior_abort_received() + @skipIfWindows # No signal is sent on Windows. @llgs_test # std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836 @expectedFailureAndroid(api_levels=list(range(16 + 1))) Index: packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py +++ packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py @@ -39,6 +39,7 @@ self.build() self.inferior_seg_fault_received(self.GDB_REMOTE_STOP_CODE_BAD_ACCESS) + @skipIfWindows # No signal is sent on Windows. @llgs_test def test_inferior_seg_fault_received_llgs(self): self.init_llgs_test() Index: packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py +++ packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py @@ -926,6 +926,12 @@ # Convert text pids to ints process_ids = [int(text_pid) for text_pid in text_process_ids if text_pid != ''] + elif platform.system() == 'Windows': + output = subprocess.check_output( + "for /f \"tokens=2 delims=,\" %F in ('tasklist /nh /fi \"PID ne 0\" /fo csv') do @echo %~F", shell=True).decode("utf-8") + text_process_ids = output.split('\n')[1:] + process_ids = [int(text_pid) + for text_pid in text_process_ids if text_pid != ''] # elif {your_platform_here}: # fill in process_ids as a list of int type process IDs running on # the local system. Index: packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py +++ packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py @@ -81,6 +81,7 @@ self.ignore_signals(signals_to_ignore) self.expect_exit_code(len(signals_to_ignore)) + @skipIfWindows # no signal support @llgs_test def test_default_signals_behavior(self): self.init_llgs_test() Index: packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py +++ packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py @@ -29,6 +29,7 @@ kv_dict = self.parse_key_val_dict(context.get("key_vals_text")) self.assertEqual(expected_name, kv_dict.get("name")) + @skipIfWindows # the test is not updated for Windows. @llgs_test def test(self): """ Make sure lldb-server can retrieve inferior thread name"""