[Lldb-commits] [lldb] r281282 - Fix an issue where LLDB was not masking enough bits off of objc classes data() pointers, effectively rendering us unable to generate descriptors for some classes

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 12 17:22:49 PDT 2016


Author: enrico
Date: Mon Sep 12 19:22:49 2016
New Revision: 281282

URL: http://llvm.org/viewvc/llvm-project?rev=281282&view=rev
Log:
Fix an issue where LLDB was not masking enough bits off of objc classes data() pointers, effectively rendering us unable to generate descriptors for some classes

Fixes rdar://27758358


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

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp?rev=281282&r1=281281&r2=281282&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp Mon Sep 12 19:22:49 2016
@@ -28,6 +28,19 @@ bool ClassDescriptorV2::Read_objc_class(
   return ret;
 }
 
+static lldb::addr_t GetClassDataMask(Process *process) {
+  switch (process->GetAddressByteSize()) {
+  case 4:
+    return 0xfffffffcUL;
+  case 8:
+    return 0x00007ffffffffff8UL;
+  default:
+    break;
+  }
+
+  return LLDB_INVALID_ADDRESS;
+}
+
 bool ClassDescriptorV2::objc_class_t::Read(Process *process,
                                            lldb::addr_t addr) {
   size_t ptr_size = process->GetAddressByteSize();
@@ -60,7 +73,7 @@ bool ClassDescriptorV2::objc_class_t::Re
       extractor.GetAddress_unchecked(&cursor); // uintptr_t data_NEVER_USE;
 
   m_flags = (uint8_t)(data_NEVER_USE & (lldb::addr_t)3);
-  m_data_ptr = data_NEVER_USE & ~(lldb::addr_t)3;
+  m_data_ptr = data_NEVER_USE & GetClassDataMask(process);
 
   return true;
 }




More information about the lldb-commits mailing list