diff options
| author | Ulrich Drepper <[email protected]> | 2008-01-18 19:59:08 +0000 |
|---|---|---|
| committer | Ulrich Drepper <[email protected]> | 2008-01-18 19:59:08 +0000 |
| commit | 35f08c4d52d0ffd9f8aa50f47b84de5603842b1f (patch) | |
| tree | 7def9d6d4ef3ffea169252d44325cb039294129d /libdw/dwarf_siblingof.c | |
| parent | 4173bd8d5dd43413ba0635e2a74bc57a9478fb13 (diff) | |
propagate from branch 'com.redhat.elfutils.nickc.pending' (head 28d6423325f0cc14a133eb6b92a8c3604e437ba6)
to branch 'com.redhat.elfutils' (head 6ef48518ed8497626058574c787852bd939d46ee)
Diffstat (limited to 'libdw/dwarf_siblingof.c')
| -rw-r--r-- | libdw/dwarf_siblingof.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libdw/dwarf_siblingof.c b/libdw/dwarf_siblingof.c index a6cca394..ac9d2877 100644 --- a/libdw/dwarf_siblingof.c +++ b/libdw/dwarf_siblingof.c @@ -56,7 +56,6 @@ #include <dwarf.h> #include <string.h> - int dwarf_siblingof (die, result) Dwarf_Die *die; @@ -66,6 +65,12 @@ dwarf_siblingof (die, result) if (die == NULL) return -1; + if (result == NULL) + return -1; + + if (result != die) + result->addr = NULL; + unsigned int level = 0; /* Copy of the current DIE. */ @@ -102,13 +107,12 @@ dwarf_siblingof (die, result) + sibattr.cu->start + offset); } else if (unlikely (addr == NULL) - || unlikely (this_die.abbrev == (Dwarf_Abbrev *) -1l)) + || unlikely (this_die.abbrev == DWARF_END_ABBREV)) return -1; else if (this_die.abbrev->has_children) /* This abbreviation has children. */ ++level; - while (1) { /* Make sure we are still in range. Some producers might skip @@ -120,8 +124,12 @@ dwarf_siblingof (die, result) break; if (level-- == 0) - /* No more sibling at all. */ - return 1; + { + if (result != die) + result->addr = addr; + /* No more sibling at all. */ + return 1; + } ++addr; } |
