summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2016-07-13 22:38:54 +0000
committerGreg Clayton <gclayton@apple.com>2016-07-13 22:38:54 +0000
commitae26b488df36611bbbc9f0ff46f13bbd2eb28378 (patch)
tree3a16e1f681ae49974843b389210247491a5acc7f /lldb/packages/Python/lldbsuite/test
parent7da74abf3d48e1989cf39a9a004a54b6efa0adaa (diff)
downloadbcm5719-llvm-ae26b488df36611bbbc9f0ff46f13bbd2eb28378.tar.gz
bcm5719-llvm-ae26b488df36611bbbc9f0ff46f13bbd2eb28378.zip
Added test for setting breakpoints by basename and fullname.
<rdar://problem/24599697> llvm-svn: 275336
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py67
1 files changed, 67 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py
index c58c7ab9756..08ef94d53bb 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py
@@ -12,6 +12,73 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+class NamespaceBreakpointTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def test_breakpoints_func_auto(self):
+ """Test that we can set breakpoints correctly by basename to find all functions whose basename is "func"."""
+ self.build()
+
+ names = [ "func()", "func(int)", "A::B::func()", "A::func()", "A::func(int)"]
+
+ # Create a target by the debugger.
+ exe = os.path.join(os.getcwd(), "a.out")
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+ module_list = lldb.SBFileSpecList()
+ module_list.Append(lldb.SBFileSpec(exe, False))
+ cu_list = lldb.SBFileSpecList()
+ # Set a breakpoint by name "func" which should pick up all functions whose basename is "func"
+ bp = target.BreakpointCreateByName ("func", lldb.eFunctionNameTypeAuto, module_list, cu_list);
+ for bp_loc in bp:
+ name = bp_loc.GetAddress().GetFunction().GetName()
+ self.assertTrue(name in names, "make sure breakpoint locations are correct for 'func' with eFunctionNameTypeAuto")
+
+ def test_breakpoints_func_full(self):
+ """Test that we can set breakpoints correctly by fullname to find all functions whose fully qualified name is "func"
+ (no namespaces)."""
+ self.build()
+
+ names = [ "func()", "func(int)"]
+
+ # Create a target by the debugger.
+ exe = os.path.join(os.getcwd(), "a.out")
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+ module_list = lldb.SBFileSpecList()
+ module_list.Append(lldb.SBFileSpec(exe, False))
+ cu_list = lldb.SBFileSpecList()
+
+ # Set a breakpoint by name "func" whose fullly qualified named matches "func" which
+ # should pick up only functions whose basename is "func" and has no containing context
+ bp = target.BreakpointCreateByName ("func", lldb.eFunctionNameTypeFull, module_list, cu_list);
+ for bp_loc in bp:
+ name = bp_loc.GetAddress().GetFunction().GetName()
+ self.assertTrue(name in names, "make sure breakpoint locations are correct for 'func' with eFunctionNameTypeFull")
+
+ def test_breakpoints_a_func_full(self):
+ """Test that we can set breakpoints correctly by fullname to find all functions whose fully qualified name is "A::func"."""
+ self.build()
+
+ names = [ "A::func()", "A::func(int)"]
+
+ # Create a target by the debugger.
+ exe = os.path.join(os.getcwd(), "a.out")
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+ module_list = lldb.SBFileSpecList()
+ module_list.Append(lldb.SBFileSpec(exe, False))
+ cu_list = lldb.SBFileSpecList()
+
+ # Set a breakpoint by name "A::func" whose fullly qualified named matches "A::func" which
+ # should pick up only functions whose basename is "func" and is contained in the "A" namespace
+ bp = target.BreakpointCreateByName ("A::func", lldb.eFunctionNameTypeFull, module_list, cu_list);
+ for bp_loc in bp:
+ name = bp_loc.GetAddress().GetFunction().GetName()
+ self.assertTrue(name in names, "make sure breakpoint locations are correct for 'A::func' with eFunctionNameTypeFull")
+
+
class NamespaceTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
OpenPOWER on IntegriCloud