Skip to content

Commit f1e2886

Browse files
authored
[LLDB] Impove ObjectFileELF's .dynamic parsing and usage. (llvm#102570)
This patch improves the ability of a ObjectFileELF instance to read the .dynamic section. It adds the ability to read the .dynamic section from the PT_DYNAMIC program header which is useful for ELF files that have no section headers and for ELF files that are read from memory. It cleans up the usage of the .dynamic entries so that ObjectFileELF::ParseDynamicSymbols() is the only code that parses .dynamic entries, teaches that function the read and store the string values for each .dynamic entry. We now dump the .dynamic entries in the output of "image dump objfile". It also cleans up the code that gets the dynamic string table so that it can grab it from the DT_STRTAB and DT_STRSZ .dynamic entries for when we have a ELF file with no section headers or we are reading it from memory.
1 parent 90aac06 commit f1e2886

File tree

7 files changed

+500
-126
lines changed

7 files changed

+500
-126
lines changed

lldb/include/lldb/Symbol/ObjectFile.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,9 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
656656
// When an object file is in memory, subclasses should try and lock the
657657
// process weak pointer. If the process weak pointer produces a valid
658658
// ProcessSP, then subclasses can call this function to read memory.
659-
static lldb::DataBufferSP ReadMemory(const lldb::ProcessSP &process_sp,
660-
lldb::addr_t addr, size_t byte_size);
659+
static lldb::WritableDataBufferSP
660+
ReadMemory(const lldb::ProcessSP &process_sp, lldb::addr_t addr,
661+
size_t byte_size);
661662

662663
// This function returns raw file contents. Do not use it if you want
663664
// transparent decompression of section contents.

0 commit comments

Comments
 (0)