2 Test inferior restart when breakpoint is set on running target.
6 from lldbsuite.test.decorators import *
7 from lldbsuite.test.lldbtest import *
10 class BreakpointSetRestart(TestBase):
12 mydir = TestBase.compute_mydir(__file__)
13 BREAKPOINT_TEXT = 'Set a breakpoint here'
16 def test_breakpoint_set_restart(self):
19 exe = self.getBuildArtifact("a.out")
21 target = self.dbg.CreateTarget(exe)
22 self.assertTrue(target, VALID_TARGET)
24 self.dbg.SetAsync(True)
25 process = target.LaunchSimple(
26 None, None, self.get_process_working_directory())
27 self.assertTrue(process, PROCESS_IS_VALID)
29 event = lldb.SBEvent()
30 # Wait for inferior to transition to running state
31 while self.dbg.GetListener().WaitForEvent(2, event):
32 if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning:
35 bp = target.BreakpointCreateBySourceRegex(
36 self.BREAKPOINT_TEXT, lldb.SBFileSpec('main.cpp'))
38 bp.IsValid() and bp.GetNumLocations() == 1,
41 while self.dbg.GetListener().WaitForEvent(2, event):
42 if lldb.SBProcess.GetStateFromEvent(
43 event) == lldb.eStateStopped and lldb.SBProcess.GetRestartedFromEvent(event):
45 if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning:
48 "Setting a breakpoint generated an unexpected event: %s" %
49 lldb.SBDebugger.StateAsCString(
50 lldb.SBProcess.GetStateFromEvent(event)))