[AMDGPU] Add True16 register classes.
[llvm-project.git] / lldb / test / API / commands / process / attach-resume / TestAttachResume.py
blob0be45c9e0934fa21645a2f9a710083d0bc2222f7
1 """
2 Test process attach/resume.
3 """
6 import lldb
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
17 @skipIfRemote
18 @expectedFailureNetBSD
19 @skipIfWindows # llvm.org/pr24778, llvm.org/pr21753
20 def test_attach_continue_interrupt_detach(self):
21 """Test attach/continue/interrupt/detach"""
22 self.build()
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))
34 self.setAsync(True)
35 listener = self.dbg.GetListener()
36 process = self.dbg.GetSelectedTarget().GetProcess()
38 self.runCmd("c")
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)
45 self.runCmd("c")
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.
52 self.expect(
53 "process interrupt", patterns=["Process is not running"], error=True
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"))
62 self.runCmd("c")
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"])
71 self.runCmd("c")
72 lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning])
74 # make sure to detach while in running state (r204759)
75 self.runCmd("detach")
76 lldbutil.expect_state_changes(self, listener, process, [lldb.eStateDetached])