Blob Blame History Raw
commit 836b51a998fe520728aab7c5e1b156cadaa20c20
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date:   Sun Nov 24 17:19:35 2013 +0000

    Bug 327916 - DW_TAG_typedef may have no name
    
    We already accepted DW_TAG_typedef without a name for Ada. But g++ for
    OpenMP can also emit such nameless DW_TAG_typedefs. Just accept them.
    Also fix up anonymous enum and typedef printing in tytypes.c.
    
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13718 a5019735-40e9-0310-863c-91ae7b9d1cf9

diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c
index b0a7a92..f64a97b 100644
--- a/coregrind/m_debuginfo/readdwarf3.c
+++ b/coregrind/m_debuginfo/readdwarf3.c
@@ -2926,19 +2926,17 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
                = cook_die_using_form( cc, (UWord)cts.u.val, form );
          }
       }
-      /* Do we have something that looks sane? */
-      if (/* must have a name */
-          typeE.Te.TyTyDef.name == NULL
-          /* However gcc gnat Ada generates minimal typedef
-             such as the below => accept no name for Ada.
-             <6><91cc>: DW_TAG_typedef
-                DW_AT_abstract_ori: <9066>
-          */
-          && parser->language != 'A'
-          /* but the referred-to type can be absent */)
-         goto bad_DIE;
-      else
-         goto acquire_Type;
+      /* Do we have something that looks sane?
+         gcc gnat Ada generates minimal typedef
+         such as the below
+         <6><91cc>: DW_TAG_typedef
+            DW_AT_abstract_ori: <9066>
+         g++ for OMP can generate artificial functions that have
+         parameters that refer to pointers to unnamed typedefs.
+         See https://bugs.kde.org/show_bug.cgi?id=273475
+         So we cannot require a name for a DW_TAG_typedef.
+      */
+      goto acquire_Type;
    }
 
    if (dtag == DW_TAG_subroutine_type) {
diff --git a/coregrind/m_debuginfo/tytypes.c b/coregrind/m_debuginfo/tytypes.c
index 05df456..0fde46b 100644
--- a/coregrind/m_debuginfo/tytypes.c
+++ b/coregrind/m_debuginfo/tytypes.c
@@ -265,8 +265,8 @@ void ML_(pp_TyEnt_C_ishly)( XArray* /* of TyEnt */ tyents,
          VG_(printf)("&&");
          break;
       case Te_TyEnum:
-         if (!ent->Te.TyEnum.name) goto unhandled;
-         VG_(printf)("enum %s", ent->Te.TyEnum.name);
+         VG_(printf)("enum %s", ent->Te.TyEnum.name ? ent->Te.TyEnum.name
+                                                    : "<anonymous>" );
          break;
       case Te_TyStOrUn:
          VG_(printf)("%s %s",
@@ -287,8 +287,8 @@ void ML_(pp_TyEnt_C_ishly)( XArray* /* of TyEnt */ tyents,
          }
          break;
       case Te_TyTyDef:
-         if (!ent->Te.TyTyDef.name) goto unhandled;
-         VG_(printf)("%s", ent->Te.TyTyDef.name);
+         VG_(printf)("%s", ent->Te.TyTyDef.name ? ent->Te.TyTyDef.name
+                                                : "<anonymous>" );
          break;
       case Te_TyFn:
          VG_(printf)("%s", "<function_type>");