libdwarf: Using dwarf_offset_list()

libdwarf

Loading...
Searching...
No Matches
Using dwarf_offset_list()

Example using dwarf_offset_list.

Example using dwarf_offset_list.

An example calling dwarf_offset_list

Parameters

  dbg | the Dwarf_Debug of interest
  dieoffset | The section offset of a Dwarf_Die
  is_info | Pass in TRUE if the dieoffset is for the .debug_info section, else pass in FALSE meaning the dieoffset is for the DWARF4 .debug_types section.
  error | The usual error detail return.

Returns
  Returns DW_DLV_OK etc
  */
  int exampleoffset_list(Dwarf_Debug dbg, Dwarf_Off dieoffset,
  Dwarf_Bool is_info,Dwarf_Error * error)
  {
  Dwarf_Unsigned offcnt = 0;
  Dwarf_Off *offbuf = 0;
  int errv = 0;
  Dwarf_Unsigned i = 0;
  errv = dwarf_offset_list(dbg,dieoffset, is_info,
  &offbuf,&offcnt, error);
  if (errv != DW_DLV_OK) {
  return errv;
  }
  for (i = 0; i < offcnt; ++i) {
  /* use offbuf[i]
  Dwarf_Error
  struct Dwarf_Error_s * Dwarf_Error
  Definition libdwarf.h:611
  Dwarf_Debug
  struct Dwarf_Debug_s * Dwarf_Debug
  Definition libdwarf.h:617
  Dwarf_Off
  unsigned long long Dwarf_Off
  Definition libdwarf.h:198
  Dwarf_Bool
  int Dwarf_Bool
  Definition libdwarf.h:202
  Dwarf_Unsigned
  unsigned long long Dwarf_Unsigned
  Definition libdwarf.h:196
  dwarf_offset_list
  DW_API int dwarf_offset_list(Dwarf_Debug dw_dbg, Dwarf_Off dw_offset, Dwarf_Bool dw_is_info, Dwarf_Off **dw_offbuf, Dwarf_Unsigned *dw_offcount, Dwarf_Error *dw_error)
  Return an array of DIE children offsets.