aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-03 20:26:55 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-03 20:26:55 +0000
commit52fd8de56a8a12201c1e6188e1f34d28c3d3398d (patch)
tree69810dbf8f7743a20c29413ac665494c713276b3 /packages/Python/lldbsuite/test
parent773dd0e6e632d48d7123a321ba86f50847b9afc0 (diff)
downloadsrc-52fd8de56a8a12201c1e6188e1f34d28c3d3398d.tar.gz
src-52fd8de56a8a12201c1e6188e1f34d28c3d3398d.zip
Vendor import of lldb trunk r302069:vendor/lldb/lldb-trunk-r302069
Notes
Notes: svn path=/vendor/lldb/dist/; revision=317769 svn path=/vendor/lldb/lldb-trunk-r302069/; revision=317770; tag=vendor/lldb/lldb-trunk-r302069
Diffstat (limited to 'packages/Python/lldbsuite/test')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp5
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile24
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Foo.h9
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.h10
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.m8
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py49
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/Foo.h9
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.h7
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.m8
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/conflicting-definition/main.m10
11 files changed, 144 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp
index d9adb550023c..3e528d281eee 100644
--- a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/main.cpp
@@ -14,6 +14,11 @@
int
main(int argc, char const *argv[])
{
+// PR_MPX_ENABLE_MANAGEMENT won't be defined on linux kernel versions below 3.19
+#ifndef PR_MPX_ENABLE_MANAGEMENT
+ return -1;
+#endif
+
// This call returns 0 only if the CPU and the kernel support Intel(R) MPX.
if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0)
return -1;
diff --git a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp
index 9c445aa8a275..b78eb9e5a2a2 100644
--- a/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp
+++ b/packages/Python/lldbsuite/test/functionalities/register/intel_xtended_registers/mpx_bound_violation/main.cpp
@@ -29,6 +29,11 @@ main(int argc, char const *argv[])
unsigned int rax, rbx, rcx, rdx;
int array[5];
+// PR_MPX_ENABLE_MANAGEMENT won't be defined on linux kernel versions below 3.19
+#ifndef PR_MPX_ENABLE_MANAGEMENT
+ return -1;
+#endif
+
// This call returns 0 only if the CPU and the kernel support Intel(R) MPX.
if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0) != 0)
return -1;
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile
new file mode 100644
index 000000000000..3d24348618da
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile
@@ -0,0 +1,24 @@
+LEVEL = ../../../make
+
+CFLAGS = -g -O0
+LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
+
+all: a.out libTest.dylib libTestExt.dylib
+
+libTest.dylib: Test/Test.m
+ $(CC) $(CFLAGS) -I. -c -o Test.o Test/Test.m
+ $(CC) $(LDFLAGS) -shared -o libTest.dylib Test.o
+ dsymutil libTest.dylib
+
+libTestExt.dylib: TestExt/TestExt.m
+ $(CC) $(CFLAGS) -I. -c -o TestExt.o TestExt/TestExt.m
+ $(CC) $(LDFLAGS) -L. -lTest -shared -o libTestExt.dylib TestExt.o
+ dsymutil libTestExt.dylib
+
+a.out: main.m libTest.dylib libTestExt.dylib
+ $(CC) $(LDFLAGS) -I. -L. -lTest -lTestExt -o a.out main.m
+
+.PHONY: clean
+
+clean:
+ rm -rf libTest.dylib libTestExt.dylib a.out Test.o TestExt.o libTest.dylib.dSYM libTest.dylib.dSYM
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Foo.h b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Foo.h
new file mode 100644
index 000000000000..db07f50d5d60
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Foo.h
@@ -0,0 +1,9 @@
+#ifndef __Foo_h__
+#define __Foo_h__
+
+typedef struct {
+ float start;
+ float duration;
+} CMTimeRange;
+
+#endif
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.h b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.h
new file mode 100644
index 000000000000..73928c5fb0da
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.h
@@ -0,0 +1,10 @@
+#import <Foundation/Foundation.h>
+#import <Test/Foo.h>
+
+@interface Test : NSObject {
+@public
+ CMTimeRange _range;
+}
+- (void) doTest;
+@end
+
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.m b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.m
new file mode 100644
index 000000000000..6b2cb3af8086
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.m
@@ -0,0 +1,8 @@
+#import "Test.h"
+
+@implementation Test
+- (void) doTest {
+ NSLog(@"-[Test doTest]");
+}
+@end
+
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py
new file mode 100644
index 000000000000..564a1e15c06c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestConflictingDefinition.py
@@ -0,0 +1,49 @@
+"""Test that types defined in shared libraries work correctly."""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestRealDefinition(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @skipUnlessDarwin
+ def test_frame_var_after_stop_at_implementation(self):
+ """Test that we can find the implementation for an objective C type"""
+ if self.getArchitecture() == 'i386':
+ self.skipTest("requires modern objc runtime")
+ self.build()
+ self.common_setup()
+
+ line = line_number('TestExt/TestExt.m', '// break here')
+ lldbutil.run_break_set_by_file_and_line(
+ self, 'TestExt.m', line, num_expected_locations=1, loc_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+ self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+ substrs=[' resolved, hit count = 1'])
+
+ # This should display correctly.
+ self.expect(
+ "expr 42",
+ "A simple expression should execute correctly",
+ substrs=[
+ "42"])
+
+ def common_setup(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/Foo.h b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/Foo.h
new file mode 100644
index 000000000000..7c90e6ca8e3e
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/Foo.h
@@ -0,0 +1,9 @@
+#ifndef __Foo_h__
+#define __Foo_h__
+
+typedef struct {
+ float s;
+ float d;
+} CMTimeRange;
+
+#endif
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.h b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.h
new file mode 100644
index 000000000000..243443c647b4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.h
@@ -0,0 +1,7 @@
+#import <TestExt/Foo.h>
+#import <Test/Test.h>
+struct CMTimeRange;
+
+@interface Test (Stuff)
+- (void)doSomethingElse: (CMTimeRange *)range_ptr;
+@end
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.m b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.m
new file mode 100644
index 000000000000..a14c702787db
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.m
@@ -0,0 +1,8 @@
+#import "TestExt.h"
+#import "Foo.h"
+
+@implementation Test (Stuff)
+- (void)doSomethingElse: (CMTimeRange *)range_ptr {
+ NSLog(@"doSomethingElse: %p", range_ptr); // break here
+}
+@end
diff --git a/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/main.m b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/main.m
new file mode 100644
index 000000000000..6a714577a353
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/main.m
@@ -0,0 +1,10 @@
+#import <Test/Test.h>
+#import <TestExt/TestExt.h>
+
+int main() {
+ @autoreleasepool {
+ Test *test = [[Test alloc] init];
+ [test doSomethingElse:&test->_range];
+ }
+}
+