aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py3
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/Makefile3
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py9
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp61
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/Makefile3
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py6
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp24
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/ptr_refs/Makefile5
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/ptr_refs/TestPtrRefsObjC.py50
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/ptr_refs/main.m39
11 files changed, 209 insertions, 1 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py b/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
index 90562f52a4b2..e476c48d1844 100644
--- a/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
+++ b/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py
@@ -18,6 +18,10 @@ class ReturnValueTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ def affected_by_pr33042(self):
+ return ("clang" in self.getCompiler() and self.getArchitecture() ==
+ "aarch64" and self.getPlatform() == "linux")
+
@expectedFailureAll(oslist=["freebsd"], archs=["i386"])
@expectedFailureAll(oslist=["macosx"], archs=["i386"], bugnumber="<rdar://problem/28719652>")
@expectedFailureAll(
@@ -148,7 +152,8 @@ class ReturnValueTestCase(TestBase):
self.return_and_test_struct_value("return_two_int")
self.return_and_test_struct_value("return_three_int")
self.return_and_test_struct_value("return_four_int")
- self.return_and_test_struct_value("return_five_int")
+ if not self.affected_by_pr33042():
+ self.return_and_test_struct_value("return_five_int")
self.return_and_test_struct_value("return_two_double")
self.return_and_test_struct_value("return_one_double_two_float")
diff --git a/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
index d30741497635..47454498e70e 100644
--- a/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
+++ b/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
@@ -11,6 +11,7 @@ import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
class WatchedVariableHitWhenInScopeTestCase(TestBase):
@@ -33,6 +34,8 @@ class WatchedVariableHitWhenInScopeTestCase(TestBase):
self.exe_name = self.testMethodName
self.d = {'C_SOURCES': self.source, 'EXE': self.exe_name}
+ # Test hangs due to a kernel bug, see fdfeff0f in the linux kernel for details
+ @skipIfTargetAndroid(api_levels=list(range(25+1)), archs=["aarch64", "arm"])
@unittest2.expectedFailure("rdar://problem/18685649")
def test_watched_var_should_only_hit_when_in_scope(self):
"""Test that a variable watchpoint should only hit when in scope."""
diff --git a/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/Makefile b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/Makefile
new file mode 100644
index 000000000000..99bfa7e03b47
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
new file mode 100644
index 000000000000..aad2ea20c133
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
@@ -0,0 +1,9 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.expectedFailureAll(
+ oslist=["windows"], bugnumber="llvm.org/pr24764"),
+ decorators.expectedFailureAll(
+ compiler="gcc")])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
new file mode 100644
index 000000000000..90e63b40f417
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/main.cpp
@@ -0,0 +1,61 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LIDENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+template <class T, int... Args> struct C {
+ T member;
+ bool isSixteenThirtyTwo() { return false; }
+};
+
+template <> struct C<int, 16> {
+ int member;
+ bool isSixteenThirtyTwo() { return false; }
+};
+
+template <> struct C<int, 16, 32> : C<int, 16> {
+ bool isSixteenThirtyTwo() { return true; }
+};
+
+template <class T, typename... Args> struct D {
+ T member;
+ bool isIntBool() { return false; }
+};
+
+template <> struct D<int, int> {
+ int member;
+ bool isIntBool() { return false; }
+};
+
+template <> struct D<int, int, bool> : D<int, int> {
+ bool isIntBool() { return true; }
+};
+
+int main (int argc, char const *argv[])
+{
+ C<int,16,32> myC;
+ C<int,16> myLesserC;
+ myC.member = 64;
+ (void)C<int,16,32>().isSixteenThirtyTwo();
+ (void)C<int,16>().isSixteenThirtyTwo();
+ (void)(myC.member != 64); //% self.expect("expression -- myC", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"])
+ //% self.expect("expression -- C<int, 16>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
+ //% self.expect("expression -- C<int, 16, 32>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
+ //% self.expect("expression -- myLesserC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
+ //% self.expect("expression -- myC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
+
+ D<int,int,bool> myD;
+ D<int,int> myLesserD;
+ myD.member = 64;
+ (void)D<int,int,bool>().isIntBool();
+ (void)D<int,int>().isIntBool();
+ return myD.member != 64; //% self.expect("expression -- myD", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"])
+ //% self.expect("expression -- D<int, int>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
+ //% self.expect("expression -- D<int, int, bool>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
+ //% self.expect("expression -- myLesserD.isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
+ //% self.expect("expression -- myD.isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
+}
diff --git a/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/Makefile b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/Makefile
new file mode 100644
index 000000000000..99bfa7e03b47
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py
new file mode 100644
index 000000000000..810aefee0f07
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/TestFunctionTemplateParameterPack.py
@@ -0,0 +1,6 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.expectedFailureAll(bugnumber="rdar://problem/32096064")])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp
new file mode 100644
index 000000000000..e802d40e5f8b
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/cpp/function-template-parameter-pack/main.cpp
@@ -0,0 +1,24 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LIDENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+template <class T> int staticSizeof() {
+ return sizeof(T);
+}
+
+template <class T1, class T2, class... Ts> int staticSizeof() {
+ return staticSizeof<T2, Ts...>() + sizeof(T1);
+}
+
+int main (int argc, char const *argv[])
+{
+ int sz = staticSizeof<long, int, char>();
+ return staticSizeof<long, int, char>() != sz; //% self.expect("expression -- sz == staticSizeof<long, int, char>()", "staticSizeof<long, int, char> worked", substrs = ["true"])
+ //% self.expect("expression -- sz == staticSizeof<long, int>() + sizeof(char)", "staticSizeof<long, int> worked", substrs = ["true"])
+ //% self.expect("expression -- sz == staticSizeof<long>() + sizeof(int) + sizeof(char)", "staticSizeof<long> worked", substrs = ["true"])
+}
diff --git a/packages/Python/lldbsuite/test/lang/objc/ptr_refs/Makefile b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/Makefile
new file mode 100644
index 000000000000..b05ff34b739b
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+OBJC_SOURCES := main.m
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/lang/objc/ptr_refs/TestPtrRefsObjC.py b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/TestPtrRefsObjC.py
new file mode 100644
index 000000000000..e5633156cd18
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/TestPtrRefsObjC.py
@@ -0,0 +1,50 @@
+"""
+Test the ptr_refs tool on Darwin with Objective-C
+"""
+
+from __future__ import print_function
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestPtrRefsObjC(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ def test_ptr_refs(self):
+ """Test the ptr_refs tool on Darwin with Objective-C"""
+ self.build()
+ exe_name = 'a.out'
+ exe = os.path.join(os.getcwd(), exe_name)
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ main_file_spec = lldb.SBFileSpec('main.m')
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ 'break', main_file_spec)
+ self.assertTrue(breakpoint and
+ breakpoint.GetNumLocations() == 1,
+ VALID_BREAKPOINT)
+
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ # Frame #0 should be on self.line1 and the break condition should hold.
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
+
+ frame = thread.GetFrameAtIndex(0)
+
+ self.dbg.HandleCommand("script import lldb.macosx.heap")
+ self.expect("ptr_refs self", substrs=["malloc", "stack"])
+
diff --git a/packages/Python/lldbsuite/test/lang/objc/ptr_refs/main.m b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/main.m
new file mode 100644
index 000000000000..8203165e4971
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/ptr_refs/main.m
@@ -0,0 +1,39 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#import <Foundation/Foundation.h>
+
+@interface MyClass : NSObject {
+};
+-(void)test;
+@end
+
+@implementation MyClass
+-(void)test {
+ printf("%p\n", self); // break here
+}
+@end
+
+@interface MyOwner : NSObject {
+ @public id ownedThing; // should be id, to test <rdar://problem/31363513>
+};
+@end
+
+@implementation MyOwner
+@end
+
+int main (int argc, char const *argv[]) {
+ @autoreleasepool {
+ MyOwner *owner = [[MyOwner alloc] init];
+ owner->ownedThing = [[MyClass alloc] init];
+ [(MyClass*)owner->ownedThing test];
+ }
+ return 0;
+}
+