libdwarf
Example dwarf_siblingofb call

Accessing a DIE sibling. More...

Accessing a DIE sibling.

Access to each DIE on a sibling list

*/
int example4(Dwarf_Debug dbg,Dwarf_Die in_die,
Dwarf_Bool is_info,
Dwarf_Error *error)
{
Dwarf_Die return_sib = 0;
int res = 0;
/* in_die might be NULL or a valid Dwarf_Die */
res = dwarf_siblingof_b(dbg,in_die,is_info,&return_sib, error);
if (res == DW_DLV_OK) {
/* Use return_sib here. */
dwarf_dealloc_die(return_sib);
/* return_sib is no longer usable for anything, we
ensure we do not use it accidentally with: */
return_sib = 0;
return res;
}
return res;
}
Dwarf_Bool
int Dwarf_Bool
Definition: libdwarf.h:215
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_siblingof_b
int dwarf_siblingof_b(Dwarf_Debug dw_dbg, Dwarf_Die dw_die, Dwarf_Bool dw_is_info, Dwarf_Die *dw_return_siblingdie, Dwarf_Error *dw_error)
Retrieve the first DIE or the next sibling.
Dwarf_Die
struct Dwarf_Die_s * Dwarf_Die
Definition: libdwarf.h:542
Dwarf_Error
struct Dwarf_Error_s * Dwarf_Error
Definition: libdwarf.h:531