2 Test that inlined breakpoints (breakpoint set on a file/line included from
3 another source file) works correctly.
6 from __future__ import print_function
10 from lldbsuite.test.lldbtest import *
11 import lldbsuite.test.lldbutil as lldbutil
14 class InlinedBreakpointsTestCase(TestBase):
15 """Bug fixed: rdar://problem/8464339"""
17 mydir = TestBase.compute_mydir(__file__)
19 def test_with_run_command(self):
20 """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp)."""
22 self.inlined_breakpoints()
25 # Call super's setUp().
27 # Find the line number to break inside basic_type.cpp.
28 self.line = line_number(
30 '// Set break point at this line.')
32 def inlined_breakpoints(self):
33 """Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp)."""
34 exe = self.getBuildArtifact("a.out")
35 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
37 # With the inline-breakpoint-strategy, our file+line breakpoint should
38 # not resolve to a location.
39 self.runCmd('settings set target.inline-breakpoint-strategy headers')
41 # Set a breakpoint and fail because it is in an inlined source
43 lldbutil.run_break_set_by_file_and_line(
44 self, "basic_type.cpp", self.line, num_expected_locations=0)
46 # Now enable breakpoints in implementation files and see the breakpoint
48 self.runCmd('settings set target.inline-breakpoint-strategy always')
49 # And add hooks to restore the settings during tearDown().
50 self.addTearDownHook(lambda: self.runCmd(
51 "settings set target.inline-breakpoint-strategy always"))
53 lldbutil.run_break_set_by_file_and_line(
57 num_expected_locations=1,
60 self.runCmd("run", RUN_SUCCEEDED)
62 # The stop reason of the thread should be breakpoint.
63 # And it should break at basic_type.cpp:176.
64 self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
66 'stop reason = breakpoint',
67 'basic_type.cpp:%d' % self.line])