2 Test that inlined breakpoints (breakpoint set on a file/line included from
3 another source file) works correctly.
9 from lldbsuite.test.lldbtest import *
10 import lldbsuite.test.lldbutil as lldbutil
13 class InlinedBreakpointsTestCase(TestBase):
14 """Bug fixed: rdar://problem/8464339"""
16 mydir = TestBase.compute_mydir(__file__)
18 def test_with_run_command(self):
19 """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp)."""
21 self.inlined_breakpoints()
24 # Call super's setUp().
26 # Find the line number to break inside basic_type.cpp.
27 self.line = line_number(
29 '// Set break point at this line.')
31 def inlined_breakpoints(self):
32 """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp)."""
33 exe = self.getBuildArtifact("a.out")
34 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
36 # With the inline-breakpoint-strategy, our file+line breakpoint should
37 # not resolve to a location.
38 self.runCmd('settings set target.inline-breakpoint-strategy headers')
40 # Set a breakpoint and fail because it is in an inlined source
42 lldbutil.run_break_set_by_file_and_line(
43 self, "basic_type.cpp", self.line, num_expected_locations=0)
45 # Now enable breakpoints in implementation files and see the breakpoint
47 self.runCmd('settings set target.inline-breakpoint-strategy always')
48 # And add hooks to restore the settings during tearDown().
49 self.addTearDownHook(lambda: self.runCmd(
50 "settings set target.inline-breakpoint-strategy always"))
52 lldbutil.run_break_set_by_file_and_line(
56 num_expected_locations=1,
59 self.runCmd("run", RUN_SUCCEEDED)
61 # The stop reason of the thread should be breakpoint.
62 # And it should break at basic_type.cpp:176.
63 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
65 'stop reason = breakpoint',
66 'basic_type.cpp:%d' % self.line])