brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 0a26a9e Raw
48 lines · python
1import gdbremote_testcase2import lldbgdbserverutils3from lldbsuite.test.decorators import *4from lldbsuite.test.lldbtest import *5from lldbsuite.test import lldbutil6 7 8class TestGdbRemoteKill(gdbremote_testcase.GdbRemoteTestCaseBase):9    def test_attach_commandline_kill_after_initial_stop(self):10        self.build()11        self.set_inferior_startup_attach()12        reg_expr = r"^\$[XW][0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}"13        procs = self.prep_debug_monitor_and_inferior()14        self.test_sequence.add_log_lines(15            [16                "read packet: $k#6b",17                {"direction": "send", "regex": reg_expr},18            ],19            True,20        )21 22        if self.stub_sends_two_stop_notifications_on_kill:23            # Add an expectation for a second X result for stubs that send two24            # of these.25            self.test_sequence.add_log_lines(26                [27                    {"direction": "send", "regex": reg_expr},28                ],29                True,30            )31 32        self.expect_gdbremote_sequence()33 34        # Wait a moment for completed and now-detached inferior process to35        # clear.36        time.sleep(self.DEFAULT_SLEEP)37 38        if not lldb.remote_platform:39            # Process should be dead now. Reap results.40            poll_result = procs["inferior"].poll()41            self.assertIsNotNone(poll_result)42 43        # Where possible, verify at the system level that the process is not44        # running.45        self.assertFalse(46            lldbgdbserverutils.process_is_running(procs["inferior"].pid, False)47        )48