[Lldb-commits] [lldb] [LLDB] Impove ObjectFileELF's .dynamic parsing and usage. (PR #101237)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 5 06:43:27 PDT 2024
================
@@ -2550,6 +2550,21 @@ ModuleSP Process::ReadModuleFromMemory(const FileSpec &file_spec,
}
ModuleSP module_sp(new Module(file_spec, ArchSpec()));
if (module_sp) {
+ if (size_to_read == 0) {
+ // Default to 8192 in case we can't find a memory region.
+ size_to_read = 0x2000;
+ MemoryRegionInfo range_info;
+ Status error(GetMemoryRegionInfo(header_addr, range_info));
+ if (error.Success()) {
+ // We found a memory region, set the range of bytes ro read to read to
+ // the end of the memory region. This should be enough to contain the
+ // file header and important bits.
+ const auto &range = range_info.GetRange();
----------------
labath wrote:
They are, but that's not my point. My point is that this first segment can be really large (like one gigabyte or even more), and if that's the case, we probably don't want to read all of it.
Doing the extra read in ObjectFileELF sounds good to me, as there we can look at the elf header, and load exactly only the program header bytes we care about.
https://github.com/llvm/llvm-project/pull/101237
More information about the lldb-commits
mailing list