]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / tools / lldb-server / TestGdbRemoteKill.py
1 from __future__ import print_function
2
3
4
5 import gdbremote_testcase
6 import lldbgdbserverutils
7
8 from lldbsuite.test.lldbtest import *
9
10 class TestGdbRemoteKill(gdbremote_testcase.GdbRemoteTestCaseBase):
11
12     mydir = TestBase.compute_mydir(__file__)
13
14     def attach_commandline_kill_after_initial_stop(self):
15         procs = self.prep_debug_monitor_and_inferior()
16         self.test_sequence.add_log_lines([
17             "read packet: $k#6b",
18             {"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
19             ], True)
20
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}" },
25                 ], True)
26
27         self.expect_gdbremote_sequence()
28
29         # Wait a moment for completed and now-detached inferior process to clear.
30         time.sleep(1)
31
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)
36
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))
39
40     @debugserver_test
41     def test_attach_commandline_kill_after_initial_stop_debugserver(self):
42         self.init_debugserver_test()
43         self.build()
44         self.set_inferior_startup_attach()
45         self.attach_commandline_kill_after_initial_stop()
46
47     @llgs_test
48     def test_attach_commandline_kill_after_initial_stop_llgs(self):
49         self.init_llgs_test()
50         self.build()
51         self.set_inferior_startup_attach()
52         self.attach_commandline_kill_after_initial_stop()
53