]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / breakpoint / cpp / TestCPPBreakpointLocations.py
1 """
2 Test lldb breakpoint ids.
3 """
4
5 from __future__ import print_function
6
7
8
9 import os, time
10 import lldb
11 from lldbsuite.test.lldbtest import *
12 import lldbsuite.test.lldbutil as lldbutil
13
14 class TestCPPBreakpointLocations(TestBase):
15
16     mydir = TestBase.compute_mydir(__file__)
17
18     @expectedFailureWindows("llvm.org/pr24764")
19     def test (self):
20         self.build ()
21         self.breakpoint_id_tests ()
22
23     def verify_breakpoint_locations(self, target, bp_dict):
24         
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")
29         
30         bp_loc_names = list()
31         for bp_loc in bp:
32             bp_loc_names.append(bp_loc.GetAddress().GetFunction().GetName())
33             
34         for name in names:
35             found = name in bp_loc_names
36             if not found:
37                 print("Didn't find '%s' in: %s" % (name, bp_loc_names))
38             self.assertTrue (found, "Make sure we find all required locations")
39         
40     def breakpoint_id_tests (self):
41         
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)
46         bp_dicts = [
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()'] },
59         ]
60         
61         for bp_dict in bp_dicts:
62             self.verify_breakpoint_locations(target, bp_dict)