2 Test continue from a breakpoint when there is a breakpoint on the next instruction also.
5 from __future__ import print_function
11 import lldbsuite.test.lldbutil as lldbutil
12 from lldbsuite.test.lldbtest import *
14 class ConsecutiveBreakpoitsTestCase(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
18 @expectedFailureAll("llvm.org/pr23478", oslist = not_in(["macosx"]))
21 self.consecutive_breakpoints_tests()
23 def consecutive_breakpoints_tests(self):
24 exe = os.path.join (os.getcwd(), "a.out")
26 # Create a target by the debugger.
27 target = self.dbg.CreateTarget(exe)
28 self.assertTrue(target, VALID_TARGET)
30 breakpoint = target.BreakpointCreateBySourceRegex("Set breakpoint here", lldb.SBFileSpec("main.cpp"))
31 self.assertTrue(breakpoint and
32 breakpoint.GetNumLocations() == 1,
35 # Now launch the process, and do not stop at entry point.
36 process = target.LaunchSimple (None, None, self.get_process_working_directory())
37 self.assertTrue(process, PROCESS_IS_VALID)
39 # We should be stopped at the first breakpoint
40 thread = process.GetThreadAtIndex(0)
41 self.assertEqual(thread.GetStopReason(), lldb.eStopReasonBreakpoint)
43 # Set breakpoint to the next instruction
44 frame = thread.GetFrameAtIndex(0)
46 address = frame.GetPCAddress()
47 instructions = target.ReadInstructions(address, 2)
48 self.assertTrue(len(instructions) == 2)
49 address = instructions[1].GetAddress()
51 target.BreakpointCreateByAddress(address.GetLoadAddress(target))
54 # We should be stopped at the second breakpoint
55 thread = process.GetThreadAtIndex(0)
56 self.assertEqual(thread.GetStopReason(), lldb.eStopReasonBreakpoint)
58 # Run the process until termination