2 Test lldb breakpoint ids.
5 from __future__ import print_function
11 from lldbsuite.test.lldbtest import *
12 import lldbsuite.test.lldbutil as lldbutil
14 class TestCPPBreakpointLocations(TestBase):
16 mydir = TestBase.compute_mydir(__file__)
18 @expectedFailureWindows("llvm.org/pr24764")
21 self.breakpoint_id_tests ()
23 def verify_breakpoint_locations(self, target, bp_dict):
25 name = bp_dict['name']
26 names = bp_dict['loc_names']
27 bp = target.BreakpointCreateByName (name)
28 self.assertTrue (bp.GetNumLocations() == len(names), "Make sure we find the right number of breakpoint locations")
32 bp_loc_names.append(bp_loc.GetAddress().GetFunction().GetName())
35 found = name in bp_loc_names
37 print("Didn't find '%s' in: %s" % (name, bp_loc_names))
38 self.assertTrue (found, "Make sure we find all required locations")
40 def breakpoint_id_tests (self):
42 # Create a target by the debugger.
43 exe = os.path.join(os.getcwd(), "a.out")
44 target = self.dbg.CreateTarget(exe)
45 self.assertTrue(target, VALID_TARGET)
47 { 'name' : 'func1', 'loc_names' : [ 'a::c::func1()', 'b::c::func1()'] },
48 { 'name' : 'func2', 'loc_names' : [ 'a::c::func2()', 'c::d::func2()'] },
49 { 'name' : 'func3', 'loc_names' : [ 'a::c::func3()', 'b::c::func3()', 'c::d::func3()'] },
50 { 'name' : 'c::func1', 'loc_names' : [ 'a::c::func1()', 'b::c::func1()'] },
51 { 'name' : 'c::func2', 'loc_names' : [ 'a::c::func2()'] },
52 { 'name' : 'c::func3', 'loc_names' : [ 'a::c::func3()', 'b::c::func3()'] },
53 { 'name' : 'a::c::func1', 'loc_names' : [ 'a::c::func1()'] },
54 { 'name' : 'b::c::func1', 'loc_names' : [ 'b::c::func1()'] },
55 { 'name' : 'c::d::func2', 'loc_names' : [ 'c::d::func2()'] },
56 { 'name' : 'a::c::func1()', 'loc_names' : [ 'a::c::func1()'] },
57 { 'name' : 'b::c::func1()', 'loc_names' : [ 'b::c::func1()'] },
58 { 'name' : 'c::d::func2()', 'loc_names' : [ 'c::d::func2()'] },
61 for bp_dict in bp_dicts:
62 self.verify_breakpoint_locations(target, bp_dict)