2 Test process attach/resume.
8 from lldbsuite
.test
.decorators
import *
9 from lldbsuite
.test
.lldbtest
import *
10 from lldbsuite
.test
import lldbutil
12 exe_name
= "AttachResume" # Must match Makefile
15 class AttachResumeTestCase(TestBase
):
17 mydir
= TestBase
.compute_mydir(__file__
)
18 NO_DEBUG_INFO_TESTCASE
= True
21 @expectedFailureAll(oslist
=['freebsd'], bugnumber
='llvm.org/pr19310')
22 @expectedFailureNetBSD
23 @skipIfWindows # llvm.org/pr24778, llvm.org/pr21753
24 def test_attach_continue_interrupt_detach(self
):
25 """Test attach/continue/interrupt/detach"""
27 self
.process_attach_continue_interrupt_detach()
29 def process_attach_continue_interrupt_detach(self
):
30 """Test attach/continue/interrupt/detach"""
32 exe
= self
.getBuildArtifact(exe_name
)
34 popen
= self
.spawnSubprocess(exe
)
35 self
.addTearDownHook(self
.cleanupSubprocesses
)
37 self
.runCmd("process attach -p " + str(popen
.pid
))
40 listener
= self
.dbg
.GetListener()
41 process
= self
.dbg
.GetSelectedTarget().GetProcess()
44 lldbutil
.expect_state_changes(
45 self
, listener
, process
, [
48 self
.runCmd("process interrupt")
49 lldbutil
.expect_state_changes(
50 self
, listener
, process
, [
53 # be sure to continue/interrupt/continue (r204504)
55 lldbutil
.expect_state_changes(
56 self
, listener
, process
, [
59 self
.runCmd("process interrupt")
60 lldbutil
.expect_state_changes(
61 self
, listener
, process
, [
64 # Second interrupt should have no effect.
67 patterns
=["Process is not running"],
70 # check that this breakpoint is auto-cleared on detach (r204752)
71 self
.runCmd("br set -f main.cpp -l %u" %
72 (line_number('main.cpp', '// Set breakpoint here')))
75 lldbutil
.expect_state_changes(
76 self
, listener
, process
, [
77 lldb
.eStateRunning
, lldb
.eStateStopped
])
78 self
.expect('br list', 'Breakpoint not hit',
79 substrs
=['hit count = 1'])
81 # Make sure the breakpoint is not hit again.
82 self
.expect("expr debugger_flag = false", substrs
=[" = false"])
85 lldbutil
.expect_state_changes(
86 self
, listener
, process
, [
89 # make sure to detach while in running state (r204759)
91 lldbutil
.expect_state_changes(
92 self
, listener
, process
, [