DWARF_CHILD(3) | Library Functions Manual | DWARF_CHILD(3) |
int
dwarf_child(Dwarf_Die die, Dwarf_Die *ret_die, Dwarf_Error *err);
int
dwarf_siblingof(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Die *ret_die, Dwarf_Error *err);
int
dwarf_offdie(Dwarf_Debug dbg, Dwarf_Off offset, Dwarf_Die *ret_die, Dwarf_Error *err);
Function dwarf_child() retrieves the child of descriptor denoted by argument die, and stores it in the location pointed to by argument ret_die.
Function dwarf_siblingof() retrieves the sibling of the descriptor denoted by argument die, and stores it in the location pointed to by argument ret_die. If argument die is NULL, the first debugging information entry descriptor for the current compilation unit will be returned. This function and function dwarf_child() may be used together to traverse the tree of debugging information entry descriptors for a compilation unit.
Function dwarf_offdie() retrieves the debugging information entry descriptor at global offset offset in the “.debug_info” section of the object associated with argument dbg. The returned descriptor is written to the location pointed to by argument ret_die.
Dwarf_Debug dbg; Dwarf_Die die, die0; Dwarf_Error de; ... allocate dbg using dwarf_init() etc ... if (dwarf_next_cu_header(dbg, NULL, NULL, NULL, NULL, NULL, &de) != DW_DLV_OK) errx(EXIT_FAILURE, "dwarf_next_cu_header: %s", dwarf_errmsg(de)); /* Get the first DIE for the current compilation unit. */ die = NULL; if (dwarf_siblingof(dbg, die, &die0, &de) != DW_DLV_OK) errx(EXIT_FAILURE, "dwarf_siblingof: %s", dwarf_errmsg(de)); /* Get the first child of this DIE. */ die = die0; if (dwarf_child(die, &die0, &de) != DW_DLV_OK) errx(EXIT_FAILURE, "dwarf_child: %s", dwarf_errmsg(de)); /* Get the rest of children. */ do { die = die0; if (dwarf_siblingof(dbg, die, &die0, &de) == DW_DLV_ERROR) errx(EXIT_FAILURE, "dwarf_siblingof: %s", dwarf_errmsg(de)); } while (die0 != NULL);
November 9, 2011 | NetBSD 7.2 |