libdwarf: Reading the gdbindex symbol table

libdwarf

Loading...
Searching...
No Matches
Reading the gdbindex symbol table

Example accessing gdbindex symbol table data.

Example accessing gdbindex symbol table data.

*/
int examplex(Dwarf_Gdbindex gdbindex,Dwarf_Error*error)
{
Dwarf_Unsigned symtab_list_length = 0;
Dwarf_Unsigned i = 0;
int res = 0;
res = dwarf_gdbindex_symboltable_array(gdbindex,
&symtab_list_length,error);
if (res != DW_DLV_OK) {
return res;
}
for (i = 0; i < symtab_list_length; i++) {
Dwarf_Unsigned symnameoffset = 0;
Dwarf_Unsigned cuvecoffset = 0;
Dwarf_Unsigned cuvec_len = 0;
Dwarf_Unsigned ii = 0;
const char *name = 0;
int resl = 0;
resl = dwarf_gdbindex_symboltable_entry(gdbindex,i,
&symnameoffset,&cuvecoffset,
error);
if (resl != DW_DLV_OK) {
return resl;
}
resl = dwarf_gdbindex_string_by_offset(gdbindex,
symnameoffset,&name,error);
if (resl != DW_DLV_OK) {
return resl;
}
resl = dwarf_gdbindex_cuvector_length(gdbindex,
cuvecoffset,&cuvec_len,error);
if (resl != DW_DLV_OK) {
return resl;
}
for (ii = 0; ii < cuvec_len; ++ii ) {
Dwarf_Unsigned attributes = 0;
Dwarf_Unsigned cu_index = 0;
Dwarf_Unsigned symbol_kind = 0;
Dwarf_Unsigned is_static = 0;
int res2 = 0;
res2 = dwarf_gdbindex_cuvector_inner_attributes(
gdbindex,cuvecoffset,ii,
&attributes,error);
if (res2 != DW_DLV_OK) {
return res2;
}
/* 'attributes' is a value with various internal
fields so we expand the fields.
Dwarf_Error
struct Dwarf_Error_s * Dwarf_Error
Definition libdwarf.h:611
Dwarf_Gdbindex
struct Dwarf_Gdbindex_s * Dwarf_Gdbindex
Definition libdwarf.h:706
Dwarf_Unsigned
unsigned long long Dwarf_Unsigned
Definition libdwarf.h:196
dwarf_gdbindex_symboltable_entry
DW_API int dwarf_gdbindex_symboltable_entry(Dwarf_Gdbindex dw_gdbindexptr, Dwarf_Unsigned dw_entryindex, Dwarf_Unsigned *dw_string_offset, Dwarf_Unsigned *dw_cu_vector_offset, Dwarf_Error *dw_error)
Access individual symtab entry.
dwarf_gdbindex_string_by_offset
DW_API int dwarf_gdbindex_string_by_offset(Dwarf_Gdbindex dw_gdbindexptr, Dwarf_Unsigned dw_stringoffset, const char **dw_string_ptr, Dwarf_Error *dw_error)
Retrieve a symbol name from the index data.
dwarf_gdbindex_cuvector_inner_attributes
DW_API int dwarf_gdbindex_cuvector_inner_attributes(Dwarf_Gdbindex dw_gdbindexptr, Dwarf_Unsigned dw_cuvector_offset_in, Dwarf_Unsigned dw_innerindex, Dwarf_Unsigned *dw_field_value, Dwarf_Error *dw_error)
Get access to a cuvector.
dwarf_gdbindex_symboltable_array
DW_API int dwarf_gdbindex_symboltable_array(Dwarf_Gdbindex dw_gdbindexptr, Dwarf_Unsigned *dw_symtab_list_length, Dwarf_Error *dw_error)
Get access to the symboltable array.
dwarf_gdbindex_cuvector_length
DW_API int dwarf_gdbindex_cuvector_length(Dwarf_Gdbindex dw_gdbindexptr, Dwarf_Unsigned dw_cuvector_offset, Dwarf_Unsigned *dw_innercount, Dwarf_Error *dw_error)
Get access to a cuvector.