]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / lang / cpp / breakpoint-commands / TestCPPBreakpointCommands.py
1 """
2 Test lldb breakpoint command for CPP methods & functions in a namespace.
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
13 class CPPBreakpointCommandsTestCase(TestBase):
14
15     mydir = TestBase.compute_mydir(__file__)
16
17     @expectedFailureWindows
18     def test(self):
19         """Test a sequence of breakpoint command add, list, and delete."""
20         self.build()
21         exe = os.path.join(os.getcwd(), "a.out")
22
23         # Create a target from the debugger.
24
25         target = self.dbg.CreateTarget (exe)
26         self.assertTrue(target, VALID_TARGET)
27
28         a_out_module = lldb.SBFileSpecList()
29         a_out_module.Append(lldb.SBFileSpec(exe))
30
31         nested_comp_unit = lldb.SBFileSpecList()
32         nested_comp_unit.Append (lldb.SBFileSpec("nested.cpp"))
33
34         # First provide ONLY the method name.  This should get everybody...
35         auto_break = target.BreakpointCreateByName ("Function",
36                                                     lldb.eFunctionNameTypeAuto,
37                                                     a_out_module,
38                                                     nested_comp_unit)
39         self.assertTrue (auto_break.GetNumLocations() == 5)
40
41         # Now add the Baz class specifier.  This should get the version contained in Bar,
42         # AND the one contained in ::
43         auto_break = target.BreakpointCreateByName ("Baz::Function",
44                                                     lldb.eFunctionNameTypeAuto,
45                                                     a_out_module,
46                                                     nested_comp_unit)
47         self.assertTrue (auto_break.GetNumLocations() == 2)
48
49         # Then add the Bar::Baz specifier.  This should get the version contained in Bar only
50         auto_break = target.BreakpointCreateByName ("Bar::Baz::Function",
51                                                     lldb.eFunctionNameTypeAuto,
52                                                     a_out_module,
53                                                     nested_comp_unit)
54         self.assertTrue (auto_break.GetNumLocations() == 1)
55
56         plain_method_break = target.BreakpointCreateByName ("Function", 
57                                                             lldb.eFunctionNameTypeMethod,
58                                                             a_out_module,
59                                                             nested_comp_unit)
60         self.assertTrue (plain_method_break.GetNumLocations() == 3)
61
62         plain_method_break = target.BreakpointCreateByName ("Baz::Function", 
63                                                             lldb.eFunctionNameTypeMethod,
64                                                             a_out_module,
65                                                             nested_comp_unit)
66         self.assertTrue (plain_method_break.GetNumLocations() == 2)
67
68         plain_method_break = target.BreakpointCreateByName ("Bar::Baz::Function", 
69                                                             lldb.eFunctionNameTypeMethod,
70                                                             a_out_module,
71                                                             nested_comp_unit)
72         self.assertTrue (plain_method_break.GetNumLocations() == 1)
73
74         plain_method_break = target.BreakpointCreateByName ("Function", 
75                                                             lldb.eFunctionNameTypeBase,
76                                                             a_out_module,
77                                                             nested_comp_unit)
78         self.assertTrue (plain_method_break.GetNumLocations() == 2)
79
80         plain_method_break = target.BreakpointCreateByName ("Bar::Function", 
81                                                             lldb.eFunctionNameTypeBase,
82                                                             a_out_module,
83                                                             nested_comp_unit)
84         self.assertTrue (plain_method_break.GetNumLocations() == 1)