[rfc] Skip unknown dwarf2 augmentation

Daniel Jacobowitz drow@false.org
Mon Nov 6 18:10:00 GMT 2006


The latest ARM compiler uses an augmentation to indicate that the
interpretation of several fields have changed (they had the sign of
something backwards in earlier releases IIRC).  The augmentation is
"armcc+".

Right now loading such a binary produces a GDB internal error.  We load the
CIE, see the unknown augmentation, decide to discard the CIE, and then blow
up when we find an FDE referencing the discarded CIE.

This patch lets GDB assume that unknown augmentations have no additional
data unless we saw the GNU 'z' prefix.  Which is actually, IMVHO, a sound
assumption; GCC throws extra data in the CIE between existing fields, but I
can't find any language in DWARF to support that behavior.  It says that the
augmentation ought to be just a UTF-8 encoded string and makes no mention of
additional fields.

Thoughts on this patch?  I'd like to apply it, but I don't feel too strongly
about it; for the specific failure that prompted it, the right fix is to
teach GDB about the ARM compiler's augmentation directly, which I'll do
soon.

-- 
Daniel Jacobowitz
CodeSourcery

2006-11-06  Daniel Jacobowitz  <dan@codesourcery.com>

	* dwarf2-frame.c (decode_frame_entry_1): Skip unknown augmentations
	without skipping the CIE.

Index: dwarf2-frame.c
===================================================================
RCS file: /scratch/gcc/repos/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.63
diff -u -p -r1.63 dwarf2-frame.c
--- dwarf2-frame.c	28 May 2006 05:56:50 -0000	1.63
+++ dwarf2-frame.c	6 Nov 2006 18:01:48 -0000
@@ -1674,15 +1674,12 @@ decode_frame_entry_1 (struct comp_unit *
 	      augmentation++;
 	    }
 
-	  /* Otherwise we have an unknown augmentation.
-	     Bail out unless we saw a 'z' prefix.  */
+	  /* Otherwise we have an unknown augmentation.  Assume that either
+	     there is no augmentation data, or we saw a 'z' prefix.  */
 	  else
 	    {
-	      if (cie->initial_instructions == NULL)
-		return end;
-
-	      /* Skip unknown augmentations.  */
-	      buf = cie->initial_instructions;
+	      if (cie->initial_instructions)
+		buf = cie->initial_instructions;
 	      break;
 	    }
 	}



More information about the Gdb-patches mailing list