[Lldb-commits] [lldb] 87c5364 - [lldb] Use batched string reading in ClassDescriptorV2::ivar_t::Read (#201578)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 8 05:41:50 PDT 2026
Author: Felipe de Azevedo Piovezan
Date: 2026-06-08T13:41:45+01:00
New Revision: 87c5364aeffd3dca0e9231ff9904c799ea003626
URL: https://github.com/llvm/llvm-project/commit/87c5364aeffd3dca0e9231ff9904c799ea003626
DIFF: https://github.com/llvm/llvm-project/commit/87c5364aeffd3dca0e9231ff9904c799ea003626.diff
LOG: [lldb] Use batched string reading in ClassDescriptorV2::ivar_t::Read (#201578)
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 1b8992d5e3f5d..b7b92c8948e17 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
@@ -383,13 +383,20 @@ ClassDescriptorV2::ivar_t::Read(Process *process, lldb::addr_t addr) {
result.m_alignment = extractor.GetU32_unchecked(&cursor);
result.m_size = extractor.GetU32_unchecked(&cursor);
- process->ReadCStringFromMemory(result.m_name_ptr, result.m_name, error);
- if (error.Fail())
- return error.takeError();
+ llvm::SmallVector<std::optional<std::string>> strs =
+ process->ReadCStringsFromMemory({result.m_name_ptr, result.m_type_ptr});
- process->ReadCStringFromMemory(result.m_type_ptr, result.m_type, error);
- if (error.Fail())
- return error.takeError();
+ if (!strs[0])
+ return llvm::createStringErrorV(
+ "failed to read ivar_t::m_name_str at address {0:x}",
+ result.m_name_ptr);
+ if (!strs[1])
+ return llvm::createStringErrorV(
+ "failed to read ivar_t::m_type_str at address {0:x}",
+ result.m_type_ptr);
+
+ result.m_name = std::move(*strs[0]);
+ result.m_type = std::move(*strs[1]);
return result;
}
More information about the lldb-commits
mailing list