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

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