diff options
-rw-r--r-- | lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index 477f4df655e..131f31f69a9 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -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::Read(Process *process, 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; } |