[valgrind] Add valgrind-3.8.1-dwarf-anon-enum.patch.

Mark Wielaard mjw at fedoraproject.org
Mon Jul 8 11:21:57 UTC 2013


commit 088e4859abb198c78047b44b5ee116f11e61648b
Author: Mark Wielaard <mjw at redhat.com>
Date:   Mon Jul 8 13:02:58 2013 +0200

    Add valgrind-3.8.1-dwarf-anon-enum.patch.

 valgrind-3.8.1-dwarf-anon-enum.patch |   71 ++++++++++++++++++++++++++++++++++
 valgrind.spec                        |    7 +++
 2 files changed, 78 insertions(+), 0 deletions(-)
---
diff --git a/valgrind-3.8.1-dwarf-anon-enum.patch b/valgrind-3.8.1-dwarf-anon-enum.patch
new file mode 100644
index 0000000..a29d0b9
--- /dev/null
+++ b/valgrind-3.8.1-dwarf-anon-enum.patch
@@ -0,0 +1,71 @@
+commit 9d82d0f293c83ff2b8c3ab07065d8454059452be
+Author: mjw <mjw at a5019735-40e9-0310-863c-91ae7b9d1cf9>
+Date:   Fri Jun 28 14:03:58 2013 +0000
+
+    Bug 289360 parse_type_DIE confused by DW_TAG_enumeration_type.
+    
+    GCC allows incomplete enums as GNU extension.
+    http://gcc.gnu.org/onlinedocs/gcc/Incomplete-Enums.html
+    These are marked as DW_AT_declaration and won't have a size.
+    They can only be used in declaration or as pointer types.
+    You can't allocate variables or storage using such an enum type.
+    So don't require a size for such enum types.
+    
+    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13433 a5019735-40e9-0310-863c-91ae7b9d1cf9
+
+diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c
+index 8dbed5a..5e20ff0 100644
+--- a/coregrind/m_debuginfo/readdwarf3.c
++++ b/coregrind/m_debuginfo/readdwarf3.c
+@@ -2501,6 +2501,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
+       VG_(memset)(&typeE, 0, sizeof(typeE));
+       typeE.cuOff = posn;
+       typeE.tag   = Te_TyEnum;
++      Bool is_decl = False;
+       typeE.Te.TyEnum.atomRs
+          = VG_(newXA)( ML_(dinfo_zalloc), "di.readdwarf3.ptD.enum_type.1", 
+                        ML_(dinfo_free),
+@@ -2519,6 +2520,9 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
+          if (attr == DW_AT_byte_size && ctsSzB > 0) {
+             typeE.Te.TyEnum.szB = cts;
+          }
++         if (attr == DW_AT_declaration) {
++            is_decl = True;
++         }
+       }
+ 
+       if (!typeE.Te.TyEnum.name)
+@@ -2530,22 +2534,17 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
+       if (typeE.Te.TyEnum.szB == 0 
+           /* we must know the size */
+           /* but not for Ada, which uses such dummy
+-             enumerations as helper for gdb ada mode. */
+-          && parser->language != 'A') {
+-         /* GCC has been seen to put an odd DIE like this into
+-            .debug_types:
+-
+-            <1><cb72>: DW_TAG_enumeration_type (in .debug_types)
+-            DW_AT_name        : (indirect string, offset: 0x3374a): exec_direction_kind
+-            DW_AT_declaration : 1	
+-
+-            It isn't clear what this means, but we accept it and
+-            assume that the enum is int-sized.  */
+-         if (cc->is_type_unit) {
+-            typeE.Te.TyEnum.szB = sizeof(int);
+-         } else {
+-            goto bad_DIE;
+-         }
++             enumerations as helper for gdb ada mode.
++             Also GCC allows incomplete enums as GNU extension.
++             http://gcc.gnu.org/onlinedocs/gcc/Incomplete-Enums.html
++             These are marked as DW_AT_declaration and won't have
++             a size. They can only be used in declaration or as
++             pointer types.  You can't allocate variables or storage
++             using such an enum type. (Also GCC seems to have a bug
++             that will put such an enumeration_type into a .debug_types
++             unit which should only contain complete types.) */
++          && (parser->language != 'A' && !is_decl)) {
++         goto bad_DIE;
+       }
+ 
+       /* On't stack! */
diff --git a/valgrind.spec b/valgrind.spec
index 4df4472..25f6ea3 100644
--- a/valgrind.spec
+++ b/valgrind.spec
@@ -159,6 +159,9 @@ Patch39: valgrind-3.8.1-regtest-fixlets.patch
 # KDE#309600 - valgrind is a bit confused about 0-sized sections
 Patch40: valgrind-3.8.1-zero-size-sections.patch
 
+# KDE#289360 - parse_type_DIE confused by DW_TAG_enumeration_type
+Patch41: valgrind-3.8.1-dwarf-anon-enum.patch
+
 %ifarch x86_64 ppc64
 # Ensure glibc{,-devel} is installed for both multilib arches
 BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
@@ -298,6 +301,7 @@ touch ./memcheck/tests/linux/getregset.stderr.exp
 %patch38 -p1
 %patch39 -p1
 %patch40 -p1
+%patch41 -p1
 
 # These tests go into an endless loop on ARM
 # There is a __sync_add_and_fetch in the testcase.
@@ -459,6 +463,9 @@ echo ===============END TESTING===============
 %endif
 
 %changelog
+* Mon Jul 08 2013 Mark Wielaard <mjw at redhat.com>
+- Add valgrind-3.8.1-dwarf-anon-enum.patch
+
 * Tue May 28 2013 Michael Schwendt <mschwendt at fedoraproject.org> - 1:3.8.1-16
 - Provide virtual -static package in -devel subpackage (#609624).
 


More information about the scm-commits mailing list