Author: sewardj
Date: 2008-02-26 00:38:38 +0000 (Tue, 26 Feb 2008)
New Revision: 7469

Log:
Tolerate (by ignoring) DW_AT_data_member_location in a DW_TAG_member
which is part of a DW_TAG_union_type.



Modified:
   branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c


Modified: branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c        2008-02-26 
00:37:24 UTC (rev 7468)
+++ branches/DATASYMS/coregrind/m_debuginfo/readdwarf3.c        2008-02-26 
00:38:38 UTC (rev 7469)
@@ -2132,7 +2132,10 @@
       if (parser->qparent[parser->sp]->tag != Ty_StOrUn) goto bad_DIE;
       /* Do we have something that looks sane?  If this a member of a
          struct, we must have a location expression; but if a member
-         of a union that is irrelevant and so we reject it. */
+         of a union that is irrelevant (D3 spec sec 5.6.6).  We ought
+         to reject in the latter case, but some compilers have been
+         observed to emit constant-zero expressions.  So just ignore
+         them. */
       parent_is_struct
          = parser->qparent[parser->sp]->Ty.StOrUn.isStruct;
       if (!field->name)
@@ -2141,8 +2144,12 @@
          goto bad_DIE;
       if (parent_is_struct && (!expr))
          goto bad_DIE;
-      if ((!parent_is_struct) && expr)
-         goto bad_DIE;
+      if ((!parent_is_struct) && expr) {
+         /* If this is a union type, pretend we haven't seen the data
+            member location expression, as it is by definition
+            redundant (it must be zero). */
+         expr = NULL;
+      }
       /* Record this child in the parent */
       field->isStruct = parent_is_struct;
       if (expr)


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to