libdwarf
Reading the gdbindex symbol table

Example accessing gdbindex symbol table data.

*/
int examplex(Dwarf_Gdbindex gdbindex,Dwarf_Error*error)
{
Dwarf_Unsigned symtab_list_length = 0;
int res = 0;
&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;
const char *name = 0;
int resl = 0;
&symnameoffset,&cuvecoffset,
error);
if (resl != DW_DLV_OK) {
return resl;
}
symnameoffset,&name,error);
if (resl != DW_DLV_OK) {
return resl;
}
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;
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. */
gdbindex, attributes, &cu_index,
&symbol_kind, &is_static,
error);
if (res2 != DW_DLV_OK) {
return res2;
}
/* Do something with the attributes. */
}
}
return DW_DLV_OK;
}
struct Dwarf_Gdbindex_s * Dwarf_Gdbindex
Definition: libdwarf.h:687
struct Dwarf_Error_s * Dwarf_Error
Definition: libdwarf.h:597
unsigned long long Dwarf_Unsigned
Definition: libdwarf.h:196
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.
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.
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.
int dwarf_gdbindex_cuvector_instance_expand_value(Dwarf_Gdbindex dw_gdbindexptr, Dwarf_Unsigned dw_field_value, Dwarf_Unsigned *dw_cu_index, Dwarf_Unsigned *dw_symbol_kind, Dwarf_Unsigned *dw_is_static, Dwarf_Error *dw_error)
Expand the bit fields in a cuvector entry.
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.
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.