2 Test breakpoint commands set before we have a target
8 from lldbsuite.test.lldbtest import *
9 import lldbsuite.test.lldbutil as lldbutil
12 class BreakpointInDummyTarget (TestBase):
14 mydir = TestBase.compute_mydir(__file__)
17 """Test breakpoint set before we have a target. """
19 self.dummy_breakpoint_test()
22 # Call super's setUp().
24 # Find the line number to break inside main().
25 self.line = line_number('main.c', 'Set a breakpoint on this line.')
26 self.line2 = line_number('main.c', 'Set another on this line.')
28 def dummy_breakpoint_test(self):
29 """Test breakpoint set before we have a target. """
31 # This should create a breakpoint with 3 locations.
32 lldbutil.run_break_set_by_file_and_line(
33 self, "main.c", self.line, num_expected_locations=0)
34 lldbutil.run_break_set_by_file_and_line(
35 self, "main.c", self.line2, num_expected_locations=0)
37 # This is the function to remove breakpoints from the dummy target
38 # to get a clean slate for the next test case.
40 self.runCmd('breakpoint delete -D -f', check=False)
41 self.runCmd('breakpoint list', check=False)
43 # Execute the cleanup function during test case tear down.
44 self.addTearDownHook(cleanup)
46 exe = self.getBuildArtifact("a.out")
47 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
49 # The breakpoint list should show 3 locations.
52 "Breakpoint locations shown correctly",
54 "1: file = 'main.c', line = %d, exact_match = 0, locations = 1" %
56 "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" %
60 self.runCmd("run", RUN_SUCCEEDED)
63 self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
64 substrs=["stop reason = breakpoint 1."])
66 # Continue the program, there should be another stop.
67 self.runCmd("process continue")
70 self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
71 substrs=["stop reason = breakpoint 2."])