Hi, There was a small bug in dwarf_child () that made it fail with .debug_type Dwarf_Dies. It contained a sanity check to see whether we reached the end of the section early. A Dwarf_CU can come from either the debug_info unit or a debug_type unit section. So use the correct one for sanity checking whether we have a truncated section. Fixed as follows:
2011-04-26 Mark Wielaard <[email protected]> * dwarf_child (dwarf_child): Sanity check end of section against cu_data () of die->cu. Cheers, Mark
commit f4c39c7ccba57bcc71ab92760f4194b3e4667bb7 Author: Mark Wielaard <[email protected]> Date: Tue Apr 26 17:15:28 2011 +0200 libdw: Sanity check end of section against cu_data () of die->cu. A Dwarf_CU can come from either the debug_info compile unit or a debug_type type unit section. Use the correct one for sanity checking whether we have a truncated section. diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 0b17461..8febd42 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2011-04-26 Mark Wielaard <[email protected]> + + * dwarf_child (dwarf_child): Sanity check end of section against + cu_data () of die->cu. + 2011-03-22 Mark Wielaard <[email protected]> * dwarf.h: Add DW_TAG_GNU_call_site, diff --git a/libdw/dwarf_child.c b/libdw/dwarf_child.c index 1ec3704..0c2df00 100644 --- a/libdw/dwarf_child.c +++ b/libdw/dwarf_child.c @@ -177,13 +177,13 @@ dwarf_child (die, result) /* RESULT can be the same as DIE. So preserve what we need. */ struct Dwarf_CU *cu = die->cu; + Elf_Data *cu_sec = cu_data (cu); /* 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; - const unsigned char *endp = (cu->dbg->sectiondata[IDX_debug_info]->d_buf - + cu->dbg->sectiondata[IDX_debug_info]->d_size); + const unsigned char *endp = (cu_sec->d_buf + cu_sec->d_size); while (1) { if (unlikely (code >= endp)) /* Truncated section. */
_______________________________________________ elfutils-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/elfutils-devel
