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