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

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