From b75ff1bbd060404565fa28d72441a9b02f331bae Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 24 Oct 2018 16:15:04 +0200 Subject: addr2line: Use elf_getshdrstrndx not Ehdr field to print section name. Using the Ehdr field directly doesn't work when there are a large number of sections. Signed-off-by: Mark Wielaard --- src/addr2line.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/addr2line.c') diff --git a/src/addr2line.c b/src/addr2line.c index b7eb893e..69d8d995 100644 --- a/src/addr2line.c +++ b/src/addr2line.c @@ -446,9 +446,9 @@ print_addrsym (Dwfl_Module *mod, GElf_Addr addr) 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)); } } -- cgit v1.2.3