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

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