51 lines
1.8 KiB
Diff
51 lines
1.8 KiB
Diff
commit 475849fdb25265706772905b856cd7028c566a71
|
|
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
Date: Thu Jul 24 20:47:17 2014 +0200
|
|
|
|
Fix report_r_debug for prelinked libraries
|
|
|
|
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c
|
|
index 2913d9f..272f89b 100644
|
|
--- a/libdwfl/link_map.c
|
|
+++ b/libdwfl/link_map.c
|
|
@@ -321,7 +321,11 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
|
|
if (read_addrs (next, 4))
|
|
return release_buffer (-1);
|
|
|
|
- GElf_Addr l_addr = addrs[0];
|
|
+ /* Unused: l_addr is the difference between the address in memory
|
|
+ and the ELF file when the core was created. We need to
|
|
+ recalculate the difference below because the ELF file we use
|
|
+ might be differently pre-linked. */
|
|
+ // GElf_Addr l_addr = addrs[0];
|
|
GElf_Addr l_name = addrs[1];
|
|
GElf_Addr l_ld = addrs[2];
|
|
next = addrs[3];
|
|
@@ -432,11 +436,14 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
|
|
|
|
if (valid)
|
|
{
|
|
+ // It is like l_addr but it handles differently prelinked
|
|
+ // files at core dumping vs. core loading time.
|
|
+ GElf_Addr base = l_ld - elf_dynamic_vaddr;
|
|
if (r_debug_info_module == NULL)
|
|
{
|
|
// XXX hook for sysroot
|
|
mod = __libdwfl_report_elf (dwfl, basename (name),
|
|
- name, fd, elf, l_addr,
|
|
+ name, fd, elf, base,
|
|
true, true);
|
|
if (mod != NULL)
|
|
{
|
|
@@ -444,7 +451,7 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata,
|
|
fd = -1;
|
|
}
|
|
}
|
|
- else if (__libdwfl_elf_address_range (elf, l_addr, true,
|
|
+ else if (__libdwfl_elf_address_range (elf, base, true,
|
|
true, NULL, NULL,
|
|
&r_debug_info_module->start,
|
|
&r_debug_info_module->end,
|