|
|
79b363 |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
79b363 |
From: Fedora GDB patches <invalid@email.com>
|
|
|
79b363 |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
79b363 |
Subject: gdb-test-dw2-aranges.patch
|
|
|
79b363 |
|
|
|
79b363 |
;; [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp.
|
|
|
79b363 |
;;=fedoratest
|
|
|
79b363 |
|
|
|
79b363 |
[archer-tromey-delayed-symfile]
|
|
|
79b363 |
|
|
|
79b363 |
commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d
|
|
|
79b363 |
Author: Jan Kratochvil <jkratoch@host1.dyn.jankratochvil.net>
|
|
|
79b363 |
Date: Sat Aug 15 15:05:54 2009 +0200
|
|
|
79b363 |
|
|
|
79b363 |
Test for "handle incorrect aranges".
|
|
|
79b363 |
|
|
|
79b363 |
readelf:
|
|
|
79b363 |
Contents of the .debug_aranges section:
|
|
|
79b363 |
|
|
|
79b363 |
Length: 8
|
|
|
79b363 |
Version: 2
|
|
|
79b363 |
Offset into .debug_info: 0x0
|
|
|
79b363 |
Pointer Size: 0
|
|
|
79b363 |
Segment Size: 0
|
|
|
79b363 |
|
|
|
79b363 |
Address Length
|
|
|
79b363 |
Floating point exception
|
|
|
79b363 |
|
|
|
79b363 |
* gdb.dwarf2/dw2-aranges.exp, gdb.dwarf2/dw2-aranges.S: New files.
|
|
|
79b363 |
|
|
|
79b363 |
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
|
|
|
79b363 |
new file mode 100644
|
|
|
79b363 |
--- /dev/null
|
|
|
79b363 |
+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
|
|
|
79b363 |
@@ -0,0 +1,140 @@
|
|
|
79b363 |
+/* This testcase is part of GDB, the GNU debugger.
|
|
|
79b363 |
+
|
|
|
79b363 |
+ Copyright 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
|
|
|
79b363 |
+
|
|
|
79b363 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
79b363 |
+ it under the terms of the GNU General Public License as published by
|
|
|
79b363 |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
79b363 |
+ (at your option) any later version.
|
|
|
79b363 |
+
|
|
|
79b363 |
+ This program is distributed in the hope that it will be useful,
|
|
|
79b363 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
79b363 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
79b363 |
+ GNU General Public License for more details.
|
|
|
79b363 |
+
|
|
|
79b363 |
+ You should have received a copy of the GNU General Public License
|
|
|
79b363 |
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
79b363 |
+
|
|
|
79b363 |
+/* Test .debug_aranges containing zero address_size. */
|
|
|
79b363 |
+
|
|
|
79b363 |
+/* Dummy function to provide debug information for. */
|
|
|
79b363 |
+
|
|
|
79b363 |
+ .text
|
|
|
79b363 |
+.Lbegin_text1:
|
|
|
79b363 |
+ .globl main
|
|
|
79b363 |
+ .type main, %function
|
|
|
79b363 |
+main:
|
|
|
79b363 |
+.Lbegin_main:
|
|
|
79b363 |
+ .int 0
|
|
|
79b363 |
+.Lend_main:
|
|
|
79b363 |
+ .size main, .-main
|
|
|
79b363 |
+.Lend_text1:
|
|
|
79b363 |
+
|
|
|
79b363 |
+/* Debug information */
|
|
|
79b363 |
+
|
|
|
79b363 |
+ .section .debug_info
|
|
|
79b363 |
+.Lcu1_begin:
|
|
|
79b363 |
+ /* CU header */
|
|
|
79b363 |
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
|
|
|
79b363 |
+.Lcu1_start:
|
|
|
79b363 |
+ .2byte 2 /* DWARF Version */
|
|
|
79b363 |
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
|
|
|
79b363 |
+ .byte 4 /* Pointer size */
|
|
|
79b363 |
+
|
|
|
79b363 |
+ /* CU die */
|
|
|
79b363 |
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
|
|
|
79b363 |
+ .4byte .Lend_text1 /* DW_AT_high_pc */
|
|
|
79b363 |
+ .4byte .Lbegin_text1 /* DW_AT_low_pc */
|
|
|
79b363 |
+ .ascii "file1.txt\0" /* DW_AT_name */
|
|
|
79b363 |
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
|
|
|
79b363 |
+ .byte 1 /* DW_AT_language (C) */
|
|
|
79b363 |
+
|
|
|
79b363 |
+ /* main */
|
|
|
79b363 |
+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */
|
|
|
79b363 |
+ .byte 1 /* DW_AT_external */
|
|
|
79b363 |
+ .byte 1 /* DW_AT_decl_file */
|
|
|
79b363 |
+ .byte 2 /* DW_AT_decl_line */
|
|
|
79b363 |
+ .ascii "main\0" /* DW_AT_name */
|
|
|
79b363 |
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
|
|
|
79b363 |
+ .4byte .Lbegin_main /* DW_AT_low_pc */
|
|
|
79b363 |
+ .4byte .Lend_main /* DW_AT_high_pc */
|
|
|
79b363 |
+ .byte 1 /* DW_AT_frame_base: length */
|
|
|
79b363 |
+ .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
|
|
|
79b363 |
+
|
|
|
79b363 |
+.Ltype_int:
|
|
|
79b363 |
+ .uleb128 3 /* Abbrev: DW_TAG_base_type */
|
|
|
79b363 |
+ .ascii "int\0" /* DW_AT_name */
|
|
|
79b363 |
+ .byte 4 /* DW_AT_byte_size */
|
|
|
79b363 |
+ .byte 5 /* DW_AT_encoding */
|
|
|
79b363 |
+
|
|
|
79b363 |
+ .byte 0 /* End of children of CU */
|
|
|
79b363 |
+
|
|
|
79b363 |
+.Lcu1_end:
|
|
|
79b363 |
+
|
|
|
79b363 |
+/* Abbrev table */
|
|
|
79b363 |
+ .section .debug_abbrev
|
|
|
79b363 |
+.Labbrev1_begin:
|
|
|
79b363 |
+ .uleb128 1 /* Abbrev code */
|
|
|
79b363 |
+ .uleb128 0x11 /* DW_TAG_compile_unit */
|
|
|
79b363 |
+ .byte 1 /* has_children */
|
|
|
79b363 |
+ .uleb128 0x12 /* DW_AT_high_pc */
|
|
|
79b363 |
+ .uleb128 0x1 /* DW_FORM_addr */
|
|
|
79b363 |
+ .uleb128 0x11 /* DW_AT_low_pc */
|
|
|
79b363 |
+ .uleb128 0x1 /* DW_FORM_addr */
|
|
|
79b363 |
+ .uleb128 0x3 /* DW_AT_name */
|
|
|
79b363 |
+ .uleb128 0x8 /* DW_FORM_string */
|
|
|
79b363 |
+ .uleb128 0x25 /* DW_AT_producer */
|
|
|
79b363 |
+ .uleb128 0x8 /* DW_FORM_string */
|
|
|
79b363 |
+ .uleb128 0x13 /* DW_AT_language */
|
|
|
79b363 |
+ .uleb128 0xb /* DW_FORM_data1 */
|
|
|
79b363 |
+ .byte 0x0 /* Terminator */
|
|
|
79b363 |
+ .byte 0x0 /* Terminator */
|
|
|
79b363 |
+
|
|
|
79b363 |
+ .uleb128 2 /* Abbrev code */
|
|
|
79b363 |
+ .uleb128 0x2e /* DW_TAG_subprogram */
|
|
|
79b363 |
+ .byte 0 /* has_children */
|
|
|
79b363 |
+ .uleb128 0x3f /* DW_AT_external */
|
|
|
79b363 |
+ .uleb128 0xc /* DW_FORM_flag */
|
|
|
79b363 |
+ .uleb128 0x3a /* DW_AT_decl_file */
|
|
|
79b363 |
+ .uleb128 0xb /* DW_FORM_data1 */
|
|
|
79b363 |
+ .uleb128 0x3b /* DW_AT_decl_line */
|
|
|
79b363 |
+ .uleb128 0xb /* DW_FORM_data1 */
|
|
|
79b363 |
+ .uleb128 0x3 /* DW_AT_name */
|
|
|
79b363 |
+ .uleb128 0x8 /* DW_FORM_string */
|
|
|
79b363 |
+ .uleb128 0x49 /* DW_AT_type */
|
|
|
79b363 |
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
|
|
79b363 |
+ .uleb128 0x11 /* DW_AT_low_pc */
|
|
|
79b363 |
+ .uleb128 0x1 /* DW_FORM_addr */
|
|
|
79b363 |
+ .uleb128 0x12 /* DW_AT_high_pc */
|
|
|
79b363 |
+ .uleb128 0x1 /* DW_FORM_addr */
|
|
|
79b363 |
+ .uleb128 0x40 /* DW_AT_frame_base */
|
|
|
79b363 |
+ .uleb128 0xa /* DW_FORM_block1 */
|
|
|
79b363 |
+ .byte 0x0 /* Terminator */
|
|
|
79b363 |
+ .byte 0x0 /* Terminator */
|
|
|
79b363 |
+
|
|
|
79b363 |
+ .uleb128 3 /* Abbrev code */
|
|
|
79b363 |
+ .uleb128 0x24 /* DW_TAG_base_type */
|
|
|
79b363 |
+ .byte 0 /* has_children */
|
|
|
79b363 |
+ .uleb128 0x3 /* DW_AT_name */
|
|
|
79b363 |
+ .uleb128 0x8 /* DW_FORM_string */
|
|
|
79b363 |
+ .uleb128 0xb /* DW_AT_byte_size */
|
|
|
79b363 |
+ .uleb128 0xb /* DW_FORM_data1 */
|
|
|
79b363 |
+ .uleb128 0x3e /* DW_AT_encoding */
|
|
|
79b363 |
+ .uleb128 0xb /* DW_FORM_data1 */
|
|
|
79b363 |
+ .byte 0x0 /* Terminator */
|
|
|
79b363 |
+ .byte 0x0 /* Terminator */
|
|
|
79b363 |
+
|
|
|
79b363 |
+ .byte 0x0 /* Terminator */
|
|
|
79b363 |
+ .byte 0x0 /* Terminator */
|
|
|
79b363 |
+
|
|
|
79b363 |
+/* aranges table */
|
|
|
79b363 |
+ .section .debug_aranges
|
|
|
79b363 |
+ .long .Laranges_end - 1f
|
|
|
79b363 |
+1:
|
|
|
79b363 |
+ .2byte 2 /* aranges Version */
|
|
|
79b363 |
+ .4byte .Lcu1_begin - .debug_info /* Offset into .debug_info section */
|
|
|
79b363 |
+ /* The GDB crasher is this zero value. */
|
|
|
79b363 |
+ .byte 0 /* aranges address_size */
|
|
|
79b363 |
+ .byte 0 /* aranges segment_size */
|
|
|
79b363 |
+
|
|
|
79b363 |
+.Laranges_end:
|
|
|
79b363 |
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
|
|
|
79b363 |
new file mode 100644
|
|
|
79b363 |
--- /dev/null
|
|
|
79b363 |
+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
|
|
|
79b363 |
@@ -0,0 +1,40 @@
|
|
|
79b363 |
+# Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
|
|
|
79b363 |
+
|
|
|
79b363 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
79b363 |
+# it under the terms of the GNU General Public License as published by
|
|
|
79b363 |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
79b363 |
+# (at your option) any later version.
|
|
|
79b363 |
+#
|
|
|
79b363 |
+# This program is distributed in the hope that it will be useful,
|
|
|
79b363 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
79b363 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
79b363 |
+# GNU General Public License for more details.
|
|
|
79b363 |
+#
|
|
|
79b363 |
+# You should have received a copy of the GNU General Public License
|
|
|
79b363 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
79b363 |
+
|
|
|
79b363 |
+# Test .debug_aranges containing zero address_size.
|
|
|
79b363 |
+
|
|
|
79b363 |
+# This test can only be run on targets which support DWARF-2 and use gas.
|
|
|
79b363 |
+# For now pick a sampling of likely targets.
|
|
|
79b363 |
+if {![istarget *-*-linux*]
|
|
|
79b363 |
+ && ![istarget *-*-gnu*]
|
|
|
79b363 |
+ && ![istarget *-*-elf*]
|
|
|
79b363 |
+ && ![istarget *-*-openbsd*]
|
|
|
79b363 |
+ && ![istarget arm-*-eabi*]
|
|
|
79b363 |
+ && ![istarget powerpc-*-eabi*]} {
|
|
|
79b363 |
+ return 0
|
|
|
79b363 |
+}
|
|
|
79b363 |
+
|
|
|
79b363 |
+set testfile "dw2-aranges"
|
|
|
79b363 |
+set srcfile ${testfile}.S
|
|
|
79b363 |
+set binfile [standard_output_file ${testfile}]
|
|
|
79b363 |
+
|
|
|
79b363 |
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } {
|
|
|
79b363 |
+ return -1
|
|
|
79b363 |
+}
|
|
|
79b363 |
+
|
|
|
79b363 |
+clean_restart $testfile
|
|
|
79b363 |
+
|
|
|
79b363 |
+# Failed gdb_load would abort the testcase execution earlier.
|
|
|
79b363 |
+pass "file loaded"
|