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

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