Add basic tests for `frame variable`'s ability to direct access fields of `this` and
ivars of `self`.
This splits the tests, preventing ObjC tests from running on Linux.
Differential Revision: https://reviews.llvm.org/D145348
--- /dev/null
+CXX_SOURCES := main.cpp
+include Makefile.rules
--- /dev/null
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+ def test_cpp_this(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, "// check this", lldb.SBFileSpec("main.cpp"))
+ self.expect("frame variable m_field", startstr="(int) m_field = 30")
--- /dev/null
+struct Structure {
+ int m_field;
+ void fun() {
+ // check this
+ }
+};
+
+int main() {
+ Structure s;
+ s.m_field = 30;
+ s.fun();
+}
--- /dev/null
+OBJC_SOURCES := main.m
+include Makefile.rules
--- /dev/null
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+ @skipUnlessDarwin
+ def test_objc_self(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(self, "// check self", lldb.SBFileSpec("main.m"))
+ self.expect("frame variable _ivar", startstr="(int) _ivar = 30")
--- /dev/null
+#include <objc/NSObject.h>
+
+@interface Classic : NSObject {
+@public
+ int _ivar;
+}
+@end
+
+@implementation Classic
+- (int)fun {
+ // check self
+}
+@end
+
+int main() {
+ Classic *c = [Classic new];
+ c->_ivar = 30;
+ [c fun];
+}