[Lldb-commits] [lldb] r133831 - in /lldb/trunk: include/lldb/ include/lldb/Symbol/ include/lldb/Target/ lldb.xcodeproj/ source/API/ source/Core/ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ source/Symbol/ source/Target/ test/objc-ivar-offsets/
Jim Ingham
jingham at apple.com
Fri Jun 24 15:03:24 PDT 2011
Author: jingham
Date: Fri Jun 24 17:03:24 2011
New Revision: 133831
URL: http://llvm.org/viewvc/llvm-project?rev=133831&view=rev
Log:
Add support for looking up ivar offset from the ObjC runtime.
Added:
lldb/trunk/test/objc-ivar-offsets/
lldb/trunk/test/objc-ivar-offsets/Makefile
lldb/trunk/test/objc-ivar-offsets/TestObjCIvarOffsets.py
lldb/trunk/test/objc-ivar-offsets/main.m
lldb/trunk/test/objc-ivar-offsets/objc-ivar-offsets.h
lldb/trunk/test/objc-ivar-offsets/objc-ivar-offsets.m
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
lldb/trunk/include/lldb/lldb-defines.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/API/SBType.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Jun 24 17:03:24 2011
@@ -399,7 +399,8 @@
GetNumPointeeChildren (lldb::clang_type_t clang_type);
lldb::clang_type_t
- GetChildClangTypeAtIndex (const char *parent_name,
+ GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
+ const char *parent_name,
lldb::clang_type_t parent_clang_type,
uint32_t idx,
bool transparent_pointers,
@@ -413,7 +414,8 @@
bool &child_is_deref_of_parent);
static lldb::clang_type_t
- GetChildClangTypeAtIndex (clang::ASTContext *ast,
+ GetChildClangTypeAtIndex (ExecutionContext *exe_ctx,
+ clang::ASTContext *ast,
const char *parent_name,
lldb::clang_type_t parent_clang_type,
uint32_t idx,
Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Fri Jun 24 17:03:24 2011
@@ -73,6 +73,12 @@
return eObjC_VersionUnknown;
}
+ // Finds the byte offset of the child_type ivar in parent_type. If it can't find the
+ // offset, returns LLDB_INVALID_IVAR_OFFSET.
+
+ virtual size_t
+ GetByteOffsetForIvar (ClangASTType &parent_qual_type, const char *ivar_name);
+
protected:
//------------------------------------------------------------------
// Classes that inherit from ObjCLanguageRuntime can see and modify these
Modified: lldb/trunk/include/lldb/lldb-defines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-defines.h?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-defines.h (original)
+++ lldb/trunk/include/lldb/lldb-defines.h Fri Jun 24 17:03:24 2011
@@ -69,6 +69,7 @@
//----------------------------------------------------------------------
#define LLDB_INVALID_ADDRESS UINT64_MAX
#define LLDB_INVALID_INDEX32 UINT32_MAX
+#define LLDB_INVALID_IVAR_OFFSET UINT32_MAX
#define LLDB_INVALID_IMAGE_TOKEN UINT32_MAX
#define LLDB_INVALID_REGNUM UINT32_MAX
#define LLDB_INVALID_UID UINT32_MAX
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jun 24 17:03:24 2011
@@ -200,12 +200,6 @@
2689008C13353E4200698AC0 /* DisassemblerLLVM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C897410F57C5600BB2B04 /* DisassemblerLLVM.cpp */; };
2689008D13353E4200698AC0 /* DynamicLoaderMacOSXDYLD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C897A10F57C5600BB2B04 /* DynamicLoaderMacOSXDYLD.cpp */; };
2689008E13353E4200698AC0 /* DynamicLoaderStatic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 268A683D1321B53B000E3FB8 /* DynamicLoaderStatic.cpp */; };
- 2689009013353E4200698AC0 /* ItaniumABILanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CB4436A124944B000C13DC2 /* ItaniumABILanguageRuntime.cpp */; };
- 2689009113353E4200698AC0 /* AppleObjCRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C61978812823D4300FAFFCC /* AppleObjCRuntime.cpp */; };
- 2689009213353E4200698AC0 /* AppleObjCRuntimeV1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C61978A12823D4300FAFFCC /* AppleObjCRuntimeV1.cpp */; };
- 2689009313353E4200698AC0 /* AppleObjCTrampolineHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0A91D412511CB900CA6636 /* AppleObjCTrampolineHandler.cpp */; };
- 2689009413353E4200698AC0 /* AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C0A91D612511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */; };
- 2689009513353E4200698AC0 /* AppleObjCRuntimeV2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */; };
2689009613353E4200698AC0 /* ObjectContainerBSDArchive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A3B4AC1181454800381BC2 /* ObjectContainerBSDArchive.cpp */; };
2689009713353E4200698AC0 /* ObjectContainerUniversalMachO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C898010F57C5600BB2B04 /* ObjectContainerUniversalMachO.cpp */; };
2689009813353E4200698AC0 /* ELFHeader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D27C9D11ED3A4E0024D721 /* ELFHeader.cpp */; };
@@ -398,6 +392,12 @@
49C8507C1384A786007DB519 /* ProcessDataAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49C850781384A0CA007DB519 /* ProcessDataAllocator.cpp */; };
4C74CB6312288704006A8171 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C74CB6212288704006A8171 /* Carbon.framework */; };
4CABA9E0134A8BCD00539BDD /* ValueObjectMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CABA9DF134A8BCD00539BDD /* ValueObjectMemory.cpp */; };
+ 4CCA644D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA643D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp */; };
+ 4CCA645013B40B82003BDF98 /* AppleObjCRuntime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644213B40B82003BDF98 /* AppleObjCRuntime.cpp */; };
+ 4CCA645213B40B82003BDF98 /* AppleObjCRuntimeV1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644413B40B82003BDF98 /* AppleObjCRuntimeV1.cpp */; };
+ 4CCA645413B40B82003BDF98 /* AppleObjCRuntimeV2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644613B40B82003BDF98 /* AppleObjCRuntimeV2.cpp */; };
+ 4CCA645613B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644813B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp */; };
+ 4CCA645813B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644A13B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */; };
4CD0BD0F134BFADF00CB44D4 /* ValueObjectDynamicValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CD0BD0E134BFADF00CB44D4 /* ValueObjectDynamicValue.cpp */; };
9415F61813B2C0EF00A52B36 /* FormatManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9415F61713B2C0EF00A52B36 /* FormatManager.cpp */; };
9463D4CD13B1798800C230D4 /* CommandObjectType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9463D4CC13B1798800C230D4 /* CommandObjectType.cpp */; };
@@ -1105,12 +1105,6 @@
4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSpec.h; path = include/lldb/Target/ThreadSpec.h; sourceTree = "<group>"; };
4C09CB73116BD98B00C7A725 /* CommandCompletions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandCompletions.h; path = include/lldb/Interpreter/CommandCompletions.h; sourceTree = "<group>"; };
4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandCompletions.cpp; path = source/Commands/CommandCompletions.cpp; sourceTree = "<group>"; };
- 4C0A91D412511CB900CA6636 /* AppleObjCTrampolineHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCTrampolineHandler.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp; sourceTree = "<group>"; };
- 4C0A91D512511CB900CA6636 /* AppleObjCTrampolineHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCTrampolineHandler.h; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h; sourceTree = "<group>"; };
- 4C0A91D612511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleThreadPlanStepThroughObjCTrampoline.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp; sourceTree = "<group>"; };
- 4C0A91D712511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleThreadPlanStepThroughObjCTrampoline.h; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h; sourceTree = "<group>"; };
- 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCRuntimeV2.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp; sourceTree = "<group>"; };
- 4C139EA4124A8B03000BFF8D /* AppleObjCRuntimeV2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCRuntimeV2.h; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h; sourceTree = "<group>"; };
4C1AB23A1263E5F400D0F04A /* ThreadPlanTestCondition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanTestCondition.cpp; path = source/Target/ThreadPlanTestCondition.cpp; sourceTree = "<group>"; };
4C1AB23E1263E61100D0F04A /* ThreadPlanTestCondition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanTestCondition.h; path = include/lldb/Target/ThreadPlanTestCondition.h; sourceTree = "<group>"; };
4C2FAE2E135E3A70001EDE44 /* SharedCluster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharedCluster.h; path = include/lldb/Utility/SharedCluster.h; sourceTree = "<group>"; };
@@ -1122,10 +1116,6 @@
4C43DF8A11069C3200E55CBF /* ThreadPlanStepOverRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepOverRange.cpp; path = source/Target/ThreadPlanStepOverRange.cpp; sourceTree = "<group>"; };
4C5DBBC611E3FEC60035160F /* CommandObjectCommands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectCommands.cpp; path = source/Commands/CommandObjectCommands.cpp; sourceTree = "<group>"; };
4C5DBBC711E3FEC60035160F /* CommandObjectCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectCommands.h; path = source/Commands/CommandObjectCommands.h; sourceTree = "<group>"; };
- 4C61978812823D4300FAFFCC /* AppleObjCRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCRuntime.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp; sourceTree = "<group>"; };
- 4C61978912823D4300FAFFCC /* AppleObjCRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCRuntime.h; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h; sourceTree = "<group>"; };
- 4C61978A12823D4300FAFFCC /* AppleObjCRuntimeV1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppleObjCRuntimeV1.cpp; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp; sourceTree = "<group>"; };
- 4C61978B12823D4300FAFFCC /* AppleObjCRuntimeV1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleObjCRuntimeV1.h; path = LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h; sourceTree = "<group>"; };
4C626533130F1B0A00C889F6 /* StreamTee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StreamTee.h; path = include/lldb/Core/StreamTee.h; sourceTree = "<group>"; };
4C74CB6212288704006A8171 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
4C7CF7E31295E10E00B4FBB5 /* ThreadPlanCallUserExpression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanCallUserExpression.h; path = include/lldb/Target/ThreadPlanCallUserExpression.h; sourceTree = "<group>"; };
@@ -1142,14 +1132,24 @@
4CAFCE031101218900CA63DB /* ThreadPlanRunToAddress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanRunToAddress.cpp; path = source/Target/ThreadPlanRunToAddress.cpp; sourceTree = "<group>"; };
4CB4430912491DDA00C13DC2 /* LanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LanguageRuntime.h; path = include/lldb/Target/LanguageRuntime.h; sourceTree = "<group>"; };
4CB4430A12491DDA00C13DC2 /* LanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LanguageRuntime.cpp; path = source/Target/LanguageRuntime.cpp; sourceTree = "<group>"; };
- 4CB44369124944B000C13DC2 /* ItaniumABILanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ItaniumABILanguageRuntime.h; path = LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h; sourceTree = "<group>"; };
- 4CB4436A124944B000C13DC2 /* ItaniumABILanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ItaniumABILanguageRuntime.cpp; path = LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp; sourceTree = "<group>"; };
4CB443BB1249920C00C13DC2 /* CPPLanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPPLanguageRuntime.h; path = include/lldb/Target/CPPLanguageRuntime.h; sourceTree = "<group>"; };
4CB443BC1249920C00C13DC2 /* CPPLanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CPPLanguageRuntime.cpp; path = source/Target/CPPLanguageRuntime.cpp; sourceTree = "<group>"; };
4CB443F212499B5000C13DC2 /* ObjCLanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ObjCLanguageRuntime.cpp; path = source/Target/ObjCLanguageRuntime.cpp; sourceTree = "<group>"; };
4CB443F612499B6E00C13DC2 /* ObjCLanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjCLanguageRuntime.h; path = include/lldb/Target/ObjCLanguageRuntime.h; sourceTree = "<group>"; };
4CC2A148128C73ED001531C4 /* ThreadPlanTracer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanTracer.cpp; path = source/Target/ThreadPlanTracer.cpp; sourceTree = "<group>"; };
4CC2A14C128C7409001531C4 /* ThreadPlanTracer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanTracer.h; path = include/lldb/Target/ThreadPlanTracer.h; sourceTree = "<group>"; };
+ 4CCA643D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ItaniumABILanguageRuntime.cpp; sourceTree = "<group>"; };
+ 4CCA643E13B40B82003BDF98 /* ItaniumABILanguageRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ItaniumABILanguageRuntime.h; sourceTree = "<group>"; };
+ 4CCA644213B40B82003BDF98 /* AppleObjCRuntime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppleObjCRuntime.cpp; sourceTree = "<group>"; };
+ 4CCA644313B40B82003BDF98 /* AppleObjCRuntime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleObjCRuntime.h; sourceTree = "<group>"; };
+ 4CCA644413B40B82003BDF98 /* AppleObjCRuntimeV1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppleObjCRuntimeV1.cpp; sourceTree = "<group>"; };
+ 4CCA644513B40B82003BDF98 /* AppleObjCRuntimeV1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleObjCRuntimeV1.h; sourceTree = "<group>"; };
+ 4CCA644613B40B82003BDF98 /* AppleObjCRuntimeV2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppleObjCRuntimeV2.cpp; sourceTree = "<group>"; };
+ 4CCA644713B40B82003BDF98 /* AppleObjCRuntimeV2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleObjCRuntimeV2.h; sourceTree = "<group>"; };
+ 4CCA644813B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppleObjCTrampolineHandler.cpp; sourceTree = "<group>"; };
+ 4CCA644913B40B82003BDF98 /* AppleObjCTrampolineHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleObjCTrampolineHandler.h; sourceTree = "<group>"; };
+ 4CCA644A13B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppleThreadPlanStepThroughObjCTrampoline.cpp; sourceTree = "<group>"; };
+ 4CCA644B13B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleThreadPlanStepThroughObjCTrampoline.h; sourceTree = "<group>"; };
4CD0BD0C134BFAB600CB44D4 /* ValueObjectDynamicValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ValueObjectDynamicValue.h; path = include/lldb/Core/ValueObjectDynamicValue.h; sourceTree = "<group>"; };
4CD0BD0E134BFADF00CB44D4 /* ValueObjectDynamicValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectDynamicValue.cpp; path = source/Core/ValueObjectDynamicValue.cpp; sourceTree = "<group>"; };
4CEDAED311754F5E00E875A6 /* ThreadPlanStepUntil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanStepUntil.h; path = include/lldb/Target/ThreadPlanStepUntil.h; sourceTree = "<group>"; };
@@ -1364,7 +1364,7 @@
260C897210F57C5600BB2B04 /* Disassembler */,
260C897810F57C5600BB2B04 /* DynamicLoader */,
26D9FDCA12F785120003F2EE /* Instruction */,
- 4CB443651249446F00C13DC2 /* LanguageRuntime */,
+ 4CCA643A13B40B82003BDF98 /* LanguageRuntime */,
260C897E10F57C5600BB2B04 /* ObjectContainer */,
260C898210F57C5600BB2B04 /* ObjectFile */,
26C5577E132575B6008FD8FE /* Platform */,
@@ -2498,55 +2498,55 @@
sourceTree = "<group>";
usesTabs = 0;
};
- 4C139EA0124A8AC7000BFF8D /* CPlusPlus */ = {
+ 4CCA643A13B40B82003BDF98 /* LanguageRuntime */ = {
isa = PBXGroup;
children = (
- 4CB443661249448300C13DC2 /* ItaniumABI */,
+ 4CCA643B13B40B82003BDF98 /* CPlusPlus */,
+ 4CCA644013B40B82003BDF98 /* ObjC */,
);
- name = CPlusPlus;
+ path = LanguageRuntime;
sourceTree = "<group>";
};
- 4C139EA1124A8AD5000BFF8D /* ObjC */ = {
+ 4CCA643B13B40B82003BDF98 /* CPlusPlus */ = {
isa = PBXGroup;
children = (
- 4C139EA2124A8AE5000BFF8D /* AppleRuntime */,
+ 4CCA643C13B40B82003BDF98 /* ItaniumABI */,
);
- name = ObjC;
+ path = CPlusPlus;
sourceTree = "<group>";
};
- 4C139EA2124A8AE5000BFF8D /* AppleRuntime */ = {
+ 4CCA643C13B40B82003BDF98 /* ItaniumABI */ = {
isa = PBXGroup;
children = (
- 4C61978812823D4300FAFFCC /* AppleObjCRuntime.cpp */,
- 4C61978912823D4300FAFFCC /* AppleObjCRuntime.h */,
- 4C61978A12823D4300FAFFCC /* AppleObjCRuntimeV1.cpp */,
- 4C61978B12823D4300FAFFCC /* AppleObjCRuntimeV1.h */,
- 4C0A91D512511CB900CA6636 /* AppleObjCTrampolineHandler.h */,
- 4C0A91D412511CB900CA6636 /* AppleObjCTrampolineHandler.cpp */,
- 4C0A91D712511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.h */,
- 4C0A91D612511CB900CA6636 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */,
- 4C139EA4124A8B03000BFF8D /* AppleObjCRuntimeV2.h */,
- 4C139EA3124A8B03000BFF8D /* AppleObjCRuntimeV2.cpp */,
+ 4CCA643D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp */,
+ 4CCA643E13B40B82003BDF98 /* ItaniumABILanguageRuntime.h */,
);
- name = AppleRuntime;
+ path = ItaniumABI;
sourceTree = "<group>";
};
- 4CB443651249446F00C13DC2 /* LanguageRuntime */ = {
+ 4CCA644013B40B82003BDF98 /* ObjC */ = {
isa = PBXGroup;
children = (
- 4C139EA0124A8AC7000BFF8D /* CPlusPlus */,
- 4C139EA1124A8AD5000BFF8D /* ObjC */,
+ 4CCA644113B40B82003BDF98 /* AppleObjCRuntime */,
);
- name = LanguageRuntime;
+ path = ObjC;
sourceTree = "<group>";
};
- 4CB443661249448300C13DC2 /* ItaniumABI */ = {
+ 4CCA644113B40B82003BDF98 /* AppleObjCRuntime */ = {
isa = PBXGroup;
children = (
- 4CB44369124944B000C13DC2 /* ItaniumABILanguageRuntime.h */,
- 4CB4436A124944B000C13DC2 /* ItaniumABILanguageRuntime.cpp */,
+ 4CCA644213B40B82003BDF98 /* AppleObjCRuntime.cpp */,
+ 4CCA644313B40B82003BDF98 /* AppleObjCRuntime.h */,
+ 4CCA644413B40B82003BDF98 /* AppleObjCRuntimeV1.cpp */,
+ 4CCA644513B40B82003BDF98 /* AppleObjCRuntimeV1.h */,
+ 4CCA644613B40B82003BDF98 /* AppleObjCRuntimeV2.cpp */,
+ 4CCA644713B40B82003BDF98 /* AppleObjCRuntimeV2.h */,
+ 4CCA644813B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp */,
+ 4CCA644913B40B82003BDF98 /* AppleObjCTrampolineHandler.h */,
+ 4CCA644A13B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.cpp */,
+ 4CCA644B13B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.h */,
);
- name = ItaniumABI;
+ path = AppleObjCRuntime;
sourceTree = "<group>";
};
4CEE62F71145F1C70064CF93 /* GDB Remote */ = {
@@ -3069,12 +3069,6 @@
2689008C13353E4200698AC0 /* DisassemblerLLVM.cpp in Sources */,
2689008D13353E4200698AC0 /* DynamicLoaderMacOSXDYLD.cpp in Sources */,
2689008E13353E4200698AC0 /* DynamicLoaderStatic.cpp in Sources */,
- 2689009013353E4200698AC0 /* ItaniumABILanguageRuntime.cpp in Sources */,
- 2689009113353E4200698AC0 /* AppleObjCRuntime.cpp in Sources */,
- 2689009213353E4200698AC0 /* AppleObjCRuntimeV1.cpp in Sources */,
- 2689009313353E4200698AC0 /* AppleObjCTrampolineHandler.cpp in Sources */,
- 2689009413353E4200698AC0 /* AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */,
- 2689009513353E4200698AC0 /* AppleObjCRuntimeV2.cpp in Sources */,
2689009613353E4200698AC0 /* ObjectContainerBSDArchive.cpp in Sources */,
2689009713353E4200698AC0 /* ObjectContainerUniversalMachO.cpp in Sources */,
2689009813353E4200698AC0 /* ELFHeader.cpp in Sources */,
@@ -3231,6 +3225,12 @@
9A9E1EFF1398086D005AC039 /* InputReaderStack.cpp in Sources */,
B28058A1139988B0002D96D0 /* InferiorCallPOSIX.cpp in Sources */,
26F73062139D8FDB00FD51C7 /* History.cpp in Sources */,
+ 4CCA644D13B40B82003BDF98 /* ItaniumABILanguageRuntime.cpp in Sources */,
+ 4CCA645013B40B82003BDF98 /* AppleObjCRuntime.cpp in Sources */,
+ 4CCA645213B40B82003BDF98 /* AppleObjCRuntimeV1.cpp in Sources */,
+ 4CCA645413B40B82003BDF98 /* AppleObjCRuntimeV2.cpp in Sources */,
+ 4CCA645613B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp in Sources */,
+ 4CCA645813B40B82003BDF98 /* AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */,
9463D4CD13B1798800C230D4 /* CommandObjectType.cpp in Sources */,
9415F61813B2C0EF00A52B36 /* FormatManager.cpp in Sources */,
);
Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Fri Jun 24 17:03:24 2011
@@ -118,7 +118,8 @@
if (IsValid ())
{
- child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (static_cast<clang::ASTContext *>(m_ast),
+ child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (NULL,
+ static_cast<clang::ASTContext *>(m_ast),
NULL,
m_type,
idx,
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Jun 24 17:03:24 2011
@@ -407,7 +407,12 @@
clang::ASTContext *clang_ast = GetClangAST();
clang_type_t clang_type = GetClangType();
clang_type_t child_clang_type;
- child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (clang_ast,
+
+ ExecutionContext exe_ctx;
+ GetExecutionContextScope()->CalculateExecutionContext (exe_ctx);
+
+ child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (&exe_ctx,
+ clang_ast,
GetName().GetCString(),
clang_type,
idx,
@@ -1436,7 +1441,12 @@
clang::ASTContext *clang_ast = GetClangAST();
clang_type_t clang_type = GetClangType();
clang_type_t child_clang_type;
- child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (clang_ast,
+
+ ExecutionContext exe_ctx;
+ GetExecutionContextScope()->CalculateExecutionContext (exe_ctx);
+
+ child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (&exe_ctx,
+ clang_ast,
GetName().GetCString(),
clang_type,
0,
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Fri Jun 24 17:03:24 2011
@@ -28,7 +28,7 @@
{
public:
- ~AppleObjCRuntime() { }
+ virtual ~AppleObjCRuntime() { }
// These are generic runtime functions:
virtual bool
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Fri Jun 24 17:03:24 2011
@@ -28,7 +28,7 @@
public AppleObjCRuntime
{
public:
- ~AppleObjCRuntimeV1() { }
+ virtual ~AppleObjCRuntimeV1() { }
// These are generic runtime functions:
virtual bool
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Fri Jun 24 17:03:24 2011
@@ -7,13 +7,18 @@
//
//===----------------------------------------------------------------------===//
-#include "AppleObjCRuntimeV2.h"
-#include "AppleObjCTrampolineHandler.h"
-#include "llvm/Support/MachO.h"
-#include "clang/AST/Type.h"
+#include <string>
+#include <vector>
+#include <memory>
+#include <stdint.h>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/Core/ClangForward.h"
+#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Core/ClangForward.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Log.h"
@@ -31,10 +36,15 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "AppleObjCRuntimeV2.h"
+#include "AppleObjCTrampolineHandler.h"
+
+
#include <vector>
using namespace lldb;
using namespace lldb_private;
+
static const char *pluginName = "AppleObjCRuntimeV2";
static const char *pluginDesc = "Apple Objective C Language Runtime - Version 2";
@@ -514,3 +524,41 @@
return new ClangUtilityFunction(check_function_code, name);
}
+
+size_t
+AppleObjCRuntimeV2::GetByteOffsetForIvar (ClangASTType &parent_ast_type, const char *ivar_name)
+{
+ const char *class_name = parent_ast_type.GetClangTypeName().AsCString();
+
+ if (!class_name || *class_name == '\0' || !ivar_name || *ivar_name == '\0')
+ return LLDB_INVALID_IVAR_OFFSET;
+
+ std::string buffer("OBJC_IVAR_$_");
+ buffer.append (class_name);
+ buffer.push_back ('.');
+ buffer.append (ivar_name);
+ ConstString ivar_const_str (buffer.c_str());
+
+ SymbolContextList sc_list;
+ Target *target = &(m_process->GetTarget());
+
+ target->GetImages().FindSymbolsWithNameAndType(ivar_const_str, eSymbolTypeRuntime, sc_list);
+
+ SymbolContext ivar_offset_symbol;
+ if (sc_list.GetSize() != 1
+ || !sc_list.GetContextAtIndex(0, ivar_offset_symbol)
+ || ivar_offset_symbol.symbol == NULL)
+ return LLDB_INVALID_IVAR_OFFSET;
+
+ lldb::addr_t ivar_offset_address = ivar_offset_symbol.symbol->GetValue().GetLoadAddress(target);
+
+ Error error;
+
+ uint32_t ivar_offset = m_process->ReadUnsignedIntegerFromMemory (ivar_offset_address,
+ 4,
+ LLDB_INVALID_IVAR_OFFSET,
+ error);
+ return ivar_offset;
+}
+
+
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Fri Jun 24 17:03:24 2011
@@ -28,7 +28,7 @@
public AppleObjCRuntime
{
public:
- ~AppleObjCRuntimeV2() { }
+ virtual ~AppleObjCRuntimeV2() { }
// These are generic runtime functions:
virtual bool
@@ -73,6 +73,10 @@
{
return eAppleObjC_V2;
}
+
+ virtual size_t
+ GetByteOffsetForIvar (ClangASTType &parent_qual_type, const char *ivar_name);
+
protected:
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Jun 24 17:03:24 2011
@@ -58,6 +58,10 @@
#include "lldb/Core/dwarf.h"
#include "lldb/Core/Flags.h"
#include "lldb/Core/Log.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
+
#include <stdio.h>
@@ -2445,6 +2449,7 @@
clang_type_t
ClangASTContext::GetChildClangTypeAtIndex
(
+ ExecutionContext *exe_ctx,
const char *parent_name,
clang_type_t parent_clang_type,
uint32_t idx,
@@ -2461,7 +2466,8 @@
{
if (parent_clang_type)
- return GetChildClangTypeAtIndex (getASTContext(),
+ return GetChildClangTypeAtIndex (exe_ctx,
+ getASTContext(),
parent_name,
parent_clang_type,
idx,
@@ -2480,6 +2486,7 @@
clang_type_t
ClangASTContext::GetChildClangTypeAtIndex
(
+ ExecutionContext *exe_ctx,
ASTContext *ast,
const char *parent_name,
clang_type_t parent_clang_type,
@@ -2677,8 +2684,27 @@
child_byte_size = ivar_type_info.first / 8;
// Figure out the field offset within the current struct/union/class type
- bit_offset = interface_layout.getFieldOffset (child_idx - superclass_idx);
- child_byte_offset = bit_offset / 8;
+ // For ObjC objects, we can't trust the bit offset we get from the Clang AST, since
+ // that doesn't account for the space taken up by unbacked properties, or from
+ // the changing size of base classes that are newer than this class.
+ // So if we have a process around that we can ask about this object, do so.
+ child_byte_offset = LLDB_INVALID_IVAR_OFFSET;
+
+ if (exe_ctx && exe_ctx->process)
+ {
+ ObjCLanguageRuntime *objc_runtime = exe_ctx->process->GetObjCLanguageRuntime();
+ if (objc_runtime != NULL)
+ {
+ ClangASTType parent_ast_type (parent_qual_type.getAsOpaquePtr(), ast);
+ child_byte_offset = objc_runtime->GetByteOffsetForIvar (parent_ast_type, ivar_decl->getNameAsString().c_str());
+ }
+ }
+
+ if (child_byte_offset == LLDB_INVALID_IVAR_OFFSET)
+ {
+ bit_offset = interface_layout.getFieldOffset (child_idx - superclass_idx);
+ child_byte_offset = bit_offset / 8;
+ }
return ivar_qual_type.getAsOpaquePtr();
}
@@ -2699,7 +2725,8 @@
{
child_is_deref_of_parent = false;
bool tmp_child_is_deref_of_parent = false;
- return GetChildClangTypeAtIndex (ast,
+ return GetChildClangTypeAtIndex (exe_ctx,
+ ast,
parent_name,
pointer_type->getPointeeType().getAsOpaquePtr(),
idx,
@@ -2772,7 +2799,8 @@
{
child_is_deref_of_parent = false;
bool tmp_child_is_deref_of_parent = false;
- return GetChildClangTypeAtIndex (ast,
+ return GetChildClangTypeAtIndex (exe_ctx,
+ ast,
parent_name,
pointer_type->getPointeeType().getAsOpaquePtr(),
idx,
@@ -2819,7 +2847,8 @@
{
child_is_deref_of_parent = false;
bool tmp_child_is_deref_of_parent = false;
- return GetChildClangTypeAtIndex (ast,
+ return GetChildClangTypeAtIndex (exe_ctx,
+ ast,
parent_name,
pointee_clang_type,
idx,
@@ -2855,7 +2884,8 @@
break;
case clang::Type::Typedef:
- return GetChildClangTypeAtIndex (ast,
+ return GetChildClangTypeAtIndex (exe_ctx,
+ ast,
parent_name,
cast<TypedefType>(parent_qual_type)->getDecl()->getUnderlyingType().getAsOpaquePtr(),
idx,
Modified: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ObjCLanguageRuntime.cpp?rev=133831&r1=133830&r2=133831&view=diff
==============================================================================
--- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp Fri Jun 24 17:03:24 2011
@@ -93,3 +93,10 @@
return (*pos).second;
return TypeAndOrName ();
}
+
+size_t
+ObjCLanguageRuntime::GetByteOffsetForIvar (ClangASTType &parent_qual_type, const char *ivar_name)
+{
+ return LLDB_INVALID_IVAR_OFFSET;
+}
+
Added: lldb/trunk/test/objc-ivar-offsets/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc-ivar-offsets/Makefile?rev=133831&view=auto
==============================================================================
--- lldb/trunk/test/objc-ivar-offsets/Makefile (added)
+++ lldb/trunk/test/objc-ivar-offsets/Makefile Fri Jun 24 17:03:24 2011
@@ -0,0 +1,6 @@
+LEVEL = ../make
+
+OBJC_SOURCES := objc-ivar-offsets.m main.m
+LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/objc-ivar-offsets/TestObjCIvarOffsets.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc-ivar-offsets/TestObjCIvarOffsets.py?rev=133831&view=auto
==============================================================================
--- lldb/trunk/test/objc-ivar-offsets/TestObjCIvarOffsets.py (added)
+++ lldb/trunk/test/objc-ivar-offsets/TestObjCIvarOffsets.py Fri Jun 24 17:03:24 2011
@@ -0,0 +1,75 @@
+"""Test printing ObjC objects that use unbacked properties - so that the static ivar offsets are incorrect."""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+import lldbutil
+
+class TestObjCIvarOffsets(TestBase):
+
+ mydir = "objc-ivar-offsets"
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @python_api_test
+ def test_with_dsym_and_python_api(self):
+ """Test printing ObjC objects that use unbacked properties"""
+ self.buildDsym()
+ self.objc_ivar_offsets()
+
+ @python_api_test
+ def test_with_dwarf_and_python_api(self):
+ """Test printing ObjC objects that use unbacked properties"""
+ self.buildDwarf()
+ self.objc_ivar_offsets()
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line numbers to break inside main().
+ self.main_source = "main.m"
+ self.stop_line = line_number(self.main_source, '// Set breakpoint here.')
+
+ def objc_ivar_offsets(self):
+ """Use Python APIs to test stepping into ObjC methods."""
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ breakpoint = target.BreakpointCreateByLocation(self.main_source, self.stop_line)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ process = target.LaunchSimple (None, None, os.getcwd())
+ self.assertTrue (process, "Created a process.")
+ self.assertTrue (process.GetState() == lldb.eStateStopped, "Stopped it too.")
+
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
+ self.assertTrue (len(thread_list) == 1)
+ thread = thread_list[0]
+
+ frame = thread.GetFrameAtIndex(0)
+ self.assertTrue (frame, "frame 0 is valid")
+
+ mine = thread.GetFrameAtIndex(0).FindVariable("mine")
+ self.assertTrue(mine, "Found local variable mine.")
+
+ # Test the value object value for BaseClass->_backed_int
+
+ mine_backed_int = mine.GetChildMemberWithName ("_backed_int")
+ self.assertTrue(mine_backed_int, "Found mine->backed_int local variable.")
+ backed_value = int (mine_backed_int.GetValue (frame), 0)
+ self.assertTrue (backed_value == 1111)
+
+ # Test the value object value for DerivedClass->_derived_backed_int
+
+ mine_derived_backed_int = mine.GetChildMemberWithName ("_derived_backed_int")
+ self.assertTrue(mine_derived_backed_int, "Found mine->derived_backed_int local variable.")
+ derived_backed_value = int (mine_derived_backed_int.GetValue (frame), 0)
+ self.assertTrue (derived_backed_value == 3333)
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
Added: lldb/trunk/test/objc-ivar-offsets/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc-ivar-offsets/main.m?rev=133831&view=auto
==============================================================================
--- lldb/trunk/test/objc-ivar-offsets/main.m (added)
+++ lldb/trunk/test/objc-ivar-offsets/main.m Fri Jun 24 17:03:24 2011
@@ -0,0 +1,13 @@
+#include "objc-ivar-offsets.h"
+
+int
+main ()
+{
+ DerivedClass *mine = [[DerivedClass alloc] init];
+ mine.backed_int = 1111;
+ mine.unbacked_int = 2222;
+ mine.derived_backed_int = 3333;
+ mine.derived_unbacked_int = 4444;
+
+ return 0; // Set breakpoint here.
+}
Added: lldb/trunk/test/objc-ivar-offsets/objc-ivar-offsets.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc-ivar-offsets/objc-ivar-offsets.h?rev=133831&view=auto
==============================================================================
--- lldb/trunk/test/objc-ivar-offsets/objc-ivar-offsets.h (added)
+++ lldb/trunk/test/objc-ivar-offsets/objc-ivar-offsets.h Fri Jun 24 17:03:24 2011
@@ -0,0 +1,23 @@
+#import <Foundation/Foundation.h>
+
+ at interface BaseClass : NSObject
+{
+ int _backed_int;
+#if !__OBJC2__
+ int _unbacked_int;
+#endif
+}
+ at property int backed_int;
+ at property int unbacked_int;
+ at end
+
+ at interface DerivedClass : BaseClass
+{
+ int _derived_backed_int;
+#if !__OBJC2__
+ int _unbacked_int;
+#endif
+}
+ at property int derived_backed_int;
+ at property int derived_unbacked_int;
+ at end
Added: lldb/trunk/test/objc-ivar-offsets/objc-ivar-offsets.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc-ivar-offsets/objc-ivar-offsets.m?rev=133831&view=auto
==============================================================================
--- lldb/trunk/test/objc-ivar-offsets/objc-ivar-offsets.m (added)
+++ lldb/trunk/test/objc-ivar-offsets/objc-ivar-offsets.m Fri Jun 24 17:03:24 2011
@@ -0,0 +1,19 @@
+#import "objc-ivar-offsets.h"
+
+ at implementation BaseClass
+ at synthesize backed_int = _backed_int;
+#if __OBJC2__
+ at synthesize unbacked_int;
+#else
+ at synthesize unbacked_int = _unbacked_int;
+#endif
+ at end
+
+ at implementation DerivedClass
+ at synthesize derived_backed_int = _derived_backed_int;
+#if __OBJC2__
+ at synthesize derived_unbacked_int;
+#else
+ at synthesize derived_unbacked_int = _derived_unbacked_int;
+#endif
+ at end
More information about the lldb-commits
mailing list