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