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

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