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 5bb0f3b
Index: gdb-7.99.90.20170420/gdb/dwarf2read.c
Jan Kratochvil 5bb0f3b
===================================================================
Jan Kratochvil 5bb0f3b
--- gdb-7.99.90.20170420.orig/gdb/dwarf2read.c	2017-04-20 23:15:26.578897210 +0200
Jan Kratochvil 5bb0f3b
+++ gdb-7.99.90.20170420/gdb/dwarf2read.c	2017-04-20 23:15:57.805106371 +0200
Jan Kratochvil 5bb0f3b
@@ -8426,7 +8426,13 @@
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 5bb0f3b
+		 to_underlying (die->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);