Bug 298864

Summary: DWARF reader mis-parses DW_FORM_ref_addr
Product: [Developer tools] valgrind Reporter: Tom Tromey <tromey>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: proposed patch

Description Tom Tromey 2012-04-26 17:20:50 UTC
I'm using the 'dwz' tool to compress DWARF debuginfo:
http://gcc.gnu.org/ml/gcc/2012-04/msg00686.html

This generates partial units and refrs to them using DW_TAG_imported_unit.
It generates a DW_FORM_ref_addr.

Right now valgrind does:

-         *cts = (ULong)(UWord)get_UWord(c);
-         *ctsSzB = sizeof(UWord);

But, the DWARF standard (version 3) says:

In the 32-bit DWARF format, this offset is a 4-byte unsigned value; in the 64-bit DWARF format, it is an 8-byte unsigned value

So, I think this should use get_Dwarfish_Word instead.

Patch to follow.

Reproducible: Always
Comment 1 Tom Tromey 2012-04-26 17:21:43 UTC
Created attachment 70672 [details]
proposed patch

This patch changes DW_FORM_ref_addr to use the proper size.
Comment 2 Julian Seward 2012-04-29 11:35:55 UTC
Committed, r12545.  Thanks!