summaryrefslogtreecommitdiff
path: root/libdwfl/link_map.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2014-07-24 20:47:17 +0200
committerJan Kratochvil <jan.kratochvil@redhat.com>2014-07-28 21:00:13 +0200
commit475849fdb25265706772905b856cd7028c566a71 (patch)
tree19dc18dd506c3be522167e0523586f39adbbc508 /libdwfl/link_map.c
parente7b2a92bbc10f1f0e31777591fd697e344fbacad (diff)
downloadelfutils-475849fdb25265706772905b856cd7028c566a71.tar.gz
Fix report_r_debug for prelinked libraries
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
Diffstat (limited to 'libdwfl/link_map.c')
-rw-r--r--libdwfl/link_map.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c
index 2913d9f7..272f89ba 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,