diff options
Diffstat (limited to 'libdwfl/dwfl_module_getdwarf.c')
-rw-r--r-- | libdwfl/dwfl_module_getdwarf.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c index 9c677131..14fcd550 100644 --- a/libdwfl/dwfl_module_getdwarf.c +++ b/libdwfl/dwfl_module_getdwarf.c @@ -568,7 +568,7 @@ find_debuginfo (Dwfl_Module *mod) static Dwfl_Error load_symtab (struct dwfl_file *file, struct dwfl_file **symfile, Elf_Scn **symscn, Elf_Scn **xndxscn, - size_t *syments, GElf_Word *strshndx) + size_t *syments, int *first_global, GElf_Word *strshndx) { bool symtab = false; Elf_Scn *scn = NULL; @@ -584,6 +584,7 @@ load_symtab (struct dwfl_file *file, struct dwfl_file **symfile, *symfile = file; *strshndx = shdr->sh_link; *syments = shdr->sh_size / shdr->sh_entsize; + *first_global = shdr->sh_info; if (*xndxscn != NULL) return DWFL_E_NOERROR; break; @@ -844,11 +845,14 @@ find_symtab (Dwfl_Module *mod) if (mod->symerr != DWFL_E_NOERROR) return; + mod->first_global = -1; /* Unknown, unless explicitly set by load_symtab. */ + /* First see if the main ELF file has the debugging information. */ Elf_Scn *symscn = NULL, *xndxscn = NULL; GElf_Word strshndx; mod->symerr = load_symtab (&mod->main, &mod->symfile, &symscn, - &xndxscn, &mod->syments, &strshndx); + &xndxscn, &mod->syments, &mod->first_global, + &strshndx); switch (mod->symerr) { default: @@ -867,7 +871,8 @@ find_symtab (Dwfl_Module *mod) case DWFL_E_NOERROR: mod->symerr = load_symtab (&mod->debug, &mod->symfile, &symscn, - &xndxscn, &mod->syments, &strshndx); + &xndxscn, &mod->syments, + &mod->first_global, &strshndx); break; case DWFL_E_CB: /* The find_debuginfo hook failed. */ @@ -906,7 +911,7 @@ find_symtab (Dwfl_Module *mod) return; } - /* Cache the data; MOD->syments was set above. */ + /* Cache the data; MOD->syments and MOD->first_global were set above. */ mod->symstrdata = elf_getdata (elf_getscn (mod->symfile->elf, strshndx), NULL); |