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

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