This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH] Fix bug using dwarf_next_unit to iterate over .debug_types
- From: Mark Wielaard <mjw at redhat dot com>
- To: Josh Stone <jistone at redhat dot com>
- Cc: Tom Tromey <tromey at redhat dot com>, elfutils-devel <elfutils-devel at lists dot fedorahosted dot org>, SystemTap <systemtap at sourceware 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
- References: <87k42gmq7v.fsf@fleche.redhat.com> <20120319214954.GE12114@toonder.wildebeest.org> <87r4wnks8c.fsf@fleche.redhat.com> <20120320203315.GB1650@toonder.wildebeest.org> <87wr6eatmh.fsf_-_@fleche.redhat.com> <4F875590.1060102@redhat.com>
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