brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 0be45c9 Raw
77 lines · python
1"""2Test process attach/resume.3"""4 5 6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10 11exe_name = "AttachResume"  # Must match Makefile12 13 14class AttachResumeTestCase(TestBase):15    NO_DEBUG_INFO_TESTCASE = True16 17    @skipIfRemote18    @expectedFailureNetBSD19    @skipIfWindows  # llvm.org/pr24778, llvm.org/pr2175320    def test_attach_continue_interrupt_detach(self):21        """Test attach/continue/interrupt/detach"""22        self.build()23        self.process_attach_continue_interrupt_detach()24 25    def process_attach_continue_interrupt_detach(self):26        """Test attach/continue/interrupt/detach"""27 28        exe = self.getBuildArtifact(exe_name)29 30        popen = self.spawnSubprocess(exe)31 32        self.runCmd("process attach -p " + str(popen.pid))33 34        self.setAsync(True)35        listener = self.dbg.GetListener()36        process = self.dbg.GetSelectedTarget().GetProcess()37 38        self.runCmd("c")39        lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning])40 41        self.runCmd("process interrupt")42        lldbutil.expect_state_changes(self, listener, process, [lldb.eStateStopped])43 44        # be sure to continue/interrupt/continue (r204504)45        self.runCmd("c")46        lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning])47 48        self.runCmd("process interrupt")49        lldbutil.expect_state_changes(self, listener, process, [lldb.eStateStopped])50 51        # Second interrupt should have no effect.52        self.expect(53            "process interrupt", patterns=["Process is not running"], error=True54        )55 56        # check that this breakpoint is auto-cleared on detach (r204752)57        self.runCmd(58            "br set -f main.cpp -l %u"59            % (line_number("main.cpp", "// Set breakpoint here"))60        )61 62        self.runCmd("c")63        lldbutil.expect_state_changes(64            self, listener, process, [lldb.eStateRunning, lldb.eStateStopped]65        )66        self.expect("br list", "Breakpoint not hit", substrs=["hit count = 1"])67 68        # Make sure the breakpoint is not hit again.69        self.expect("expr debugger_flag = false", substrs=[" = false"])70 71        self.runCmd("c")72        lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning])73 74        # make sure to detach while in running state (r204759)75        self.runCmd("detach")76        lldbutil.expect_state_changes(self, listener, process, [lldb.eStateDetached])77