Skip to content

Commit bb9d8dc

Browse files
committed
[lldb] Adjust for the new class_rw_t layout.
The field holding the "ro" will now be a union. If the low bit is set, then it isn't an ro and it needs to be dereferenced once more to get to it. If the low bit isn't set, then it is a proper class_ro_t No dedicated test is needed as this code path will trigger when running the existing Objective-C tests under a current version of the runtime. (cherry picked from commit 0bff9bd)
1 parent 57755b1 commit bb9d8dc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@ bool ClassDescriptorV2::class_rw_t::Read(Process *process, lldb::addr_t addr) {
111111
m_firstSubclass = extractor.GetAddress_unchecked(&cursor);
112112
m_nextSiblingClass = extractor.GetAddress_unchecked(&cursor);
113113

114+
if (m_ro_ptr & 1) {
115+
DataBufferHeap buffer(ptr_size, '\0');
116+
process->ReadMemory(m_ro_ptr ^ 1, buffer.GetBytes(), ptr_size, error);
117+
if (error.Fail())
118+
return false;
119+
cursor = 0;
120+
DataExtractor extractor(buffer.GetBytes(), ptr_size,
121+
process->GetByteOrder(),
122+
process->GetAddressByteSize());
123+
m_ro_ptr = extractor.GetAddress_unchecked(&cursor);
124+
}
125+
114126
return true;
115127
}
116128

0 commit comments

Comments
 (0)