Blame SOURCES/gdb-6.7-ppc-clobbered-registers-O2-test.patch

0a406a
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
0a406a
From: Jan Kratochvil <jan.kratochvil@redhat.com>
0a406a
Date: Fri, 27 Oct 2017 21:07:50 +0200
0a406a
Subject: gdb-6.7-ppc-clobbered-registers-O2-test.patch
0a406a
0a406a
;; Test PPC hiding of call-volatile parameter register.
0a406a
;;=fedoratest
0a406a
0a406a
2007-11-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
0a406a
0a406a
	* gdb.arch/ppc-clobbered-registers-O2.exp: `powerpc64' changed to
0a406a
	`powerpc*'.
0a406a
0a406a
Testcase for:
0a406a
0a406a
http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html
0a406a
0a406a
2007-10-21  Luis Machado  <luisgpm@br.ibm.com>
0a406a
0a406a
	* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): New function.
0a406a
	* (rs6000_gdbarch_init): Install ppc_dwarf2_frame_init_reg as
0a406a
	default dwarf2_frame_set_init_reg function.
0a406a
0a406a
diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c
0a406a
new file mode 100644
0a406a
--- /dev/null
0a406a
+++ b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c
0a406a
@@ -0,0 +1,21 @@
0a406a
+
0a406a
+unsigned * __attribute__((noinline))
0a406a
+start_sequence (unsigned * x, unsigned * y)
0a406a
+{
0a406a
+	return (unsigned *)0xdeadbeef;
0a406a
+};
0a406a
+
0a406a
+unsigned __attribute__((noinline))
0a406a
+gen_movsd (unsigned * operand0, unsigned * operand1)
0a406a
+{
0a406a
+	return *start_sequence(operand0, operand1);
0a406a
+}
0a406a
+
0a406a
+int main(void)
0a406a
+{
0a406a
+  unsigned x, y;
0a406a
+
0a406a
+  x = 13;
0a406a
+  y = 14;
0a406a
+  return (int)gen_movsd (&x, &y);
0a406a
+}
0a406a
diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp
0a406a
new file mode 100644
0a406a
--- /dev/null
0a406a
+++ b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp
0a406a
@@ -0,0 +1,54 @@
0a406a
+# Copyright 2006 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 2 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, write to the Free Software
0a406a
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
0a406a
+#
0a406a
+# This file is part of the gdb testsuite.
0a406a
+
0a406a
+# Test displaying call clobbered registers in optimized binaries for ppc.
0a406a
+# GDB should not show incorrect values.
0a406a
+
0a406a
+if ![istarget "powerpc*-*"] then {
0a406a
+    verbose "Skipping powerpc* call clobbered registers testing."
0a406a
+    return
0a406a
+}
0a406a
+
0a406a
+set testfile "ppc-clobbered-registers-O2"
0a406a
+set srcfile ${testfile}.c
0a406a
+set binfile [standard_output_file ${testfile}]
0a406a
+set compile_flags "debug additional_flags=-O2"
0a406a
+
0a406a
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${compile_flags}] != "" } {
0a406a
+    unsupported "Testcase compile failed."
0a406a
+    return -1
0a406a
+}
0a406a
+
0a406a
+gdb_exit
0a406a
+gdb_start
0a406a
+gdb_reinitialize_dir $srcdir/$subdir
0a406a
+gdb_load ${binfile}
0a406a
+
0a406a
+if ![runto_main] then {
0a406a
+    perror "Couldn't run to breakpoint"
0a406a
+    continue
0a406a
+}
0a406a
+
0a406a
+gdb_test "b start_sequence" ".*Breakpoint 2 at.*line 6.*" \
0a406a
+  "Insert breakpoint at problematic function"
0a406a
+
0a406a
+gdb_test continue ".*Breakpoint 2.*in start_sequence.*" \
0a406a
+  "Run until problematic function"
0a406a
+
0a406a
+gdb_test backtrace ".*operand0=<value optimized out>.*operand1=<value optimized out>.*" \
0a406a
+  "Check value of call clobbered registers"