diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
6 files changed, 69 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/Makefile new file mode 100644 index 00000000000..afecbf96948 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/Makefile @@ -0,0 +1,4 @@ +OBJC_SOURCES := main.m +LD_EXTRAS := -lobjc -framework Foundation + +include Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/TestBasicObjcModernTypeLookup.py b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/TestBasicObjcModernTypeLookup.py new file mode 100644 index 00000000000..700b3ecbe6b --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/TestBasicObjcModernTypeLookup.py @@ -0,0 +1,18 @@ +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class TestBasicObjcModernTypeLookup(TestBase): + mydir = TestBase.compute_mydir(__file__) + + @skipUnlessDarwin + def test(self): + self.build() + # Activate modern-type-lookup. + # FIXME: This has to happen before we create any target otherwise we crash... + self.runCmd("settings set target.experimental.use-modern-type-lookup true") + (target, process, thread, main_breakpoint) = lldbutil.run_to_source_breakpoint(self, + "break here", lldb.SBFileSpec("main.m")) + self.expect("expr 1", substrs=["(int) ", " = 1"]) + self.expect("expr (int)[Foo bar:22]", substrs=["(int) ", " = 44"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/main.m b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/main.m new file mode 100644 index 00000000000..b427971e7be --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic-objc/main.m @@ -0,0 +1,17 @@ +#import <Foundation/Foundation.h> + +@interface Foo : NSObject ++(int) bar: (int) string; +@end + +@implementation Foo ++(int) bar: (int) x +{ + return x + x; +} +@end + +int main() { + NSLog(@"Hello World"); + return 0; // break here +} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/Makefile new file mode 100644 index 00000000000..3d0b98f13f3 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/Makefile @@ -0,0 +1,2 @@ +CXX_SOURCES := main.cpp +include Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/TestBasicModernTypeLookup.py b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/TestBasicModernTypeLookup.py new file mode 100644 index 00000000000..613fb95658b --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/TestBasicModernTypeLookup.py @@ -0,0 +1,21 @@ +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class BasicModernTypeLookup(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def test(self): + self.build() + + # Activate modern-type-lookup. + self.runCmd("settings set target.experimental.use-modern-type-lookup true") + + lldbutil.run_to_source_breakpoint(self, + "// Set break point at this line.", lldb.SBFileSpec("main.cpp")) + + # Test a few simple expressions that should still work with modern-type-lookup. + self.expect("expr 1", substrs=["(int) ", " = 1\n"]) + self.expect("expr f.x", substrs=["(int) ", " = 44\n"]) + self.expect("expr f", substrs=["(Foo) ", "x = 44"]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/main.cpp new file mode 100644 index 00000000000..e0c3ead7f75 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/modern-type-lookup/basic/main.cpp @@ -0,0 +1,7 @@ +struct Foo { int x; }; + +int main(int argc, char **argv) { + Foo f; + f.x = 44; + return f.x; // Set break point at this line. +} |