2 When using C++11 in place member initialization, show that we
3 can set and hit breakpoints on initialization lines. This is a
4 little bit tricky because we try not to move file and line breakpoints
5 across function boundaries but these lines are outside the source range
11 import lldbsuite
.test
.lldbutil
as lldbutil
12 from lldbsuite
.test
.lldbtest
import *
15 class TestCase(TestBase
):
16 def test_breakpoints_on_initializers(self
):
17 """Show we can set breakpoints on initializers appearing both before
18 and after the constructor body, and hit them."""
20 self
.main_source_file
= lldb
.SBFileSpec("main.cpp")
21 self
.first_initializer_line
= line_number(
22 "main.cpp", "Set the before constructor breakpoint here"
24 self
.second_initializer_line
= line_number(
25 "main.cpp", "Set the after constructor breakpoint here"
28 (target
, process
, thread
, bkpt
) = lldbutil
.run_to_source_breakpoint(
29 self
, " Set a breakpoint here to get started", self
.main_source_file
32 # Now set breakpoints on the two initializer lines we found in the test startup:
33 bkpt1
= target
.BreakpointCreateByLocation(
34 self
.main_source_file
, self
.first_initializer_line
36 self
.assertEqual(bkpt1
.GetNumLocations(), 1)
37 bkpt2
= target
.BreakpointCreateByLocation(
38 self
.main_source_file
, self
.second_initializer_line
40 self
.assertEqual(bkpt2
.GetNumLocations(), 1)
42 # Now continue, we should stop at the two breakpoints above, first the one before, then
45 len(lldbutil
.continue_to_breakpoint(process
, bkpt1
)),
47 "Hit first breakpoint",
50 len(lldbutil
.continue_to_breakpoint(process
, bkpt2
)),
52 "Hit second breakpoint",