When a library is prelinked, its section addresses are already absolute. This
patch checks for prelinked libraries by looking at the virtual address of the
PT_LOAD entry that has an offset equal to zero. If it is not zero, it means the
library is prelinked.
Note that this only affects remote backtrace for ARM, because it fills the
struct dl_phdr_info manually with information from tdep_get_elf_image().
Signed-off-by: Anderson Lizardo <[EMAIL PROTECTED]>
Signed-off-by: Bruna Moreira <[EMAIL PROTECTED]>
---
src/dwarf/Gfind_proc_info-lsb.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
Index: libunwind-indt-split/src/dwarf/Gfind_proc_info-lsb.c
===================================================================
--- libunwind-indt-split.orig/src/dwarf/Gfind_proc_info-lsb.c
+++ libunwind-indt-split/src/dwarf/Gfind_proc_info-lsb.c
@@ -269,6 +269,7 @@
char *buf;
size_t bufsize;
unsigned int i;
+ unw_word_t segbase = info->dlpi_addr;
/* First, see if we loaded this frame already. */
@@ -295,15 +296,27 @@
else
name = (char*) dlname;
+ /* pre-linked libraries already have absolute section addresses */
+ for (i = 0; i < info->dlpi_phnum; i++)
+ {
+ if (info->dlpi_phdr[i].p_type == PT_LOAD &&
+ info->dlpi_phdr[i].p_offset == 0 &&
+ info->dlpi_phdr[i].p_vaddr != 0)
+ {
+ segbase = 0;
+ break;
+ }
+ }
+
/* Find the start/end of the described region by parsing the
dl_phdr_info structure. */
- start = info->dlpi_addr + info->dlpi_phdr[0].p_vaddr;
+ start = segbase + info->dlpi_phdr[0].p_vaddr;
end = start;
for (i = 0; i < info->dlpi_phnum; i++)
{
- Elf_W (Addr) hdrbase = info->dlpi_addr + info->dlpi_phdr[i].p_vaddr;
+ Elf_W (Addr) hdrbase = segbase + info->dlpi_phdr[i].p_vaddr;
Elf_W (Addr) hdrlimit = hdrbase + info->dlpi_phdr[i].p_memsz;
if (info->dlpi_phdr[i].p_type != PT_LOAD)
--
Anderson Lizardo
Instituto Nokia de Tecnologia (INdT)
Manaus - Brazil
_______________________________________________
Libunwind-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/libunwind-devel