libdwarf
Reading high pc from a DIE.

Example get high-pc from a DIE.

*/
int examplehighpc(Dwarf_Die die,
Dwarf_Addr *highpc,
Dwarf_Error *error)
{
int res = 0;
Dwarf_Addr localhighpc = 0;
Dwarf_Half form = 0;
enum Dwarf_Form_Class formclass = DW_FORM_CLASS_UNKNOWN;
res = dwarf_highpc_b(die,&localhighpc,
&form,&formclass, error);
if (res != DW_DLV_OK) {
return res;
}
if (form != DW_FORM_addr &&
Dwarf_Addr low_pc = 0;
/* The localhighpc is an offset from
DW_AT_low_pc. */
res = dwarf_lowpc(die,&low_pc,error);
if (res != DW_DLV_OK) {
return res;
} else {
localhighpc += low_pc;
}
}
*highpc = localhighpc;
return DW_DLV_OK;
}
struct Dwarf_Die_s * Dwarf_Die
Definition: libdwarf.h:608
struct Dwarf_Error_s * Dwarf_Error
Definition: libdwarf.h:597
unsigned short Dwarf_Half
Definition: libdwarf.h:203
unsigned long long Dwarf_Addr
Definition: libdwarf.h:199
int dwarf_lowpc(Dwarf_Die dw_die, Dwarf_Addr *dw_returned_addr, Dwarf_Error *dw_error)
Return the DW_AT_low_pc value.
Dwarf_Bool dwarf_addr_form_is_indexed(int dw_form)
Informs if a DW_FORM is an indexed form.
int dwarf_highpc_b(Dwarf_Die dw_die, Dwarf_Addr *dw_return_addr, Dwarf_Half *dw_return_form, enum Dwarf_Form_Class *dw_return_class, Dwarf_Error *dw_error)
Return the DW_AT_hipc address value.
Dwarf_Form_Class
Definition: libdwarf.h:269