summaryrefslogtreecommitdiff
path: root/libdw/dwarf_child.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2007-10-23 13:07:39 +0000
committerRoland McGrath <roland@redhat.com>2007-10-23 13:07:39 +0000
commite4c22ea004c02a58f5db5eb53794275344c17958 (patch)
treeec3713d305f8e9f05b15d29240accc71e98998c5 /libdw/dwarf_child.c
parent98c5ead4ad9fbf96ad3b54d8ca26e354ddc3398d (diff)
downloadelfutils-e4c22ea004c02a58f5db5eb53794275344c17958.tar.gz
2007-10-23 Roland McGrath <roland@redhat.com>
* linux-kernel-modules.c (report_kernel_archive): Reorder the kernel module to appear first.
Diffstat (limited to 'libdw/dwarf_child.c')
-rw-r--r--libdw/dwarf_child.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libdw/dwarf_child.c b/libdw/dwarf_child.c
index 42b38137..b22b010e 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 Red Hat, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -177,6 +177,15 @@ dwarf_child (die, result)
if (addr == NULL)
return -1;
+ /* It's kosher (just suboptimal) to have a null entry first thing (7.5.3).
+ So if this starts with ULEB128 of 0 (even with silly encoding of 0),
+ it is a kosher null entry and we do not really have any children. */
+ const unsigned char *code = addr;
+ while (unlikely (*code == 0x80))
+ ++code;
+ if (unlikely (*code == '\0'))
+ return 1;
+
/* RESULT can be the same as DIE. So preserve what we need. */
struct Dwarf_CU *cu = die->cu;