Bug 283154

Summary: debuginfo not found because of unaligned CRC
Product: [Developer tools] valgrind Reporter: John Reiser <jreiser>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal CC: tom
Priority: NOR    
Version: 3.7 SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description John Reiser 2011-10-01 20:14:43 UTC
Version:           3.7 SVN (using Devel) 
OS:                Linux

Running "valgrind -v -v -d ..." on armv5tel, which garbles mis-aligned memory fetch, I see:
--2939--   Considering /usr/lib/debug/lib/arm-linux-gnueabi/librt-2.13.so ..
--2939--   .. CRC mismatch (computed 9ca1b344 wanted 0000b344)
which obviously is a bug: the top 16 bits of a true match have been zeroed.

The fix is:
--- coregrind/m_debuginfo/readelf.c     (revision 12072)
             /* Extract the CRC from the debuglink section */
-            crc = *(UInt *)(debuglink_img + crc_offset);
+            crc = read_UInt(debuglink_img + crc_offset);
and copy read_UInt() and host_is_little_endian() from readdwarf.c.

Reproducible: Always

Steps to Reproduce:
Run "valgrind -v -v -d /bin/date" on armv5tel (sheevaplug, nslu2, ...).

Actual Results:  
--2939--   Considering /usr/lib/debug/lib/arm-linux-gnueabi/librt-2.13.so ..
--2939--   .. CRC mismatch (computed 9ca1b344 wanted 0000b344)

Expected Results:  
No complaint.

Similar to bug 282527, but that concentrates on DWARFn, while this is plain ELF.
Comment 1 Tom Hughes 2011-10-02 10:27:14 UTC
Committed as r12081 and r12082.