libdwarf: Using dwarf_attrlist()

libdwarf

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

Example showing dwarf_attrlist().

Example showing dwarf_attrlist().

Parameters

  somedie | Pass in any valid relevant DIE pointer.
  error | An error pointer we can use.

Returns
  Return DW_DLV_OK (etc).

*/
int example1(Dwarf_Die somedie,Dwarf_Error *error)
{
Dwarf_Debug dbg = 0;
Dwarf_Signed atcount;
Dwarf_Attribute *atlist;
Dwarf_Signed i = 0;
int errv;
errv = dwarf_attrlist(somedie, &atlist,&atcount, error);
if (errv != DW_DLV_OK) {
return errv;
}
for (i = 0; i < atcount; ++i) {
Dwarf_Half attrnum = 0;
const char *attrname = 0;
/* use atlist[i], likely calling
libdwarf functions and likely
returning DW_DLV_ERROR if
what you call gets DW_DLV_ERROR
Dwarf_Die
struct Dwarf_Die_s * Dwarf_Die
Definition libdwarf.h:627
Dwarf_Attribute
struct Dwarf_Attribute_s * Dwarf_Attribute
Definition libdwarf.h:677
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_attrlist
DW_API int dwarf_attrlist(Dwarf_Die dw_die, Dwarf_Attribute **dw_attrbuf, Dwarf_Signed *dw_attrcount, Dwarf_Error *dw_error)
Gets the full list of attributes.
Dwarf_Half
unsigned short Dwarf_Half
Definition libdwarf.h:203
Dwarf_Signed
signed long long Dwarf_Signed
Definition libdwarf.h:197