2 Test lldb breakpoint command for CPP methods & functions in a namespace.
5 from __future__ import print_function
11 from lldbsuite.test.lldbtest import *
13 class CPPBreakpointCommandsTestCase(TestBase):
15 mydir = TestBase.compute_mydir(__file__)
17 @expectedFailureWindows
19 """Test a sequence of breakpoint command add, list, and delete."""
21 exe = os.path.join(os.getcwd(), "a.out")
23 # Create a target from the debugger.
25 target = self.dbg.CreateTarget (exe)
26 self.assertTrue(target, VALID_TARGET)
28 a_out_module = lldb.SBFileSpecList()
29 a_out_module.Append(lldb.SBFileSpec(exe))
31 nested_comp_unit = lldb.SBFileSpecList()
32 nested_comp_unit.Append (lldb.SBFileSpec("nested.cpp"))
34 # First provide ONLY the method name. This should get everybody...
35 auto_break = target.BreakpointCreateByName ("Function",
36 lldb.eFunctionNameTypeAuto,
39 self.assertTrue (auto_break.GetNumLocations() == 5)
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,
47 self.assertTrue (auto_break.GetNumLocations() == 2)
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,
54 self.assertTrue (auto_break.GetNumLocations() == 1)
56 plain_method_break = target.BreakpointCreateByName ("Function",
57 lldb.eFunctionNameTypeMethod,
60 self.assertTrue (plain_method_break.GetNumLocations() == 3)
62 plain_method_break = target.BreakpointCreateByName ("Baz::Function",
63 lldb.eFunctionNameTypeMethod,
66 self.assertTrue (plain_method_break.GetNumLocations() == 2)
68 plain_method_break = target.BreakpointCreateByName ("Bar::Baz::Function",
69 lldb.eFunctionNameTypeMethod,
72 self.assertTrue (plain_method_break.GetNumLocations() == 1)
74 plain_method_break = target.BreakpointCreateByName ("Function",
75 lldb.eFunctionNameTypeBase,
78 self.assertTrue (plain_method_break.GetNumLocations() == 2)
80 plain_method_break = target.BreakpointCreateByName ("Bar::Function",
81 lldb.eFunctionNameTypeBase,
84 self.assertTrue (plain_method_break.GetNumLocations() == 1)