[gdb/f20] Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).

Jan Kratochvil jankratochvil at fedoraproject.org
Mon Feb 24 22:26:35 UTC 2014


commit 1ec4463ac77482c4555de152567156a8c6f3ee5a
Author: Jan Kratochvil <jan.kratochvil at redhat.com>
Date:   Mon Feb 24 22:54:23 2014 +0100

    Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).

 gdb-gnat-dwarf-crash-1of3.patch |  451 +++++++++++++++++++++++++++++++++++++++
 gdb-gnat-dwarf-crash-2of3.patch |  125 +++++++++++
 gdb-gnat-dwarf-crash-3of3.patch |   58 +++++
 gdb.spec                        |   13 +-
 4 files changed, 646 insertions(+), 1 deletions(-)
---
diff --git a/gdb-gnat-dwarf-crash-1of3.patch b/gdb-gnat-dwarf-crash-1of3.patch
new file mode 100644
index 0000000..efad332
--- /dev/null
+++ b/gdb-gnat-dwarf-crash-1of3.patch
@@ -0,0 +1,451 @@
+commit adde2bff0757e89175ede493f03b86953d0d9352
+Author: Doug Evans <xdje42 at gmail.com>
+Date:   Thu Feb 20 09:13:53 2014 -0800
+
+    Fix PR symtab/16581
+    
+    	* dwarf2read.c (struct die_info): New member in_process.
+    	(reset_die_in_process): New function.
+    	(process_die): Set it at the start, reset when returning.
+    	(inherit_abstract_dies): Only call process_die if origin_child_die
+    	not already being processed.
+    
+    	testsuite/
+    	* gdb.dwarf2/dw2-icycle.S: New file.
+    	* gdb.dwarf2/dw2-icycle.c: New file.
+    	* gdb.dwarf2/dw2-icycle.exp: New file.
+
+### a/gdb/ChangeLog
+### b/gdb/ChangeLog
+## -1,3 +1,14 @@
++2014-02-20  lin zuojian  <manjian2006 at gmail.com>
++	    Joel Brobecker  <brobecker at adacore.com>
++	    Doug Evans  <xdje42 at gmail.com>
++
++	PR symtab/16581
++	* dwarf2read.c (struct die_info): New member in_process.
++	(reset_die_in_process): New function.
++	(process_die): Set it at the start, reset when returning.
++	(inherit_abstract_dies): Only call process_die if origin_child_die
++	not already being processed.
++
+ 2014-02-20  Joel Brobecker  <brobecker at adacore.com>
+ 
+ 	* windows-nat.c (handle_unload_dll): Add function documentation.
+--- a/gdb/dwarf2read.c
++++ b/gdb/dwarf2read.c
+@@ -1225,6 +1225,9 @@ struct die_info
+        type derived from this DIE.  */
+     unsigned char building_fullname : 1;
+ 
++    /* True if this die is in process.  PR 16581.  */
++    unsigned char in_process : 1;
++
+     /* Abbrev number */
+     unsigned int abbrev;
+ 
+@@ -8008,11 +8011,28 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
+     }
+ }
+ 
++/* Reset the in_process bit of a die.  */
++
++static void
++reset_die_in_process (void *arg)
++{
++  struct die_info *die = arg;
++  die->in_process = 0;
++}
++
+ /* Process a die and its children.  */
+ 
+ static void
+ process_die (struct die_info *die, struct dwarf2_cu *cu)
+ {
++  struct cleanup *in_process;
++
++  /* We should only be processing those not already in process.  */
++  gdb_assert (!die->in_process);
++
++  die->in_process = 1;
++  in_process = make_cleanup (reset_die_in_process,die);
++
+   switch (die->tag)
+     {
+     case DW_TAG_padding:
+@@ -7762,6 +7782,8 @@ process_die (struct die_info *die, struc
+       new_symbol (die, NULL, cu);
+       break;
+     }
++
++  do_cleanups (in_process);
+ }
+ 
+ /* DWARF name computation.  */
+@@ -10967,8 +10989,12 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
+       if (offsetp >= offsets_end
+ 	  || offsetp->sect_off > origin_child_die->offset.sect_off)
+ 	{
+-	  /* Found that ORIGIN_CHILD_DIE is really not referenced.  */
+-	  process_die (origin_child_die, origin_cu);
++	  /* Found that ORIGIN_CHILD_DIE is really not referenced.
++	     Check whether we're already processing ORIGIN_CHILD_DIE.
++	     This can happen with mutually referenced abstract_origins.
++	     PR 16581.  */
++	  if (!origin_child_die->in_process)
++	    process_die (origin_child_die, origin_cu);
+ 	}
+       origin_child_die = sibling_die (origin_child_die);
+     }
+### a/gdb/testsuite/ChangeLog
+### b/gdb/testsuite/ChangeLog
+## -1,3 +1,12 @@
++2014-02-20  lin zuojian  <manjian2006 at gmail.com>
++	    Joel Brobecker  <brobecker at adacore.com>
++	    Doug Evans  <xdje42 at gmail.com>
++
++	PR symtab/16581
++	* gdb.dwarf2/dw2-icycle.S: New file.
++	* gdb.dwarf2/dw2-icycle.c: New file.
++	* gdb.dwarf2/dw2-icycle.exp: New file.
++
+ 2014-02-19  Siva Chandra Reddy  <sivachandra at google.com>
+ 
+ 	* gdb.python/py-value-cc.cc: Improve test case to enable testing
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
+@@ -0,0 +1,258 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2014 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++	.text
++
++.Ltext0:
++	.type	p__top__middle__inside.3062, @function
++p__top__middle__inside.3062:
++.LFB4:
++	.file 1 "p.adb"
++        .4byte 0
++.LBE6:
++
++	.globl	p__top
++	.type	p__top, @function
++p__top:
++.LFB2:
++        .4byte 0
++.LFE2:
++.Letext0:
++
++	.section	.debug_info,"", at progbits
++.Ldebug_info0:
++	.4byte	.Ledebug_info0 - .Lsdebug_info0  /* Length of CU Info */
++.Lsdebug_info0:
++	.2byte	0x4	/* DWARF version number */
++	.4byte	.Ldebug_abbrev0	/* Offset Into Abbrev. Section */
++	.byte	0x4	/* Pointer Size (in bytes) */
++	.uleb128 0x1	/* (DIE (0xb) DW_TAG_compile_unit) */
++	.ascii	"GNU Ada 4.9.0 20140126\0" /* DW_AT_producer */
++	.byte	0xd	/* DW_AT_language */
++	.ascii	"p.adb\0" /* DW_AT_name */
++	.ascii	"/tmp\0"  /* DW_AT_comp_dir */
++	.4byte	.Ltext0	/* DW_AT_low_pc */
++	.4byte	.Letext0-.Ltext0	/* DW_AT_high_pc */
++.S0x142:
++	.uleb128 0x8	/* (DIE (0x142) DW_TAG_base_type) */
++	.byte	0x4	/* DW_AT_byte_size */
++	.byte	0x5	/* DW_AT_encoding */
++	.ascii	"integer\0" /* DW_AT_name */
++
++	.uleb128 0x13	/* (DIE (0x1b4) DW_TAG_subprogram) */
++			/* DW_AT_external */
++	.ascii	"p__top\0" /* DW_AT_name */
++	.byte	0x1	/* DW_AT_decl_file (p.adb) */
++	.byte	0x3	/* DW_AT_decl_line */
++	.4byte	.LFB2	/* DW_AT_low_pc */
++	.4byte	.LFE2-.LFB2	/* DW_AT_high_pc */
++	.uleb128 0x1	/* DW_AT_frame_base */
++	.byte	0x9c	/* DW_OP_call_frame_cfa */
++			/* DW_AT_GNU_all_call_sites */
++	.4byte	.S0x4fc - .Ldebug_info0	/* DW_AT_sibling */
++.S0x1e0:
++	.uleb128 0x15	/* (DIE (0x1e0) DW_TAG_subprogram) */
++	.ascii	"p__top__middle\0" /* DW_AT_name */
++	.byte	0x1	/* DW_AT_decl_file (p.adb) */
++	.byte	0x4	/* DW_AT_decl_line */
++	.byte	0x1	/* DW_AT_inline */
++	.4byte	.S0x374 - .Ldebug_info0	/* DW_AT_sibling */
++.S0x202:
++	.uleb128 0x15	/* (DIE (0x202) DW_TAG_subprogram) */
++	.ascii	"p__top__middle__inside\0" /* DW_AT_name */
++	.byte	0x1	/* DW_AT_decl_file (p.adb) */
++	.byte	0x5	/* DW_AT_decl_line */
++	.byte	0x1	/* DW_AT_inline */
++	.4byte	.S0x225	- .Ldebug_info0 /* DW_AT_sibling */
++	.byte	0	/* end of children of DIE 0x202 */
++.S0x225:
++	.uleb128 0x18	/* (DIE (0x225) DW_TAG_subprogram) */
++	.4byte	.S0x202 - .Ldebug_info0	/* DW_AT_abstract_origin */
++	.4byte	.LFB4	/* DW_AT_low_pc */
++	.4byte	.LBE6-.LFB4	/* DW_AT_high_pc */
++	.uleb128 0x1	/* DW_AT_frame_base */
++	.byte	0x9c	/* DW_OP_call_frame_cfa */
++	.uleb128 0x1	/* DW_AT_static_link */
++	.byte	0x56	/* DW_OP_reg6 */
++			/* DW_AT_GNU_all_call_sites */
++	.uleb128 0x1a	/* (DIE (0x247) DW_TAG_inlined_subroutine) */
++	.4byte	.S0x1e0 - .Ldebug_info0	/* DW_AT_abstract_origin */
++	.4byte	.LFB4	/* DW_AT_low_pc */
++	.4byte	.LBE6-.LFB4	/* DW_AT_high_pc */
++	.byte	0x1	/* DW_AT_call_file (p.adb) */
++	.byte	0x14	/* DW_AT_call_line */
++	.4byte	.S0x374	- .Ldebug_info0 /* DW_AT_sibling */
++	.byte	0	/* end of children of DIE 0x247 */
++	.byte	0	/* end of children of DIE 0x225 */
++	.byte	0	/* end of children of DIE 0x1e0 */
++.S0x374:
++	.uleb128 0x23	/* (DIE (0x382) DW_TAG_inlined_subroutine) */
++	.4byte	.S0x1e0 - .Ldebug_info0 /* DW_AT_abstract_origin */
++	.4byte	.LFB4	/* DW_AT_low_pc */
++	.4byte	.LBE6-.LFB4	/* DW_AT_high_pc */
++	.byte	0x1	/* DW_AT_call_file (p.adb) */
++	.byte	0x1d	/* DW_AT_call_line */
++	.byte	0	/* end of children of DIE 0x382 */
++	.byte	0	/* end of children of DIE 0x1b4 */
++.S0x4fc:
++	.uleb128 0x28	/* (DIE (0x52e) DW_TAG_subprogram) */
++			/* DW_AT_external */
++	.ascii	"__gnat_rcheck_PE_Explicit_Raise\0" /* DW_AT_name */
++			/* DW_AT_artificial */
++			/* DW_AT_declaration */
++	.byte	0	/* end of children of DIE 0x52e */
++	.byte	0	/* end of children of DIE 0xb */
++.Ledebug_info0:
++
++	.section	.debug_abbrev,"", at progbits
++.Ldebug_abbrev0:
++	.uleb128 0x1	/* (abbrev code) */
++	.uleb128 0x11	/* (TAG: DW_TAG_compile_unit) */
++	.byte	0x1	/* DW_children_yes */
++	.uleb128 0x25	/* (DW_AT_producer) */
++	.uleb128 0x8	/* (DW_FORM_string) */
++	.uleb128 0x13	/* (DW_AT_language) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x3	/* (DW_AT_name) */
++	.uleb128 0x8	/* (DW_FORM_string) */
++	.uleb128 0x1b	/* (DW_AT_comp_dir) */
++	.uleb128 0x8	/* (DW_FORM_string) */
++	.uleb128 0x11	/* (DW_AT_low_pc) */
++	.uleb128 0x1	/* (DW_FORM_addr) */
++	.uleb128 0x12	/* (DW_AT_high_pc) */
++	.uleb128 0x6	/* (DW_FORM_data4) */
++	.byte	0
++	.byte	0
++	.uleb128 0x8	/* (abbrev code) */
++	.uleb128 0x24	/* (TAG: DW_TAG_base_type) */
++	.byte	0	/* DW_children_no */
++	.uleb128 0xb	/* (DW_AT_byte_size) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x3e	/* (DW_AT_encoding) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x3	/* (DW_AT_name) */
++	.uleb128 0x8	/* (DW_FORM_string) */
++	.byte	0
++	.byte	0
++	.uleb128 0x13	/* (abbrev code) */
++	.uleb128 0x2e	/* (TAG: DW_TAG_subprogram) */
++	.byte	0x1	/* DW_children_yes */
++	.uleb128 0x3f	/* (DW_AT_external) */
++	.uleb128 0x19	/* (DW_FORM_flag_present) */
++	.uleb128 0x3	/* (DW_AT_name) */
++	.uleb128 0x8	/* (DW_FORM_string) */
++	.uleb128 0x3a	/* (DW_AT_decl_file) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x3b	/* (DW_AT_decl_line) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x11	/* (DW_AT_low_pc) */
++	.uleb128 0x1	/* (DW_FORM_addr) */
++	.uleb128 0x12	/* (DW_AT_high_pc) */
++	.uleb128 0x6	/* (DW_FORM_data4) */
++	.uleb128 0x40	/* (DW_AT_frame_base) */
++	.uleb128 0x18	/* (DW_FORM_exprloc) */
++	.uleb128 0x2117	/* (DW_AT_GNU_all_call_sites) */
++	.uleb128 0x19	/* (DW_FORM_flag_present) */
++	.uleb128 0x1	/* (DW_AT_sibling) */
++	.uleb128 0x13	/* (DW_FORM_ref4) */
++	.byte	0
++	.byte	0
++	.uleb128 0x15	/* (abbrev code) */
++	.uleb128 0x2e	/* (TAG: DW_TAG_subprogram) */
++	.byte	0x1	/* DW_children_yes */
++	.uleb128 0x3	/* (DW_AT_name) */
++	.uleb128 0x8	/* (DW_FORM_string) */
++	.uleb128 0x3a	/* (DW_AT_decl_file) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x3b	/* (DW_AT_decl_line) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x20	/* (DW_AT_inline) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x1	/* (DW_AT_sibling) */
++	.uleb128 0x13	/* (DW_FORM_ref4) */
++	.byte	0
++	.byte	0
++	.uleb128 0x18	/* (abbrev code) */
++	.uleb128 0x2e	/* (TAG: DW_TAG_subprogram) */
++	.byte	0x1	/* DW_children_yes */
++	.uleb128 0x31	/* (DW_AT_abstract_origin) */
++	.uleb128 0x13	/* (DW_FORM_ref4) */
++	.uleb128 0x11	/* (DW_AT_low_pc) */
++	.uleb128 0x1	/* (DW_FORM_addr) */
++	.uleb128 0x12	/* (DW_AT_high_pc) */
++	.uleb128 0x6	/* (DW_FORM_data4) */
++	.uleb128 0x40	/* (DW_AT_frame_base) */
++	.uleb128 0x18	/* (DW_FORM_exprloc) */
++	.uleb128 0x48	/* (DW_AT_static_link) */
++	.uleb128 0x18	/* (DW_FORM_exprloc) */
++	.uleb128 0x2117	/* (DW_AT_GNU_all_call_sites) */
++	.uleb128 0x19	/* (DW_FORM_flag_present) */
++	.byte	0
++	.byte	0
++	.uleb128 0x1a	/* (abbrev code) */
++	.uleb128 0x1d	/* (TAG: DW_TAG_inlined_subroutine) */
++	.byte	0x1	/* DW_children_yes */
++	.uleb128 0x31	/* (DW_AT_abstract_origin) */
++	.uleb128 0x13	/* (DW_FORM_ref4) */
++	.uleb128 0x11	/* (DW_AT_low_pc) */
++	.uleb128 0x1	/* (DW_FORM_addr) */
++	.uleb128 0x12	/* (DW_AT_high_pc) */
++	.uleb128 0x6	/* (DW_FORM_data4) */
++	.uleb128 0x58	/* (DW_AT_call_file) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x59	/* (DW_AT_call_line) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x1	/* (DW_AT_sibling) */
++	.uleb128 0x13	/* (DW_FORM_ref4) */
++	.byte	0
++	.byte	0
++	.uleb128 0x23	/* (abbrev code) */
++	.uleb128 0x1d	/* (TAG: DW_TAG_inlined_subroutine) */
++	.byte	0x1	/* DW_children_yes */
++	.uleb128 0x31	/* (DW_AT_abstract_origin) */
++	.uleb128 0x13	/* (DW_FORM_ref4) */
++	.uleb128 0x11	/* (DW_AT_low_pc) */
++	.uleb128 0x1	/* (DW_FORM_addr) */
++	.uleb128 0x12	/* (DW_AT_high_pc) */
++	.uleb128 0x6	/* (DW_FORM_data4) */
++	.uleb128 0x58	/* (DW_AT_call_file) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.uleb128 0x59	/* (DW_AT_call_line) */
++	.uleb128 0xb	/* (DW_FORM_data1) */
++	.byte	0
++	.byte	0
++	.uleb128 0x28	/* (abbrev code) */
++	.uleb128 0x2e	/* (TAG: DW_TAG_subprogram) */
++	.byte	0x1	/* DW_children_yes */
++	.uleb128 0x3f	/* (DW_AT_external) */
++	.uleb128 0x19	/* (DW_FORM_flag_present) */
++	.uleb128 0x3	/* (DW_AT_name) */
++	.uleb128 0x8	/* (DW_FORM_string) */
++	.uleb128 0x34	/* (DW_AT_artificial) */
++	.uleb128 0x19	/* (DW_FORM_flag_present) */
++	.uleb128 0x3c	/* (DW_AT_declaration) */
++	.uleb128 0x19	/* (DW_FORM_flag_present) */
++	.byte	0
++	.byte	0
++	.byte	0
++	.byte	0
++	.byte	0
++
++        .section .debug_line
++.Lline1_begin:
++        .byte   0
++
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.c
+@@ -0,0 +1,24 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2004-2014 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++/* Dummy main function.  */
++
++int
++main()
++{
++  return 0;
++}
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
+@@ -0,0 +1,46 @@
++# Copyright 2014 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# This test exercises PR 16581.
++
++load_lib dwarf.exp
++
++# This test can only be run on targets which support DWARF-2 and use gas.
++if {![dwarf2_support]} {
++    return 0
++}
++
++standard_testfile .S .c
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} \
++	  [list $srcfile $srcfile2] {nodebug}] } {
++    return -1
++}
++
++# We are trying to verify that the partial symtab to symtab expansion
++# for the debugging info hand-coded in our assembly file does not cause
++# the debugger to crash (infinite recursion).  To facilitate the test,
++# start the debugger with -readnow.  This force expansion as soon as
++# the objfile is loaded.
++
++set saved_gdbflags $GDBFLAGS
++set GDBFLAGS "$GDBFLAGS -readnow"
++clean_restart ${testfile}
++set GDBFLAGS $saved_gdbflags
++
++# And just to be sure that the debugger did not crash after having
++# expanded our symbols, do a life-check.
++
++gdb_test "echo life check\\n" "life check"
diff --git a/gdb-gnat-dwarf-crash-2of3.patch b/gdb-gnat-dwarf-crash-2of3.patch
new file mode 100644
index 0000000..32f0259
--- /dev/null
+++ b/gdb-gnat-dwarf-crash-2of3.patch
@@ -0,0 +1,125 @@
+http://sourceware.org/ml/gdb-patches/2014-02/msg00729.html
+Subject: [patch] [testsuite] Fix dw2-icycle.exp -fsanitize=address GDB crash
+
+
+--WIyZ46R2i8wDzkSu
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+
+Hi Doug,
+
+in fact obvious, I will check it in.
+
+binutils readelf -wi:
+ <4><a2>: Abbrev Number: 26 (DW_TAG_inlined_subroutine)
+    <a3>   DW_AT_abstract_origin: <0x5a>
+    <a7>   DW_AT_low_pc      : 0x400590
+    <ab>   DW_AT_high_pc     : 0x4
+    <af>   DW_AT_call_file   : 1
+    <b0>   DW_AT_call_line   : 20
+    <b1>   DW_AT_sibling     : <0xb8>
+ <2><b8>: Abbrev Number: 35 (DW_TAG_inlined_subroutine)
+    <b9>   DW_AT_abstract_origin: <0x5a>
+    <bd>   DW_AT_low_pc      : 0x400590
+    <c1>   DW_AT_high_pc     : 0x4
+    <c5>   DW_AT_call_file   : 1
+    <c6>   DW_AT_call_line   : 29
+
+<b1> DW_AT_sibling points to the next DIE - but that DIE is 2 levels
+upwards - definitely not a sibling.  This confuses GDB up to a crash:
+
+==32143== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6024000198ac at pc 0xb4d104 bp 0x7fff63e96e70 sp 0x7fff63e96e60
+READ of size 1 at 0x6024000198ac thread T0
+    #0 0xb4d103 in read_unsigned_leb128 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb4d103)
+    #1 0xb15f3c in peek_die_abbrev (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb15f3c)
+    #2 0xb46185 in load_partial_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb46185)
+    #3 0xb103fb in process_psymtab_comp_unit_reader (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb103fb)
+    #4 0xb0d2a9 in init_cutu_and_read_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb0d2a9)
+    #5 0xb1115f in process_psymtab_comp_unit (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1115f)
+    #6 0xb1235f in dwarf2_build_psymtabs_hard (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1235f)
+    #7 0xb05536 in dwarf2_build_psymtabs (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb05536)
+    #8 0x86d5a5 in read_psyms (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x86d5a5)
+    #9 0x9b1c37 in require_partial_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9b1c37)
+    #10 0x9bf2d0 in read_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9bf2d0)
+    #11 0x9c014c in syms_from_objfile_1 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9c014c)
+
+I have added === Delete all DW_AT_sibling ===:
+	https://sourceware.org/gdb/wiki/GDBTestcaseCookbook?action=diff&rev2=31&rev1=30
+
+
+Jan
+
+--WIyZ46R2i8wDzkSu
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline; filename="sibling.patch"
+
+gdb/testsuite/
+2014-02-24  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	Fix dw2-icycle.exp -fsanitize=address GDB crash.
+	* gdb.dwarf2/dw2-icycle.S: Remove all DW_AT_sibling.
+
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
+index 1f84e4a..938ff20 100644
+--- a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
++++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
+@@ -63,21 +63,18 @@ p__top:
+ 	.uleb128 0x1	/* DW_AT_frame_base */
+ 	.byte	0x9c	/* DW_OP_call_frame_cfa */
+ 			/* DW_AT_GNU_all_call_sites */
+-	.4byte	.S0x4fc - .Ldebug_info0	/* DW_AT_sibling */
+ .S0x1e0:
+ 	.uleb128 0x15	/* (DIE (0x1e0) DW_TAG_subprogram) */
+ 	.ascii	"p__top__middle\0" /* DW_AT_name */
+ 	.byte	0x1	/* DW_AT_decl_file (p.adb) */
+ 	.byte	0x4	/* DW_AT_decl_line */
+ 	.byte	0x1	/* DW_AT_inline */
+-	.4byte	.S0x374 - .Ldebug_info0	/* DW_AT_sibling */
+ .S0x202:
+ 	.uleb128 0x15	/* (DIE (0x202) DW_TAG_subprogram) */
+ 	.ascii	"p__top__middle__inside\0" /* DW_AT_name */
+ 	.byte	0x1	/* DW_AT_decl_file (p.adb) */
+ 	.byte	0x5	/* DW_AT_decl_line */
+ 	.byte	0x1	/* DW_AT_inline */
+-	.4byte	.S0x225	- .Ldebug_info0 /* DW_AT_sibling */
+ 	.byte	0	/* end of children of DIE 0x202 */
+ .S0x225:
+ 	.uleb128 0x18	/* (DIE (0x225) DW_TAG_subprogram) */
+@@ -95,7 +92,6 @@ p__top:
+ 	.4byte	.LBE6-.LFB4	/* DW_AT_high_pc */
+ 	.byte	0x1	/* DW_AT_call_file (p.adb) */
+ 	.byte	0x14	/* DW_AT_call_line */
+-	.4byte	.S0x374	- .Ldebug_info0 /* DW_AT_sibling */
+ 	.byte	0	/* end of children of DIE 0x247 */
+ 	.byte	0	/* end of children of DIE 0x225 */
+ 	.byte	0	/* end of children of DIE 0x1e0 */
+@@ -167,8 +163,6 @@ p__top:
+ 	.uleb128 0x18	/* (DW_FORM_exprloc) */
+ 	.uleb128 0x2117	/* (DW_AT_GNU_all_call_sites) */
+ 	.uleb128 0x19	/* (DW_FORM_flag_present) */
+-	.uleb128 0x1	/* (DW_AT_sibling) */
+-	.uleb128 0x13	/* (DW_FORM_ref4) */
+ 	.byte	0
+ 	.byte	0
+ 	.uleb128 0x15	/* (abbrev code) */
+@@ -182,8 +176,6 @@ p__top:
+ 	.uleb128 0xb	/* (DW_FORM_data1) */
+ 	.uleb128 0x20	/* (DW_AT_inline) */
+ 	.uleb128 0xb	/* (DW_FORM_data1) */
+-	.uleb128 0x1	/* (DW_AT_sibling) */
+-	.uleb128 0x13	/* (DW_FORM_ref4) */
+ 	.byte	0
+ 	.byte	0
+ 	.uleb128 0x18	/* (abbrev code) */
+@@ -216,8 +208,6 @@ p__top:
+ 	.uleb128 0xb	/* (DW_FORM_data1) */
+ 	.uleb128 0x59	/* (DW_AT_call_line) */
+ 	.uleb128 0xb	/* (DW_FORM_data1) */
+-	.uleb128 0x1	/* (DW_AT_sibling) */
+-	.uleb128 0x13	/* (DW_FORM_ref4) */
+ 	.byte	0
+ 	.byte	0
+ 	.uleb128 0x23	/* (abbrev code) */
+
+--WIyZ46R2i8wDzkSu--
+
diff --git a/gdb-gnat-dwarf-crash-3of3.patch b/gdb-gnat-dwarf-crash-3of3.patch
new file mode 100644
index 0000000..3f57fd3
--- /dev/null
+++ b/gdb-gnat-dwarf-crash-3of3.patch
@@ -0,0 +1,58 @@
+http://sourceware.org/ml/gdb-patches/2014-02/msg00731.html
+Subject: [patch] gdb_assert -> complaint for weird DWARF
+
+
+--6TrnltStXW4iwmi0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+
+Hi,
+
+PR 16581:
+	GDB crash on inherit_abstract_dies infinite recursion
+	https://sourceware.org/bugzilla/show_bug.cgi?id=16581
+
+fixed crash from an infinite recursion.  But in rare cases the new code can
+now gdb_assert() due to weird DWARF file.
+
+I do not yet fully understand why the DWARF is as it is but just GDB should
+never crash due to invalid DWARF anyway.  The "invalid" DWARF I see only in
+Fedora GCC build, not in FSF GCC build, more info at:
+	https://bugzilla.redhat.com/show_bug.cgi?id=1069382
+	http://people.redhat.com/jkratoch/gcc-debuginfo-4.8.2-7.fc20.x86_64-gnatbind.debug
+
+
+Thanks,
+Jan
+
+--6TrnltStXW4iwmi0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline; filename="complaint.patch"
+
+gdb/
+2014-02-24  Jan Kratochvil  <jan.kratochvil at redhat.com>
+
+	* dwarf2read.c (process_die): Change gdb_assert to complaint.
+
+diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+index 3eaa0b1..71f5d34 100644
+--- a/gdb/dwarf2read.c
++++ b/gdb/dwarf2read.c
+@@ -8029,7 +8029,13 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
+   struct cleanup *in_process;
+ 
+   /* We should only be processing those not already in process.  */
+-  gdb_assert (!die->in_process);
++  if (die->in_process)
++    {
++      complaint (&symfile_complaints,
++		 _("DIE at 0x%x attempted to be processed twice"),
++		 die->offset.sect_off);
++      return;
++    }
+ 
+   die->in_process = 1;
+   in_process = make_cleanup (reset_die_in_process,die);
+
+--6TrnltStXW4iwmi0--
+
diff --git a/gdb.spec b/gdb.spec
index 4d5a30e..789b62f 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -38,7 +38,7 @@ Version: 7.6.50.%{snap}
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 20%{?dist}
+Release: 21%{?dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
 Group: Development/Debuggers
@@ -532,6 +532,11 @@ Patch844: gdb-rhbz1013453-value-struct-elt-memory-leak.patch
 # Fix explicit Class:: inside class scope (BZ 874817, Keith Seitz).
 Patch845: gdb-implicit-this.patch
 
+# Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).
+Patch850: gdb-gnat-dwarf-crash-1of3.patch
+Patch851: gdb-gnat-dwarf-crash-2of3.patch
+Patch852: gdb-gnat-dwarf-crash-3of3.patch
+
 %if 0%{!?rhel:1} || 0%{?rhel} > 6
 # RL_STATE_FEDORA_GDB would not be found for:
 # Patch642: gdb-readline62-ask-more-rh.patch
@@ -828,6 +833,9 @@ find -name "*.info*"|xargs rm -f
 %patch843 -p1
 %patch844 -p1
 %patch845 -p1
+%patch850 -p1
+%patch851 -p1
+%patch852 -p1
 
 %patch393 -p1
 %if 0%{!?el5:1} || 0%{?scl:1}
@@ -1346,6 +1354,9 @@ fi
 %endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
 
 %changelog
+* Mon Feb 24 2014 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.6.50.20140119-21.fc20
+- Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).
+
 * Thu Jan 23 2014 Jan Kratochvil <jan.kratochvil at redhat.com> - 7.6.50.20140119-20.fc20
 - [s390*,ppc*] Enable secondary targets s390* and ppc* (BZ 1056259).
 


More information about the scm-commits mailing list