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

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