This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [PATCH] Fix bug using dwarf_next_unit to iterate over .debug_types
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 13 Apr 2012 12:18:14 +0200
- Subject: Re: [PATCH] Fix bug using dwarf_next_unit to iterate over .debug_types
On Thu, 2012-04-12 at 15:22 -0700, Josh Stone wrote:
> I'm seeing a segfault in your debugtypes.exp test added to systemtap,
> with my poor unpatched elfutils-0.153 on F16. The call to
> dwarf_offdie_types is returning NULL, which the calling code is not
> prepared for.
>
> So is the NULL return the extent of the failure? Or is elfutils
> generally borked after that?
>
> And even apart from this bug, should we be ready for NULL return from
> dwarf_offdie_types() anyway? Same question for dwarf_offdie(), I guess.
NULL can be returned fir dwarf_offdie () or dwarf_offdie_types () when
you give an offset that isn't really a DIE offset inside the debug_info
or debug_types section or when invalid DWARF is encountered. In such
cases NULL is returned and dwarf_errno () is set. The bug was in the
code that associated the right CU or TU with the returned Dwarf_Die. The
CU/TU is cached, but before the bug the cache could become bad and then
even valid offsets could fail, but the bug only impacted
dwarf_offdie_types ().
Cheers,
Mark