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

8c62a9
http://sourceware.org/ml/gdb-patches/2014-02/msg00729.html
8c62a9
Subject: [patch] [testsuite] Fix dw2-icycle.exp -fsanitize=address GDB crash
8c62a9
8c62a9
8c62a9
--WIyZ46R2i8wDzkSu
8c62a9
Content-Type: text/plain; charset=us-ascii
8c62a9
Content-Disposition: inline
8c62a9
8c62a9
Hi Doug,
8c62a9
8c62a9
in fact obvious, I will check it in.
8c62a9
8c62a9
binutils readelf -wi:
8c62a9
 <4><a2>: Abbrev Number: 26 (DW_TAG_inlined_subroutine)
8c62a9
    <a3>   DW_AT_abstract_origin: <0x5a>
8c62a9
    <a7>   DW_AT_low_pc      : 0x400590
8c62a9
    <ab>   DW_AT_high_pc     : 0x4
8c62a9
    <af>   DW_AT_call_file   : 1
8c62a9
    <b0>   DW_AT_call_line   : 20
8c62a9
    <b1>   DW_AT_sibling     : <0xb8>
8c62a9
 <2><b8>: Abbrev Number: 35 (DW_TAG_inlined_subroutine)
8c62a9
    <b9>   DW_AT_abstract_origin: <0x5a>
8c62a9
    <bd>   DW_AT_low_pc      : 0x400590
8c62a9
    <c1>   DW_AT_high_pc     : 0x4
8c62a9
    <c5>   DW_AT_call_file   : 1
8c62a9
    <c6>   DW_AT_call_line   : 29
8c62a9
8c62a9
<b1> DW_AT_sibling points to the next DIE - but that DIE is 2 levels
8c62a9
upwards - definitely not a sibling.  This confuses GDB up to a crash:
8c62a9
8c62a9
==32143== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6024000198ac at pc 0xb4d104 bp 0x7fff63e96e70 sp 0x7fff63e96e60
8c62a9
READ of size 1 at 0x6024000198ac thread T0
8c62a9
    #0 0xb4d103 in read_unsigned_leb128 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb4d103)
8c62a9
    #1 0xb15f3c in peek_die_abbrev (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb15f3c)
8c62a9
    #2 0xb46185 in load_partial_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb46185)
8c62a9
    #3 0xb103fb in process_psymtab_comp_unit_reader (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb103fb)
8c62a9
    #4 0xb0d2a9 in init_cutu_and_read_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb0d2a9)
8c62a9
    #5 0xb1115f in process_psymtab_comp_unit (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1115f)
8c62a9
    #6 0xb1235f in dwarf2_build_psymtabs_hard (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1235f)
8c62a9
    #7 0xb05536 in dwarf2_build_psymtabs (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb05536)
8c62a9
    #8 0x86d5a5 in read_psyms (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x86d5a5)
8c62a9
    #9 0x9b1c37 in require_partial_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9b1c37)
8c62a9
    #10 0x9bf2d0 in read_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9bf2d0)
8c62a9
    #11 0x9c014c in syms_from_objfile_1 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9c014c)
8c62a9
8c62a9
I have added === Delete all DW_AT_sibling ===:
8c62a9
	https://sourceware.org/gdb/wiki/GDBTestcaseCookbook?action=diff&rev2=31&rev1=30
8c62a9
8c62a9
8c62a9
Jan
8c62a9
8c62a9
--WIyZ46R2i8wDzkSu
8c62a9
Content-Type: text/plain; charset=us-ascii
8c62a9
Content-Disposition: inline; filename="sibling.patch"
8c62a9
8c62a9
gdb/testsuite/
8c62a9
2014-02-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
8c62a9
8c62a9
	Fix dw2-icycle.exp -fsanitize=address GDB crash.
8c62a9
	* gdb.dwarf2/dw2-icycle.S: Remove all DW_AT_sibling.
8c62a9
8c62a9
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
8c62a9
index 1f84e4a..938ff20 100644
8c62a9
--- a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
8c62a9
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S
8c62a9
@@ -63,21 +63,18 @@ p__top:
8c62a9
 	.uleb128 0x1	/* DW_AT_frame_base */
8c62a9
 	.byte	0x9c	/* DW_OP_call_frame_cfa */
