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

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