mirror of
https://github.com/intel/llvm.git
synced 2026-02-01 17:07:36 +08:00
Recommit [lldb] Test 'v' support for direct ivar access (NFC)
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
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
CXX_SOURCES := main.cpp
|
||||
include Makefile.rules
|
||||
@@ -0,0 +1,11 @@
|
||||
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")
|
||||
12
lldb/test/API/commands/frame/var/direct-ivar/cpp/main.cpp
Normal file
12
lldb/test/API/commands/frame/var/direct-ivar/cpp/main.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
struct Structure {
|
||||
int m_field;
|
||||
void fun() {
|
||||
// check this
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
Structure s;
|
||||
s.m_field = 30;
|
||||
s.fun();
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
OBJC_SOURCES := main.m
|
||||
include Makefile.rules
|
||||
@@ -0,0 +1,12 @@
|
||||
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")
|
||||
19
lldb/test/API/commands/frame/var/direct-ivar/objc/main.m
Normal file
19
lldb/test/API/commands/frame/var/direct-ivar/objc/main.m
Normal file
@@ -0,0 +1,19 @@
|
||||
#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];
|
||||
}
|
||||
Reference in New Issue
Block a user