[Lldb-commits] [lldb] 0bff9bd - [lldb] Adjust for the new class_rw_t layout.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 22 11:13:11 PDT 2019


Author: Jonas Devlieghere
Date: 2019-10-22T10:22:06-07:00
New Revision: 0bff9bd26e3d8b424f96f66b4297a73a873c4e53

URL: https://github.com/llvm/llvm-project/commit/0bff9bd26e3d8b424f96f66b4297a73a873c4e53
DIFF: https://github.com/llvm/llvm-project/commit/0bff9bd26e3d8b424f96f66b4297a73a873c4e53.diff

LOG: [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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
index 93aa07f89165..859b693477a9 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
@@ -111,6 +111,18 @@ bool ClassDescriptorV2::class_rw_t::Read(Process *process, lldb::addr_t addr) {
   m_firstSubclass = extractor.GetAddress_unchecked(&cursor);
   m_nextSiblingClass = extractor.GetAddress_unchecked(&cursor);
 
+  if (m_ro_ptr & 1) {
+    DataBufferHeap buffer(ptr_size, '\0');
+    process->ReadMemory(m_ro_ptr ^ 1, buffer.GetBytes(), ptr_size, error);
+    if (error.Fail())
+      return false;
+    cursor = 0;
+    DataExtractor extractor(buffer.GetBytes(), ptr_size,
+                            process->GetByteOrder(),
+                            process->GetAddressByteSize());
+    m_ro_ptr = extractor.GetAddress_unchecked(&cursor);
+  }
+
   return true;
 }
 


        


More information about the lldb-commits mailing list