1 from __future__ import print_function
5 import gdbremote_testcase
6 import lldbgdbserverutils
8 from lldbsuite.test.lldbtest import *
10 class TestGdbRemoteKill(gdbremote_testcase.GdbRemoteTestCaseBase):
12 mydir = TestBase.compute_mydir(__file__)
14 def attach_commandline_kill_after_initial_stop(self):
15 procs = self.prep_debug_monitor_and_inferior()
16 self.test_sequence.add_log_lines([
18 {"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
21 if self.stub_sends_two_stop_notifications_on_kill:
22 # Add an expectation for a second X result for stubs that send two of these.
23 self.test_sequence.add_log_lines([
24 {"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
27 self.expect_gdbremote_sequence()
29 # Wait a moment for completed and now-detached inferior process to clear.
32 if not lldb.remote_platform:
33 # Process should be dead now. Reap results.
34 poll_result = procs["inferior"].poll()
35 self.assertIsNotNone(poll_result)
37 # Where possible, verify at the system level that the process is not running.
38 self.assertFalse(lldbgdbserverutils.process_is_running(procs["inferior"].pid, False))
41 def test_attach_commandline_kill_after_initial_stop_debugserver(self):
42 self.init_debugserver_test()
44 self.set_inferior_startup_attach()
45 self.attach_commandline_kill_after_initial_stop()
48 def test_attach_commandline_kill_after_initial_stop_llgs(self):
51 self.set_inferior_startup_attach()
52 self.attach_commandline_kill_after_initial_stop()