+2013-12-16 Mark Wielaard <mjw@redhat.com>
+
+ * NEWS (libdwfl): Add dwfl_module_getsymtab_first_global.
+
2013-12-09 Josh Stone <jistone@redhat.com>
* .gitignore: Add config/ar-lib, installed due to AM_PROG_AR.
Version 0.158
libdwfl: dwfl_core_file_report has new parameter executable.
+ New function dwfl_module_getsymtab_first_global.
Version 0.157
+2013-12-16 Mark Wielaard <mjw@redhat.com>
+
+ * libdw.map (ELFUTILS_0.158): Add dwfl_module_getsymtab_first_global.
+
2013-12-10 Josh Stone <jistone@redhat.com>
* memory-access.h (get_uleb128_rest_return): Removed.
dwfl_module_addrsym_elf;
dwfl_module_getsym_elf;
+ dwfl_module_getsymtab_first_global;
} ELFUTILS_0.157;
+2013-12-16 Mark Wielaard <mjw@redhat.com>
+
+ * libdwfl.h (dwfl_module_getsymtab_first_global): New function
+ definition.
+ * dwfl_module_getdwarf.c (dwfl_module_getsymtab_first_global): New
+ function.
+ * libdwflP.h (dwfl_module_getsymtab_first_global): New internal
+ function definition.
+ * dwfl_module_addrsym.c (dwfl_module_addrsym_elf): Use new function.
+
2013-12-14 Mark Wielaard <mjw@redhat.com>
* dwfl_module.c (__libdwfl_module_free): Free mod->reloc_info if
come first in the symbol table, then all globals. The zeroth,
null entry, in the auxiliary table is skipped if there is a main
table. */
- int first_global = mod->first_global + mod->aux_first_global;
- if (mod->syments > 0 && mod->aux_syments > 0)
- first_global--;
+ int first_global = INTUSE (dwfl_module_getsymtab_first_global) (mod);
+ if (first_global < 0)
+ return NULL;
search_table (first_global == 0 ? 1 : first_global, syments);
/* If we found nothing searching the global symbols, then try the locals.
return -1;
}
INTDEF (dwfl_module_getsymtab)
+
+int
+dwfl_module_getsymtab_first_global (Dwfl_Module *mod)
+{
+ if (mod == NULL)
+ return -1;
+
+ find_symtab (mod);
+ if (mod->symerr == DWFL_E_NOERROR)
+ {
+ /* All local symbols should come before all global symbols. If
+ we have an auxiliary table make sure all the main locals come
+ first, then all aux locals, then all main globals and finally all
+ aux globals. And skip the auxiliary table zero undefined
+ entry. */
+ int skip_aux_zero = (mod->syments > 0 && mod->aux_syments > 0) ? 1 : 0;
+ return mod->first_global + mod->aux_first_global - skip_aux_zero;
+ }
+
+ __libdwfl_seterrno (mod->symerr);
+ return -1;
+}
+INTDEF (dwfl_module_getsymtab_first_global)
or -1 for errors. */
extern int dwfl_module_getsymtab (Dwfl_Module *mod);
+/* Return the index of the first global symbol in the module's symbol
+ table, or -1 for errors. In each symbol table, all symbols with
+ STB_LOCAL binding precede the weak and global symbols. This
+ function returns the symbol table index one greater than the last
+ local symbol. */
+extern int dwfl_module_getsymtab_first_global (Dwfl_Module *mod);
+
/* Fetch one entry from the module's symbol table. On errors, returns
NULL. If successful, fills in *SYM and returns the string for st_name.
This works like gelf_getsym except that st_value is always adjusted to
INTDECL (dwfl_module_getsym)
INTDECL (dwfl_module_getsym_elf)
INTDECL (dwfl_module_getsymtab)
+INTDECL (dwfl_module_getsymtab_first_global)
INTDECL (dwfl_module_getsrc)
INTDECL (dwfl_module_report_build_id)
INTDECL (dwfl_report_elf)