mirror of
https://github.com/openharmony/third_party_elfutils.git
synced 2026-07-01 06:41:51 -04:00
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 <mark@klomp.org>
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
||||
+3
-3
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user