diff options
Diffstat (limited to 'libdw/dwarf_child.c')
-rw-r--r-- | libdw/dwarf_child.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/libdw/dwarf_child.c b/libdw/dwarf_child.c index b22b010e..0080cf9d 100644 --- a/libdw/dwarf_child.c +++ b/libdw/dwarf_child.c @@ -1,5 +1,5 @@ -/* Return vhild of current DIE. - Copyright (C) 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. +/* Return child of current DIE. + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -77,10 +77,11 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name, if (abbrevp == NULL) { abbrevp = __libdw_findabbrev (die->cu, abbrev_code); - die->abbrev = abbrevp ?: (Dwarf_Abbrev *) -1l; + die->abbrev = abbrevp ?: DWARF_END_ABBREV; } - if (unlikely (die->abbrev == (Dwarf_Abbrev *) -1l)) + if (unlikely (die->abbrev == DWARF_END_ABBREV)) { + invalid_dwarf: __libdw_seterrno (DWARF_E_INVALID_DWARF); return NULL; } @@ -95,10 +96,7 @@ __libdw_find_attr (Dwarf_Die *die, unsigned int search_name, { /* Are we still in bounds? This test needs to be refined. */ if (unlikely (attrp + 1 >= endp)) - { - __libdw_seterrno (DWARF_E_INVALID_DWARF); - return NULL; - } + goto invalid_dwarf; /* Get attribute name and form. @@ -163,10 +161,10 @@ dwarf_child (die, result) void *addr = NULL; /* If we already know there are no children do not search. */ - if (die->abbrev != (Dwarf_Abbrev *) -1 + if (die->abbrev != DWARF_END_ABBREV && (die->abbrev == NULL || die->abbrev->has_children)) addr = __libdw_find_attr (die, INVALID, NULL, NULL); - if (die->abbrev == (Dwarf_Abbrev *) -1l) + if (unlikely (die->abbrev == (Dwarf_Abbrev *) -1l)) return -1; /* Make sure the DIE really has children. */ |