libdwarf: Using dwarf_get_globals()

libdwarf

Loading...
Searching...
No Matches
Using dwarf_get_globals()

Example using global symbol names.

Example using global symbol names.

For 0.4.2 and earlier this returned .debug_pubnames content. As of version 0.5.0 (October 2022) this returns .debug_pubnames (if it exists) and the relevant portion of .debug_names (if .debug_names exists) data.

*/
int examplef(Dwarf_Debug dbg,Dwarf_Error *error)
{
Dwarf_Signed count = 0;
Dwarf_Global *globs = 0;
Dwarf_Signed i = 0;
int res = 0;
res = dwarf_get_globals(dbg, &globs,&count, error);
if (res != DW_DLV_OK) {
return res;
}
for (i = 0; i < count; ++i) {
/* use globs[i]
Dwarf_Global
struct Dwarf_Global_s * Dwarf_Global
Definition libdwarf.h:644
Dwarf_Error
struct Dwarf_Error_s * Dwarf_Error
Definition libdwarf.h:611
Dwarf_Debug
struct Dwarf_Debug_s * Dwarf_Debug
Definition libdwarf.h:617
Dwarf_Signed
signed long long Dwarf_Signed
Definition libdwarf.h:197
dwarf_get_globals
DW_API int dwarf_get_globals(Dwarf_Debug dw_dbg, Dwarf_Global **dw_globals, Dwarf_Signed *dw_number_of_globals, Dwarf_Error *dw_error)
Global name space operations, .debug_pubnames access.