2 Test lldb breakpoint command for CPP methods & functions in a namespace.
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class CPPBreakpointCommandsTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
17 def make_breakpoint(self, name, type, expected_num_locations):
18 bkpt = self.target.BreakpointCreateByName(name,
21 self.nested_comp_unit)
22 num_locations = bkpt.GetNumLocations()
24 num_locations == expected_num_locations,
25 "Wrong number of locations for '%s', expected: %d got: %d" %
27 expected_num_locations,
31 def test_cpp_breakpoint_cmds(self):
32 """Test a sequence of breakpoint command add, list, and delete."""
35 exe = self.getBuildArtifact("a.out")
37 # Create a target from the debugger.
39 self.target = self.dbg.CreateTarget(exe)
40 self.assertTrue(self.target, VALID_TARGET)
42 self.a_out_module = lldb.SBFileSpecList()
43 self.a_out_module.Append(lldb.SBFileSpec(exe))
45 self.nested_comp_unit = lldb.SBFileSpecList()
46 self.nested_comp_unit.Append(lldb.SBFileSpec("nested.cpp"))
48 # First provide ONLY the method name. This should get everybody...
49 self.make_breakpoint("Function",
50 lldb.eFunctionNameTypeAuto,
53 # Now add the Baz class specifier. This should get the version contained in Bar,
54 # AND the one contained in ::
55 self.make_breakpoint("Baz::Function",
56 lldb.eFunctionNameTypeAuto,
59 # Then add the Bar::Baz specifier. This should get the version
60 # contained in Bar only
61 self.make_breakpoint("Bar::Baz::Function",
62 lldb.eFunctionNameTypeAuto,
65 self.make_breakpoint("Function",
66 lldb.eFunctionNameTypeMethod,
69 self.make_breakpoint("Baz::Function",
70 lldb.eFunctionNameTypeMethod,
73 self.make_breakpoint("Bar::Baz::Function",
74 lldb.eFunctionNameTypeMethod,
77 self.make_breakpoint("Function",
78 lldb.eFunctionNameTypeBase,
81 self.make_breakpoint("Bar::Function",
82 lldb.eFunctionNameTypeBase,