libdwarf
Example dwarf_offdie_b call

Accessing a DIE by its offset. More...

Accessing a DIE by its offset.

*/
int example6(Dwarf_Debug dbg,Dwarf_Off die_offset,
Dwarf_Bool is_info,
Dwarf_Error *error)
{
Dwarf_Die return_die = 0;
int res = 0;
res = dwarf_offdie_b(dbg,die_offset,is_info,&return_die, error);
if (res != DW_DLV_OK) {
/* res could be NO ENTRY or ERROR, so no
dealloc necessary. */
return res;
}
/* Use return_die here. */
dwarf_dealloc_die(return_die);
/* return_die is no longer usable for anything, we
ensure we do not use it accidentally
though a bit silly here given the return_die
goes out of scope... */
return_die = 0;
return res;
}
Dwarf_Bool
int Dwarf_Bool
Definition: libdwarf.h:215
dwarf_offdie_b
int dwarf_offdie_b(Dwarf_Debug dw_dbg, Dwarf_Off dw_offset, Dwarf_Bool dw_is_info, Dwarf_Die *dw_return_die, Dwarf_Error *dw_error)
Finding die given global (not CU-relative) offset.
dwarf_dealloc_die
void dwarf_dealloc_die(Dwarf_Die dw_die)
Deallocate (free) a DIE.
Dwarf_Debug
struct Dwarf_Debug_s * Dwarf_Debug
Definition: libdwarf.h:537
Dwarf_Off
unsigned long long Dwarf_Off
Definition: libdwarf.h:211
Dwarf_Die
struct Dwarf_Die_s * Dwarf_Die
Definition: libdwarf.h:542
Dwarf_Error
struct Dwarf_Error_s * Dwarf_Error
Definition: libdwarf.h:531