Blame SOURCES/gdb-gnat-dwarf-crash-3of3.patch

01917d
http://sourceware.org/ml/gdb-patches/2014-02/msg00731.html
01917d
Subject: [patch] gdb_assert -> complaint for weird DWARF
01917d
01917d
01917d
--6TrnltStXW4iwmi0
01917d
Content-Type: text/plain; charset=us-ascii
01917d
Content-Disposition: inline
01917d
01917d
Hi,
01917d
01917d
PR 16581:
01917d
	GDB crash on inherit_abstract_dies infinite recursion
01917d
	https://sourceware.org/bugzilla/show_bug.cgi?id=16581
01917d
01917d
fixed crash from an infinite recursion.  But in rare cases the new code can
01917d
now gdb_assert() due to weird DWARF file.
01917d
01917d
I do not yet fully understand why the DWARF is as it is but just GDB should
01917d
never crash due to invalid DWARF anyway.  The "invalid" DWARF I see only in
01917d
Fedora GCC build, not in FSF GCC build, more info at:
01917d
	https://bugzilla.redhat.com/show_bug.cgi?id=1069382
01917d
	http://people.redhat.com/jkratoch/gcc-debuginfo-4.8.2-7.fc20.x86_64-gnatbind.debug
01917d
01917d
01917d
Thanks,
01917d
Jan
01917d
01917d
--6TrnltStXW4iwmi0
01917d
Content-Type: text/plain; charset=us-ascii
01917d
Content-Disposition: inline; filename="complaint.patch"
01917d
01917d
gdb/
01917d
2014-02-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
01917d
01917d
	* dwarf2read.c (process_die): Change gdb_assert to complaint.
01917d
01917d
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
01917d
index 3eaa0b1..71f5d34 100644
01917d
--- a/gdb/dwarf2read.c
01917d
+++ b/gdb/dwarf2read.c
01917d
@@ -8029,7 +8029,13 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
01917d
   struct cleanup *in_process;
01917d
 
01917d
   /* We should only be processing those not already in process.  */
01917d
-  gdb_assert (!die->in_process);
01917d
+  if (die->in_process)
01917d
+    {
01917d
+      complaint (&symfile_complaints,
01917d
+		 _("DIE at 0x%x attempted to be processed twice"),
01917d
+		 die->offset.sect_off);
01917d
+      return;
01917d
+    }
01917d
 
01917d
   die->in_process = 1;
01917d
   in_process = make_cleanup (reset_die_in_process,die);
01917d
01917d
--6TrnltStXW4iwmi0--
01917d