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

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