3.7.0-7 Add upstream backport of DW_FORM_ref_addr patch (#842659)

This commit is contained in:
Mark Wielaard 2012-08-03 22:43:04 +02:00
parent b525fd179b
commit 3f5742f8d4
3 changed files with 43 additions and 8 deletions

View File

@ -581,16 +581,16 @@ diff -ru valgrind-3.7.0.orig/coregrind/m_debuginfo/readelf.c valgrind-3.7.0/core
+ ElfXX_Nhdr* note = (ElfXX_Nhdr*)(image + offset); + ElfXX_Nhdr* note = (ElfXX_Nhdr*)(image + offset);
+ Char* name = (Char *)note + sizeof(ElfXX_Nhdr); + Char* name = (Char *)note + sizeof(ElfXX_Nhdr);
+ UChar *desc = (UChar *)name + ((note->n_namesz + 3) & ~3); + UChar *desc = (UChar *)name + ((note->n_namesz + 3) & ~3);
+ Word j; + Word j2;
+ +
+ if (VG_(strcmp)(name, ELF_NOTE_GNU) == 0 && + if (VG_(strcmp)(name, ELF_NOTE_GNU) == 0 &&
+ note->n_type == NT_GNU_BUILD_ID) { + note->n_type == NT_GNU_BUILD_ID) {
+ buildid = ML_(dinfo_zalloc)("di.fbi.1", + buildid = ML_(dinfo_zalloc)("di.fbi.1",
+ note->n_descsz * 2 + 1); + note->n_descsz * 2 + 1);
+ +
+ for (j = 0; j < note->n_descsz; j++) { + for (j2 = 0; j2 < note->n_descsz; j2++) {
+ VG_(sprintf)(buildid + VG_(strlen)(buildid), + VG_(sprintf)(buildid + VG_(strlen)(buildid),
+ "%02x", desc[j]); + "%02x", desc[j2]);
+ } + }
+ } + }
+ +
@ -668,7 +668,7 @@ diff -ru valgrind-3.7.0.orig/coregrind/m_debuginfo/readelf.c valgrind-3.7.0/core
Bool res, ok; Bool res, ok;
SysRes fd, sres; SysRes fd, sres;
- Word i; - Word i;
+ Word i, j; + Word i, i2;
Bool dynbss_present = False; Bool dynbss_present = False;
Bool sdynbss_present = False; Bool sdynbss_present = False;
@ -798,9 +798,9 @@ diff -ru valgrind-3.7.0.orig/coregrind/m_debuginfo/readelf.c valgrind-3.7.0/core
+ (debugaltlink_sz - buildid_offset) + (debugaltlink_sz - buildid_offset)
+ * 2 + 1); + * 2 + 1);
+ +
+ for (j = 0; j < debugaltlink_sz - buildid_offset; j++) + for (i2 = 0; i2 < debugaltlink_sz - buildid_offset; i2++)
+ VG_(sprintf)(altbuildid + 2 * j, + VG_(sprintf)(altbuildid + 2 * i2,
+ "%02x", debugaltlink_img[buildid_offset + j]); + "%02x", debugaltlink_img[buildid_offset + i2]);
+ +
+ /* See if we can find a matching debug file */ + /* See if we can find a matching debug file */
+ find_debug_file( di, di->fsm.filename, altbuildid, + find_debug_file( di, di->fsm.filename, altbuildid,

View File

@ -0,0 +1,29 @@
r12545 | sewardj | 2012-04-29 13:35:37 +0200 (Sun, 29 Apr 2012) | 3 lines
Correctly parse DW_FORM_ref_addr -- its format is different in Dwarf2
vs Dwarf3 and later. Fixes #298864. (Tom Tromey, tromey@redhat.com)
Index: coregrind/m_debuginfo/readdwarf3.c
===================================================================
--- valgrind-3.7.0/coregrind/m_debuginfo/readdwarf3.c (revision 12544)
+++ valgrind-3.7.0/coregrind/m_debuginfo/readdwarf3.c (revision 12545)
@@ -1152,9 +1152,17 @@
So for the moment we merely range-check, to see that they
actually do specify a plausible offset within this
object's .debug_info, and return the value unchanged.
+
+ In DWARF 2, DW_FORM_ref_addr is address-sized, but in
+ DWARF 3 and later, it is offset-sized.
*/
- *cts = (ULong)(UWord)get_UWord(c);
- *ctsSzB = sizeof(UWord);
+ if (cc->version == 2) {
+ *cts = (ULong)(UWord)get_UWord(c);
+ *ctsSzB = sizeof(UWord);
+ } else {
+ *cts = get_Dwarfish_UWord(c, cc->is_dw64);
+ *ctsSzB = cc->is_dw64 ? sizeof(ULong) : sizeof(UInt);
+ }
TRACE_D3("0x%lx", (UWord)*cts);
if (0) VG_(printf)("DW_FORM_ref_addr 0x%lx\n", (UWord)*cts);
if (/* the following 2 are surely impossible, but ... */

View File

@ -1,7 +1,7 @@
Summary: Tool for finding memory management bugs in programs Summary: Tool for finding memory management bugs in programs
Name: valgrind Name: valgrind
Version: 3.7.0 Version: 3.7.0
Release: 6%{?dist} Release: 7%{?dist}
Epoch: 1 Epoch: 1
License: GPLv2 License: GPLv2
URL: http://www.valgrind.org/ URL: http://www.valgrind.org/
@ -29,6 +29,7 @@ Patch18: valgrind-3.7.0-addToXA.patch
Patch19: valgrind-3.7.0-debug-types.patch Patch19: valgrind-3.7.0-debug-types.patch
Patch20: valgrind-3.7.0-dwz.patch Patch20: valgrind-3.7.0-dwz.patch
Patch21: valgrind-3.7.0-glibc-2.16.patch Patch21: valgrind-3.7.0-glibc-2.16.patch
Patch22: valgrind-3.7.0-ref_addr.patch
Obsoletes: valgrind-callgrind Obsoletes: valgrind-callgrind
%ifarch x86_64 ppc64 %ifarch x86_64 ppc64
@ -129,6 +130,7 @@ for details.
%patch19 -p1 %patch19 -p1
%patch20 -p1 %patch20 -p1
%patch21 -p1 %patch21 -p1
%patch22 -p1
touch memcheck/tests/dw4.stdout.exp touch memcheck/tests/dw4.stdout.exp
%build %build
@ -224,6 +226,10 @@ echo ===============END TESTING===============
%endif %endif
%changelog %changelog
* Fri Aug 03 2012 Mark Wielaard <mjw@redhat.com> 3.7.0-7
- Fixup shadowing warnings valgrind-3.7.0-dwz.patch
- Add valgrind-3.7.0-ref_addr.patch (#842659, KDE#298864)
* Mon Jul 25 2012 Mark Wielaard <mjw@redhat.com> 3.7.0-6 * Mon Jul 25 2012 Mark Wielaard <mjw@redhat.com> 3.7.0-6
- handle dwz DWARF compressor output (#842659, KDE#302901) - handle dwz DWARF compressor output (#842659, KDE#302901)
- allow glibc 2.16. - allow glibc 2.16.