2 Test process attach/resume.
5 from __future__ import print_function
11 from lldbsuite.test.decorators import *
12 from lldbsuite.test.lldbtest import *
13 from lldbsuite.test import lldbutil
15 exe_name = "AttachResume" # Must match Makefile
17 class AttachResumeTestCase(TestBase):
19 mydir = TestBase.compute_mydir(__file__)
22 @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr19310')
23 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
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 = os.path.join(os.getcwd(), 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(self, listener, process, [lldb.eStateRunning])
46 self.runCmd("process interrupt")
47 lldbutil.expect_state_changes(self, listener, process, [lldb.eStateStopped])
49 # be sure to continue/interrupt/continue (r204504)
51 lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning])
53 self.runCmd("process interrupt")
54 lldbutil.expect_state_changes(self, listener, process, [lldb.eStateStopped])
56 # Second interrupt should have no effect.
57 self.expect("process interrupt", patterns=["Process is not running"], error=True)
59 # check that this breakpoint is auto-cleared on detach (r204752)
60 self.runCmd("br set -f main.cpp -l %u" % (line_number('main.cpp', '// Set breakpoint here')))
63 lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning, lldb.eStateStopped])
64 self.expect('br list', 'Breakpoint not hit',
65 substrs = ['hit count = 1'])
67 # Make sure the breakpoint is not hit again.
68 self.expect("expr debugger_flag = false", substrs=[" = false"]);
71 lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning])
73 # make sure to detach while in running state (r204759)
75 lldbutil.expect_state_changes(self, listener, process, [lldb.eStateDetached])