Example of a DIE tree validation.
It is not something you need to use. But one must use it in a specific pattern for it to work properly.
*/
{
int cres = DW_DLV_OK;
int sibres = DW_DLV_OK;
die = in_die;
for ( ; die ; die = sibdie) {
int vres = 0;
if (cres == DW_DLV_ERROR) {
if (die != in_die) {
}
printf("dwarf_child ERROR\n");
return DW_DLV_ERROR;
}
if (cres == DW_DLV_OK) {
int lres = 0;
child = 0;
lres = example_sibvalid(dbg,child,error);
if (lres == DW_DLV_ERROR) {
if (die != in_die) {
}
printf("example_sibvalid ERROR\n");
return lres;
}
}
sibdie = 0;
&sibdie,error);
if (sibres == DW_DLV_ERROR) {
if (die != in_die) {
}
if (child) {
}
printf("dwarf_siblingof_b ERROR\n");
return DW_DLV_ERROR;
}
if (sibres == DW_DLV_NO_ENTRY) {
if (die != in_die) {
}
if (child) {
}
return DW_DLV_OK;
}
if (vres == DW_DLV_ERROR) {
if (die != in_die) {
}
if (child) {
}
printf("Invalid sibling DIE\n");
return DW_DLV_ERROR;
}
if (die != in_die) {
}
die = 0;
}
return DW_DLV_OK;
}
struct Dwarf_Debug_s * Dwarf_Debug
Definition: libdwarf.h:603
struct Dwarf_Die_s * Dwarf_Die
Definition: libdwarf.h:608
struct Dwarf_Error_s * Dwarf_Error
Definition: libdwarf.h:597
unsigned long long Dwarf_Unsigned
Definition: libdwarf.h:196
int Dwarf_Bool
Definition: libdwarf.h:202
Dwarf_Bool dwarf_get_die_infotypes_flag(Dwarf_Die dw_die)
Return the is_info flag.
void dwarf_dealloc_die(Dwarf_Die dw_die)
Deallocate (free) a DIE.
int dwarf_child(Dwarf_Die dw_die, Dwarf_Die *dw_return_childdie, Dwarf_Error *dw_error)
Return the child DIE, if any. The child may be the first of a list of sibling DIEs.
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)
Return the first DIE or the next sibling DIE.
int dwarf_validate_die_sibling(Dwarf_Die dw_sibling, Dwarf_Off *dw_offset)
Validate a sibling DIE.