[Lldb-commits] [lldb] [lldb] Fix address to read segment data (PR #120655)

via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 19 16:04:46 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: None (GeorgeHuyubo)

<details>
<summary>Changes</summary>

Previous commit https://github.com/llvm/llvm-project/commit/bcf654c7f5fb84dd7cff5fe112d96658853cd8f5
introduced a bug which makes lldb unable to parse gnu build id for the main executable from a core file.

This PR fix it by replace p_vaddr with p_offset.

Tested with core files with ELF headers off all modules. LLDB is able to parse the gnu build id for main executable as well as other shared libs.

---
Full diff: https://github.com/llvm/llvm-project/pull/120655.diff


1 Files Affected:

- (modified) lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp (+2-2) 


``````````diff
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index b3916cc913f7db..cf3e056a20a049 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -1047,9 +1047,9 @@ UUID ProcessElfCore::FindBuidIdInCoreMemory(lldb::addr_t address) {
     std::vector<uint8_t> note_bytes;
     note_bytes.resize(program_header.p_memsz);
 
-    // We need to slide the address of the p_vaddr as these values don't get
+    // We need to slide the address of the p_offset as these values don't get
     // relocated in memory.
-    const lldb::addr_t vaddr = program_header.p_vaddr + address;
+    const lldb::addr_t vaddr = program_header.p_offset + address;
     byte_read =
         ReadMemory(vaddr, note_bytes.data(), program_header.p_memsz, error);
     if (byte_read != program_header.p_memsz)

``````````

</details>


https://github.com/llvm/llvm-project/pull/120655


More information about the lldb-commits mailing list