Mark Wielaard 02fda2
commit 836b51a998fe520728aab7c5e1b156cadaa20c20
Mark Wielaard 02fda2
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Mark Wielaard 02fda2
Date:   Sun Nov 24 17:19:35 2013 +0000
Mark Wielaard 02fda2
Mark Wielaard 02fda2
    Bug 327916 - DW_TAG_typedef may have no name
Mark Wielaard 02fda2
    
Mark Wielaard 02fda2
    We already accepted DW_TAG_typedef without a name for Ada. But g++ for
Mark Wielaard 02fda2
    OpenMP can also emit such nameless DW_TAG_typedefs. Just accept them.
Mark Wielaard 02fda2
    Also fix up anonymous enum and typedef printing in tytypes.c.
Mark Wielaard 02fda2
    
Mark Wielaard 02fda2
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13718 a5019735-40e9-0310-863c-91ae7b9d1cf9
Mark Wielaard 02fda2
Mark Wielaard 02fda2
diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c
Mark Wielaard 02fda2
index b0a7a92..f64a97b 100644
Mark Wielaard 02fda2
--- a/coregrind/m_debuginfo/readdwarf3.c
Mark Wielaard 02fda2
+++ b/coregrind/m_debuginfo/readdwarf3.c
Mark Wielaard 02fda2
@@ -2926,19 +2926,17 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
Mark Wielaard 02fda2
                = cook_die_using_form( cc, (UWord)cts.u.val, form );
Mark Wielaard 02fda2
          }
Mark Wielaard 02fda2
       }
Mark Wielaard 02fda2
-      /* Do we have something that looks sane? */
Mark Wielaard 02fda2
-      if (/* must have a name */
Mark Wielaard 02fda2
-          typeE.Te.TyTyDef.name == NULL
Mark Wielaard 02fda2
-          /* However gcc gnat Ada generates minimal typedef
Mark Wielaard 02fda2
-             such as the below => accept no name for Ada.
Mark Wielaard 02fda2
-             <6><91cc>: DW_TAG_typedef
Mark Wielaard 02fda2
-                DW_AT_abstract_ori: <9066>
Mark Wielaard 02fda2
-          */
Mark Wielaard 02fda2
-          && parser->language != 'A'
Mark Wielaard 02fda2
-          /* but the referred-to type can be absent */)
Mark Wielaard 02fda2
-         goto bad_DIE;
Mark Wielaard 02fda2
-      else
Mark Wielaard 02fda2
-         goto acquire_Type;
Mark Wielaard 02fda2
+      /* Do we have something that looks sane?
Mark Wielaard 02fda2
+         gcc gnat Ada generates minimal typedef
Mark Wielaard 02fda2
+         such as the below
Mark Wielaard 02fda2
+         <6><91cc>: DW_TAG_typedef
Mark Wielaard 02fda2
+            DW_AT_abstract_ori: <9066>
Mark Wielaard 02fda2
+         g++ for OMP can generate artificial functions that have
Mark Wielaard 02fda2
+         parameters that refer to pointers to unnamed typedefs.
Mark Wielaard 02fda2
+         See https://bugs.kde.org/show_bug.cgi?id=273475
Mark Wielaard 02fda2
+         So we cannot require a name for a DW_TAG_typedef.
Mark Wielaard 02fda2
+      */
Mark Wielaard 02fda2
+      goto acquire_Type;
Mark Wielaard 02fda2
    }
Mark Wielaard 02fda2
 
Mark Wielaard 02fda2
    if (dtag == DW_TAG_subroutine_type) {
Mark Wielaard 02fda2
diff --git a/coregrind/m_debuginfo/tytypes.c b/coregrind/m_debuginfo/tytypes.c
Mark Wielaard 02fda2
index 05df456..0fde46b 100644
Mark Wielaard 02fda2
--- a/coregrind/m_debuginfo/tytypes.c
Mark Wielaard 02fda2
+++ b/coregrind/m_debuginfo/tytypes.c
Mark Wielaard 02fda2
@@ -265,8 +265,8 @@ void ML_(pp_TyEnt_C_ishly)( XArray* /* of TyEnt */ tyents,
Mark Wielaard 02fda2
          VG_(printf)("&&";;
Mark Wielaard 02fda2
          break;
Mark Wielaard 02fda2
       case Te_TyEnum:
Mark Wielaard 02fda2
-         if (!ent->Te.TyEnum.name) goto unhandled;
Mark Wielaard 02fda2
-         VG_(printf)("enum %s", ent->Te.TyEnum.name);
Mark Wielaard 02fda2
+         VG_(printf)("enum %s", ent->Te.TyEnum.name ? ent->Te.TyEnum.name
Mark Wielaard 02fda2
+                                                    : "<anonymous>" );
Mark Wielaard 02fda2
          break;
Mark Wielaard 02fda2
       case Te_TyStOrUn:
Mark Wielaard 02fda2
          VG_(printf)("%s %s",
Mark Wielaard 02fda2
@@ -287,8 +287,8 @@ void ML_(pp_TyEnt_C_ishly)( XArray* /* of TyEnt */ tyents,
Mark Wielaard 02fda2
          }
Mark Wielaard 02fda2
          break;
Mark Wielaard 02fda2
       case Te_TyTyDef:
Mark Wielaard 02fda2
-         if (!ent->Te.TyTyDef.name) goto unhandled;
Mark Wielaard 02fda2
-         VG_(printf)("%s", ent->Te.TyTyDef.name);
Mark Wielaard 02fda2
+         VG_(printf)("%s", ent->Te.TyTyDef.name ? ent->Te.TyTyDef.name
Mark Wielaard 02fda2
+                                                : "<anonymous>" );
Mark Wielaard 02fda2
          break;
Mark Wielaard 02fda2
       case Te_TyFn:
Mark Wielaard 02fda2
          VG_(printf)("%s", "<function_type>");