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

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