2 Test breakpoint command for different options.
8 from lldbsuite.test.lldbtest import *
9 import lldbsuite.test.lldbutil as lldbutil
12 class BreakpointOptionsTestCase(TestBase):
14 mydir = TestBase.compute_mydir(__file__)
17 """Test breakpoint command for different options."""
19 self.breakpoint_options_test()
22 # Call super's setUp().
24 # Find the line number to break inside main().
25 self.line = line_number('main.cpp', '// Set break point at this line.')
27 def breakpoint_options_test(self):
28 """Test breakpoint command for different options."""
29 exe = self.getBuildArtifact("a.out")
30 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
32 # This should create a breakpoint with 1 locations.
33 lldbutil.run_break_set_by_file_and_line(
38 num_expected_locations=1)
39 lldbutil.run_break_set_by_file_and_line(
44 num_expected_locations=1)
47 self.runCmd("run", RUN_SUCCEEDED)
50 self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
51 substrs=["stop reason = breakpoint 2."])
53 # Check the list of breakpoint.
56 "Breakpoint locations shown correctly",
58 "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
60 "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
63 # Continue the program, there should be another stop.
64 self.runCmd("process continue")
67 self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
68 substrs=["stop reason = breakpoint 1."])
70 # Continue the program, we should exit.
71 self.runCmd("process continue")
74 self.expect("process status", "Process exited successfully",
75 patterns=["^Process [0-9]+ exited with status = 0"])
77 def breakpoint_options_language_test(self):
78 """Test breakpoint command for language option."""
79 exe = self.getBuildArtifact("a.out")
80 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
82 # This should create a breakpoint with 1 locations.
83 lldbutil.run_break_set_by_symbol(
87 extra_options="-L c++",
88 num_expected_locations=1)
90 # This should create a breakpoint with 0 locations.
91 lldbutil.run_break_set_by_symbol(
96 num_expected_locations=0)
97 self.runCmd("settings set target.language c")
98 lldbutil.run_break_set_by_symbol(
99 self, 'ns::func', sym_exact=False, num_expected_locations=0)
102 self.runCmd("run", RUN_SUCCEEDED)
105 self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
106 substrs=["stop reason = breakpoint 1."])
108 # Continue the program, we should exit.
109 self.runCmd("process continue")
112 self.expect("process status", "Process exited successfully",
113 patterns=["^Process [0-9]+ exited with status = 0"])