8c62a9
 			/* DW_AT_GNU_all_call_sites */
8c62a9
-	.4byte	.S0x4fc - .Ldebug_info0	/* DW_AT_sibling */
8c62a9
 .S0x1e0:
8c62a9
 	.uleb128 0x15	/* (DIE (0x1e0) DW_TAG_subprogram) */
8c62a9
 	.ascii	"p__top__middle\0" /* DW_AT_name */
8c62a9
 	.byte	0x1	/* DW_AT_decl_file (p.adb) */
8c62a9
 	.byte	0x4	/* DW_AT_decl_line */
8c62a9
 	.byte	0x1	/* DW_AT_inline */
8c62a9
-	.4byte	.S0x374 - .Ldebug_info0	/* DW_AT_sibling */
8c62a9
 .S0x202:
8c62a9
 	.uleb128 0x15	/* (DIE (0x202) DW_TAG_subprogram) */
8c62a9
 	.ascii	"p__top__middle__inside\0" /* DW_AT_name */
8c62a9
 	.byte	0x1	/* DW_AT_decl_file (p.adb) */
8c62a9
 	.byte	0x5	/* DW_AT_decl_line */
8c62a9
 	.byte	0x1	/* DW_AT_inline */
8c62a9
-	.4byte	.S0x225	- .Ldebug_info0 /* DW_AT_sibling */
8c62a9
 	.byte	0	/* end of children of DIE 0x202 */
8c62a9
 .S0x225:
8c62a9
 	.uleb128 0x18	/* (DIE (0x225) DW_TAG_subprogram) */
8c62a9
@@ -95,7 +92,6 @@ p__top:
8c62a9
 	.4byte	.LBE6-.LFB4	/* DW_AT_high_pc */
8c62a9
 	.byte	0x1	/* DW_AT_call_file (p.adb) */
8c62a9
 	.byte	0x14	/* DW_AT_call_line */
8c62a9
-	.4byte	.S0x374	- .Ldebug_info0 /* DW_AT_sibling */
8c62a9
 	.byte	0	/* end of children of DIE 0x247 */
8c62a9
 	.byte	0	/* end of children of DIE 0x225 */
8c62a9
 	.byte	0	/* end of children of DIE 0x1e0 */
8c62a9
@@ -167,8 +163,6 @@ p__top:
8c62a9
 	.uleb128 0x18	/* (DW_FORM_exprloc) */
8c62a9
 	.uleb128 0x2117	/* (DW_AT_GNU_all_call_sites) */
8c62a9
 	.uleb128 0x19	/* (DW_FORM_flag_present) */
8c62a9
-	.uleb128 0x1	/* (DW_AT_sibling) */
8c62a9
-	.uleb128 0x13	/* (DW_FORM_ref4) */
8c62a9
 	.byte	0
8c62a9
 	.byte	0
8c62a9
 	.uleb128 0x15	/* (abbrev code) */
8c62a9
@@ -182,8 +176,6 @@ p__top:
8c62a9
 	.uleb128 0xb	/* (DW_FORM_data1) */
8c62a9
 	.uleb128 0x20	/* (DW_AT_inline) */
8c62a9
 	.uleb128 0xb	/* (DW_FORM_data1) */
8c62a9
-	.uleb128 0x1	/* (DW_AT_sibling) */
8c62a9
-	.uleb128 0x13	/* (DW_FORM_ref4) */
8c62a9
 	.byte	0
8c62a9
 	.byte	0
8c62a9
 	.uleb128 0x18	/* (abbrev code) */
8c62a9
@@ -216,8 +208,6 @@ p__top:
8c62a9
 	.uleb128 0xb	/* (DW_FORM_data1) */
8c62a9
 	.uleb128 0x59	/* (DW_AT_call_line) */
8c62a9
 	.uleb128 0xb	/* (DW_FORM_data1) */
8c62a9
-	.uleb128 0x1	/* (DW_AT_sibling) */
8c62a9
-	.uleb128 0x13	/* (DW_FORM_ref4) */
8c62a9
 	.byte	0
8c62a9
 	.byte	0
8c62a9
 	.uleb128 0x23	/* (abbrev code) */
8c62a9
8c62a9
--WIyZ46R2i8wDzkSu--
8c62a9