2 Test process attach/resume.
7 from lldbsuite
.test
.decorators
import *
8 from lldbsuite
.test
.lldbtest
import *
9 from lldbsuite
.test
import lldbutil
11 exe_name
= "AttachResume" # Must match Makefile
14 class AttachResumeTestCase(TestBase
):
15 NO_DEBUG_INFO_TESTCASE
= True
18 @expectedFailureNetBSD
19 @skipIfWindows # llvm.org/pr24778, llvm.org/pr21753
20 def test_attach_continue_interrupt_detach(self
):
21 """Test attach/continue/interrupt/detach"""
23 self
.process_attach_continue_interrupt_detach()
25 def process_attach_continue_interrupt_detach(self
):
26 """Test attach/continue/interrupt/detach"""
28 exe
= self
.getBuildArtifact(exe_name
)
30 popen
= self
.spawnSubprocess(exe
)
32 self
.runCmd("process attach -p " + str(popen
.pid
))
35 listener
= self
.dbg
.GetListener()
36 process
= self
.dbg
.GetSelectedTarget().GetProcess()
39 lldbutil
.expect_state_changes(self
, listener
, process
, [lldb
.eStateRunning
])
41 self
.runCmd("process interrupt")
42 lldbutil
.expect_state_changes(self
, listener
, process
, [lldb
.eStateStopped
])
44 # be sure to continue/interrupt/continue (r204504)
46 lldbutil
.expect_state_changes(self
, listener
, process
, [lldb
.eStateRunning
])
48 self
.runCmd("process interrupt")
49 lldbutil
.expect_state_changes(self
, listener
, process
, [lldb
.eStateStopped
])
51 # Second interrupt should have no effect.
53 "process interrupt", patterns
=["Process is not running"], error
=True
56 # check that this breakpoint is auto-cleared on detach (r204752)
58 "br set -f main.cpp -l %u"
59 % (line_number("main.cpp", "// Set breakpoint here"))
63 lldbutil
.expect_state_changes(
64 self
, listener
, process
, [lldb
.eStateRunning
, lldb
.eStateStopped
]
66 self
.expect("br list", "Breakpoint not hit", substrs
=["hit count = 1"])
68 # Make sure the breakpoint is not hit again.
69 self
.expect("expr debugger_flag = false", substrs
=[" = false"])
72 lldbutil
.expect_state_changes(self
, listener
, process
, [lldb
.eStateRunning
])
74 # make sure to detach while in running state (r204759)
76 lldbutil
.expect_state_changes(self
, listener
, process
, [lldb
.eStateDetached
])