aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/lang/cpp/namespace
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/lang/cpp/namespace')
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py74
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py17
2 files changed, 80 insertions, 11 deletions
diff --git a/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py b/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py
index a60d8252e9f0..93d53c7de712 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py
@@ -8,8 +8,78 @@ from __future__ import print_function
import os, time
import lldb
+from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
-import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test import lldbutil
+
+class NamespaceBreakpointTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @expectedFailureAll(bugnumber="llvm.org/pr28548", compiler="gcc")
+ 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")
+
+ @expectedFailureAll(bugnumber="llvm.org/pr28548", compiler="gcc")
+ 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):
@@ -38,7 +108,7 @@ class NamespaceTestCase(TestBase):
'stop reason = breakpoint'])
# rdar://problem/8668674
- @expectedFailureWindows("llvm.org/pr24764")
+ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
def test_with_run_command(self):
"""Test that anonymous and named namespace variables display correctly."""
self.build()
diff --git a/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py b/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
index 4cad45564c87..12e8eef40cf3 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
@@ -7,8 +7,9 @@ from __future__ import print_function
import os, time
import lldb
+from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
-import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test import lldbutil
class NamespaceLookupTestCase(TestBase):
@@ -33,8 +34,7 @@ class NamespaceLookupTestCase(TestBase):
substrs = ['stopped',
'stop reason = breakpoint'])
- @expectedFailureFreeBSD("llvm.org/pr25819")
- @expectedFailureLinux("llvm.org/pr25819")
+ @expectedFailureAll(oslist=["windows", "linux", "freebsd"], bugnumber="llvm.org/pr25819")
def test_scope_lookup_with_run_command(self):
"""Test scope lookup of functions in lldb."""
self.build()
@@ -144,7 +144,7 @@ class NamespaceLookupTestCase(TestBase):
# finds the global ::func().
self.expect("expr -- func()", startstr = "(int) $0 = 2")
- @expectedFailureLinux("llvm.org/pr25819")
+ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr25819")
def test_scope_lookup_before_using_with_run_command(self):
"""Test scope lookup before using in lldb."""
self.build()
@@ -158,9 +158,9 @@ class NamespaceLookupTestCase(TestBase):
self.expect("expr -- func()", startstr = "(int) $0 = 1")
# NOTE: this test may fail on older systems that don't emit import
- # emtries in DWARF - may need to add checks for compiler versions here.
- @expectedFailureFreeBSD("llvm.org/pr25819")
- @expectedFailureLinux("llvm.org/pr25819")
+ # entries in DWARF - may need to add checks for compiler versions here.
+ @skipIf(compiler="gcc", oslist=["linux"], debug_info=["dwo"]) # Skip to avoid crash
+ @expectedFailureAll(oslist=["windows", "linux", "freebsd"], bugnumber="llvm.org/pr25819")
def test_scope_after_using_directive_lookup_with_run_command(self):
"""Test scope lookup after using directive in lldb."""
self.build()
@@ -203,8 +203,7 @@ class NamespaceLookupTestCase(TestBase):
# the same type.
self.expect("expr -- func()", startstr = "error")
- @expectedFailureFreeBSD("llvm.org/pr25819")
- @expectedFailureLinux("llvm.org/pr25819")
+ @expectedFailureAll(oslist=["windows", "linux", "freebsd"], bugnumber="llvm.org/pr25819")
def test_scope_lookup_shadowed_by_using_with_run_command(self):
"""Test scope lookup shadowed by using in lldb."""
self.build()