Using the Ehdr field directly doesn't work when there are a large number
of sections.
Signed-off-by: Mark Wielaard <mark@klomp.org>
2018-10-24 Mark Wielaard <mark@klomp.org>
+ * addr2line.c (print_addrsym): Use elf_getshdrstrndx instead of
+ Ehdr field.
+
+2018-10-24 Mark Wielaard <mark@klomp.org>
+
* readelf.c (section_name): Remove ehdr argument, lookup shstrndx.
(print_debug_abbrev_section): Don't pass ehdr.
(print_debug_addr_section): Likewise.
if (shdr != NULL)
{
Elf *elf = dwfl_module_getelf (mod, &ebias);
- GElf_Ehdr ehdr;
- if (gelf_getehdr (elf, &ehdr) != NULL)
- printf (" (%s)", elf_strptr (elf, ehdr.e_shstrndx,
+ size_t shstrndx;
+ if (elf_getshdrstrndx (elf, &shstrndx) >= 0)
+ printf (" (%s)", elf_strptr (elf, shstrndx,
shdr->sh_name));
}
}