Blame SOURCES/gdb-bz601887-dwarf4-rh-test.patch

ed07ac
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
ed07ac
From: Fedora GDB patches <invalid@email.com>
ed07ac
Date: Fri, 27 Oct 2017 21:07:50 +0200
ed07ac
Subject: gdb-bz601887-dwarf4-rh-test.patch
ed07ac
ed07ac
;; Backport DWARF-4 support (BZ 601887, Tom Tromey).
ed07ac
;;=fedoratest
ed07ac
ed07ac
diff --git a/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S
ed07ac
new file mode 100644
ed07ac
--- /dev/null
ed07ac
+++ b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.S
ed07ac
@@ -0,0 +1,167 @@
ed07ac
+/* This testcase is part of GDB, the GNU debugger.
ed07ac
+
ed07ac
+   Copyright 2010 Free Software Foundation, Inc.
ed07ac
+
ed07ac
+   This program is free software; you can redistribute it and/or modify
ed07ac
+   it under the terms of the GNU General Public License as published by
ed07ac
+   the Free Software Foundation; either version 3 of the License, or
ed07ac
+   (at your option) any later version.
ed07ac
+
ed07ac
+   This program is distributed in the hope that it will be useful,
ed07ac
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ed07ac
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ed07ac
+   GNU General Public License for more details.
ed07ac
+
ed07ac
+   You should have received a copy of the GNU General Public License
ed07ac
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
ed07ac
+
ed07ac
+	.file	"rh-dwarf4-x86_64.c"
ed07ac
+	.section	.debug_abbrev,"",@progbits
ed07ac
+.Ldebug_abbrev0:
ed07ac
+	.section	.debug_info,"",@progbits
ed07ac
+.Ldebug_info0:
ed07ac
+	.section	.debug_line,"",@progbits
ed07ac
+.Ldebug_line0:
ed07ac
+	.text
ed07ac
+.Ltext0:
ed07ac
+.globl main
ed07ac
+	.type	main, @function
ed07ac
+main:
ed07ac
+.LFB0:
ed07ac
+	.file 1 "gdb.dwarf2/rh-dwarf4-x86_64.c"
ed07ac
+	# gdb.dwarf2/rh-dwarf4-x86_64.c:20
ed07ac
+	.loc 1 20 0
ed07ac
+	.cfi_startproc
ed07ac
+	# basic block 2
ed07ac
+	pushq	%rbp
ed07ac
+	.cfi_def_cfa_offset 16
ed07ac
+	movq	%rsp, %rbp
ed07ac
+	.cfi_offset 6, -16
ed07ac
+	.cfi_def_cfa_register 6
ed07ac
+	# gdb.dwarf2/rh-dwarf4-x86_64.c:21
ed07ac
+	.loc 1 21 0
ed07ac
+	movl	$0, %eax
ed07ac
+	# gdb.dwarf2/rh-dwarf4-x86_64.c:22
ed07ac
+	.loc 1 22 0
ed07ac
+	leave
ed07ac
+	.cfi_def_cfa 7, 8
ed07ac
+	ret
ed07ac
+	.cfi_endproc
ed07ac
+.LFE0:
ed07ac
+	.size	main, .-main
ed07ac
+.Letext0:
ed07ac
+	.section	.debug_info
ed07ac
+	.long	0x4e	# Length of Compilation Unit Info
ed07ac
+	.value	0x4	# DWARF version number
ed07ac
+	.long	.Ldebug_abbrev0	# Offset Into Abbrev. Section
ed07ac
+	.byte	0x8	# Pointer Size (in bytes)
ed07ac
+	.uleb128 0x1	# (DIE (0xb) DW_TAG_compile_unit)
ed07ac
+	.long	.LASF0	# DW_AT_producer: "GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)"
ed07ac
+	.byte	0x1	# DW_AT_language
ed07ac
+	.long	.LASF1	# DW_AT_name: "gdb.dwarf2/rh-dwarf4-x86_64.c"
ed07ac
+	.long	.LASF2	# DW_AT_comp_dir
ed07ac
+	.quad	.Ltext0	# DW_AT_low_pc
ed07ac
+	.quad	.Letext0	# DW_AT_high_pc
ed07ac
+	.long	.Ldebug_line0	# DW_AT_stmt_list
ed07ac
+	.uleb128 0x2	# (DIE (0x2d) DW_TAG_subprogram)
ed07ac
+			# DW_AT_external
ed07ac
+	.long	.LASF3	# DW_AT_name: "main"
ed07ac
+	.byte	0x1	# DW_AT_decl_file (gdb.dwarf2/rh-dwarf4-x86_64.c)
ed07ac
+	.byte	0x13	# DW_AT_decl_line
ed07ac
+			# DW_AT_prototyped
ed07ac
+	.long	0x4a	# DW_AT_type
ed07ac
+	.quad	.LFB0	# DW_AT_low_pc
ed07ac
+	.quad	.LFE0	# DW_AT_high_pc
ed07ac
+	.uleb128 0x1	# DW_AT_frame_base
ed07ac
+	.byte	0x9c	# DW_OP_call_frame_cfa
ed07ac
+	.uleb128 0x3	# (DIE (0x4a) DW_TAG_base_type)
ed07ac
+	.byte	0x4	# DW_AT_byte_size
ed07ac
+	.byte	0x5	# DW_AT_encoding
ed07ac
+	.ascii "int\0"	# DW_AT_name
ed07ac
+	.byte	0x0	# end of children of DIE 0xb
ed07ac
+	.section	.debug_abbrev
ed07ac
+	.uleb128 0x1	# (abbrev code)
ed07ac
+	.uleb128 0x11	# (TAG: DW_TAG_compile_unit)
ed07ac
+	.byte	0x1	# DW_children_yes
ed07ac
+	.uleb128 0x25	# (DW_AT_producer)
ed07ac
+	.uleb128 0xe	# (DW_FORM_strp)
ed07ac
+	.uleb128 0x13	# (DW_AT_language)
ed07ac
+	.uleb128 0xb	# (DW_FORM_data1)
ed07ac
+	.uleb128 0x3	# (DW_AT_name)
ed07ac
+	.uleb128 0xe	# (DW_FORM_strp)
ed07ac
+	.uleb128 0x1b	# (DW_AT_comp_dir)
ed07ac
+	.uleb128 0xe	# (DW_FORM_strp)
ed07ac
+	.uleb128 0x11	# (DW_AT_low_pc)
ed07ac
+	.uleb128 0x1	# (DW_FORM_addr)
ed07ac
+	.uleb128 0x12	# (DW_AT_high_pc)
ed07ac
+	.uleb128 0x1	# (DW_FORM_addr)
ed07ac
+	.uleb128 0x10	# (DW_AT_stmt_list)
ed07ac
+	.uleb128 0x17	# (DW_FORM_sec_offset)
ed07ac
+	.byte	0x0
ed07ac
+	.byte	0x0
ed07ac
+	.uleb128 0x2	# (abbrev code)
ed07ac
+	.uleb128 0x2e	# (TAG: DW_TAG_subprogram)
ed07ac
+	.byte	0x0	# DW_children_no
ed07ac
+	.uleb128 0x3f	# (DW_AT_external)
ed07ac
+	.uleb128 0x19	# (DW_FORM_flag_present)
ed07ac
+	.uleb128 0x3	# (DW_AT_name)
ed07ac
+	.uleb128 0xe	# (DW_FORM_strp)
ed07ac
+	.uleb128 0x3a	# (DW_AT_decl_file)
ed07ac
+	.uleb128 0xb	# (DW_FORM_data1)
ed07ac
+	.uleb128 0x3b	# (DW_AT_decl_line)
ed07ac
+	.uleb128 0xb	# (DW_FORM_data1)
ed07ac
+	.uleb128 0x27	# (DW_AT_prototyped)
ed07ac
+	.uleb128 0x19	# (DW_FORM_flag_present)
ed07ac
+	.uleb128 0x49	# (DW_AT_type)
ed07ac
+	.uleb128 0x13	# (DW_FORM_ref4)
ed07ac
+	.uleb128 0x11	# (DW_AT_low_pc)
ed07ac
+	.uleb128 0x1	# (DW_FORM_addr)
ed07ac
+	.uleb128 0x12	# (DW_AT_high_pc)
ed07ac
+	.uleb128 0x1	# (DW_FORM_addr)
ed07ac
+	.uleb128 0x40	# (DW_AT_frame_base)
ed07ac
+	.uleb128 0x18	# (DW_FORM_exprloc)
ed07ac
+	.byte	0x0
ed07ac
+	.byte	0x0
ed07ac
+	.uleb128 0x3	# (abbrev code)
ed07ac
+	.uleb128 0x24	# (TAG: DW_TAG_base_type)
ed07ac
+	.byte	0x0	# DW_children_no
ed07ac
+	.uleb128 0xb	# (DW_AT_byte_size)
ed07ac
+	.uleb128 0xb	# (DW_FORM_data1)
ed07ac
+	.uleb128 0x3e	# (DW_AT_encoding)
ed07ac
+	.uleb128 0xb	# (DW_FORM_data1)
ed07ac
+	.uleb128 0x3	# (DW_AT_name)
ed07ac
+	.uleb128 0x8	# (DW_FORM_string)
ed07ac
+	.byte	0x0
ed07ac
+	.byte	0x0
ed07ac
+	.byte	0x0
ed07ac
+	.section	.debug_pubnames,"",@progbits
ed07ac
+	.long	0x17	# Length of Public Names Info
ed07ac
+	.value	0x2	# DWARF Version
ed07ac
+	.long	.Ldebug_info0	# Offset of Compilation Unit Info
ed07ac
+	.long	0x52	# Compilation Unit Length
ed07ac
+	.long	0x2d	# DIE offset
ed07ac
+	.ascii "main\0"	# external name
ed07ac
+	.long	0x0
ed07ac
+	.section	.debug_aranges,"",@progbits
ed07ac
+	.long	0x2c	# Length of Address Ranges Info
ed07ac
+	.value	0x2	# DWARF Version
ed07ac
+	.long	.Ldebug_info0	# Offset of Compilation Unit Info
ed07ac
+	.byte	0x8	# Size of Address
ed07ac
+	.byte	0x0	# Size of Segment Descriptor
ed07ac
+	.value	0x0	# Pad to 16 byte boundary
ed07ac
+	.value	0x0
ed07ac
+	.quad	.Ltext0	# Address
ed07ac
+	.quad	.Letext0-.Ltext0	# Length
ed07ac
+	.quad	0x0
ed07ac
+	.quad	0x0
ed07ac
+	.section	.debug_str,"MS",@progbits,1
ed07ac
+.LASF2:
ed07ac
+	.string	"."
ed07ac
+.LASF0:
ed07ac
+	.string	"GNU C 4.4.4 20100503 (Red Hat 4.4.4-2)"
ed07ac
+.LASF1:
ed07ac
+	.string	"gdb.dwarf2/rh-dwarf4-x86_64.c"
ed07ac
+.LASF3:
ed07ac
+	.string	"main"
ed07ac
+	.ident	"GCC: (GNU) 4.4.4 20100503 (Red Hat 4.4.4-2)"
ed07ac
+	.section	.note.GNU-stack,"",@progbits
ed07ac
diff --git a/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.c b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.c
ed07ac
new file mode 100644
ed07ac
--- /dev/null
ed07ac
+++ b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.c
ed07ac
@@ -0,0 +1,22 @@
ed07ac
+/* This testcase is part of GDB, the GNU debugger.
ed07ac
+
ed07ac
+   Copyright 2010 Free Software Foundation, Inc.
ed07ac
+
ed07ac
+   This program is free software; you can redistribute it and/or modify
ed07ac
+   it under the terms of the GNU General Public License as published by
ed07ac
+   the Free Software Foundation; either version 3 of the License, or
ed07ac
+   (at your option) any later version.
ed07ac
+
ed07ac
+   This program is distributed in the hope that it will be useful,
ed07ac
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
ed07ac
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ed07ac
+   GNU General Public License for more details.
ed07ac
+
ed07ac
+   You should have received a copy of the GNU General Public License
ed07ac
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
ed07ac
+
ed07ac
+int
ed07ac
+main (void)
ed07ac
+{
ed07ac
+  return 0;
ed07ac
+}
ed07ac
diff --git a/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.exp b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.exp
ed07ac
new file mode 100644
ed07ac
--- /dev/null
ed07ac
+++ b/gdb/testsuite/gdb.dwarf2/rh-dwarf4-x86_64.exp
ed07ac
@@ -0,0 +1,42 @@
ed07ac
+# Copyright 2010 Free Software Foundation, Inc.
ed07ac
+
ed07ac
+# This program is free software; you can redistribute it and/or modify
ed07ac
+# it under the terms of the GNU General Public License as published by
ed07ac
+# the Free Software Foundation; either version 3 of the License, or
ed07ac
+# (at your option) any later version.
ed07ac
+#
ed07ac
+# This program is distributed in the hope that it will be useful,
ed07ac
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
ed07ac
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ed07ac
+# GNU General Public License for more details.
ed07ac
+#
ed07ac
+# You should have received a copy of the GNU General Public License
ed07ac
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
ed07ac
+
ed07ac
+# This test can only be run on targets which support DWARF-2 and use gas.
ed07ac
+# For now pick a sampling of likely targets.
ed07ac
+if {![istarget *-*-linux*]
ed07ac
+    && ![istarget *-*-gnu*]
ed07ac
+    && ![istarget *-*-elf*]
ed07ac
+    && ![istarget *-*-openbsd*]
ed07ac
+    && ![istarget arm-*-eabi*]
ed07ac
+    && ![istarget powerpc-*-eabi*]} {
ed07ac
+    return 0
ed07ac
+}
ed07ac
+
ed07ac
+if {![istarget x86_64-*]} {
ed07ac
+    return 0
ed07ac
+}
ed07ac
+
ed07ac
+set testfile "rh-dwarf4-x86_64"
ed07ac
+set srcfile ${testfile}.S
ed07ac
+set executable ${testfile}.x
ed07ac
+set binfile [standard_output_file ${executable}]
ed07ac
+
ed07ac
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
ed07ac
+    return -1
ed07ac
+}
ed07ac
+
ed07ac
+clean_restart $executable
ed07ac
+
ed07ac
+gdb_test "ptype main" {type = int \(void\)}