[PATCH] libdw: fix offset for sig8 lookup in dwarf_formref_die

Mark Wielaard mjw at redhat.com
Wed Jan 14 20:52:47 UTC 2015


Hi Jason, Hi Josh,

On Wed, 2015-01-14 at 09:59 -0800, Josh Stone wrote:
> On 01/14/2015 08:47 AM, Mark Wielaard wrote:
> > On Wed, 2015-01-14 at 09:26 -0500, Jason P. Leasure wrote:
> >> -      offset = cu->type_offset;
> >> +      offset = cu->start + cu->type_offset;
> > 
> > Thanks, I believe this is correct. I am surprised we didn't encounter
> > this earlier. Do you happen to have a testcase for it?
> 
> It's a regression from commit 9202665816763, before which cu->start was
> used with the offset everywhere.
> 
> I can see this in my dwarvish tool with Jason's example source.  You
> just need a ref_sig8 that's not in the first type_unit, cu->start > 0.
> So here, struct A has a ref_sig8 to struct B in the second type_unit.
> 
> In the bad case I see "signature  ref_sig8  [30] 0", where those last
> two bits are supposed to be the offset and tag.
> 
> I see "signature  ref_sig8  [72] structure_type" with 0.160, or with
> master and this patch, and it expands the tree of attributes from there.
> 
> Of course you won't want a GUI for tests, but it should be easy to craft
> this one directly.

Aha. So this is my bug, I broke it. Sorry about that :{
So I added a ChangeLog entry and pushed Jason's patch. Then tweaked the
typeiter2 testcase a little to show the name and offset of the type DIE
found to show the regression and added that to master too as attached.

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tests-Add-testfile-debug-types-test-case.patch
Type: text/x-patch
Size: 8079 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/elfutils-devel/attachments/20150114/d9453a26/attachment.bin>


More information about the elfutils-devel mailing list