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

405ea9
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
405ea9
From: Jan Kratochvil <jan.kratochvil@redhat.com>
405ea9
Date: Fri, 27 Oct 2017 21:07:50 +0200
405ea9
Subject: gdb-6.7-ppc-clobbered-registers-O2-test.patch
405ea9
405ea9
;; Test PPC hiding of call-volatile parameter register.
405ea9
;;=fedoratest
405ea9
405ea9
2007-11-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
405ea9
405ea9
	* gdb.arch/ppc-clobbered-registers-O2.exp: `powerpc64' changed to
405ea9
	`powerpc*'.
405ea9
405ea9
Testcase for:
405ea9
405ea9
http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html
405ea9
405ea9
2007-10-21  Luis Machado  <luisgpm@br.ibm.com>
405ea9
405ea9
	* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): New function.
405ea9
	* (rs6000_gdbarch_init): Install ppc_dwarf2_frame_init_reg as
405ea9
	default dwarf2_frame_set_init_reg function.
405ea9
405ea9
diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c
405ea9
new file mode 100644
405ea9
--- /dev/null
405ea9
+++ b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c
405ea9
@@ -0,0 +1,21 @@
405ea9
+
405ea9
+unsigned * __attribute__((noinline))
405ea9
+start_sequence (unsigned * x, unsigned * y)
405ea9
+{
405ea9
+	return (unsigned *)0xdeadbeef;
405ea9
+};
405ea9
+
405ea9
+unsigned __attribute__((noinline))
405ea9
+gen_movsd (unsigned * operand0, unsigned * operand1)
405ea9
+{
405ea9
+	return *start_sequence(operand0, operand1);
405ea9
+}
405ea9
+
405ea9
+int main(void)
405ea9
+{
405ea9
+  unsigned x, y;
405ea9
+
405ea9
+  x = 13;
405ea9
+  y = 14;
405ea9
+  return (int)gen_movsd (&x, &y);
405ea9
+}
405ea9
diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp
405ea9
new file mode 100644
405ea9
--- /dev/null
405ea9
+++ b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp
405ea9
@@ -0,0 +1,54 @@
405ea9
+# Copyright 2006 Free Software Foundation, Inc.
405ea9
+#
405ea9
+# This program is free software; you can redistribute it and/or modify
405ea9
+# it under the terms of the GNU General Public License as published by
405ea9
+# the Free Software Foundation; either version 2 of the License, or
405ea9
+# (at your option) any later version.
405ea9
+#
405ea9
+# This program is distributed in the hope that it will be useful,
405ea9
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
405ea9
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
405ea9
+# GNU General Public License for more details.
405ea9
+#
405ea9
+# You should have received a copy of the GNU General Public License
405ea9
+# along with this program; if not, write to the Free Software
405ea9
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
405ea9
+#
405ea9
+# This file is part of the gdb testsuite.
405ea9
+
405ea9
+# Test displaying call clobbered registers in optimized binaries for ppc.
405ea9
+# GDB should not show incorrect values.
405ea9
+
405ea9
+if ![istarget "powerpc*-*"] then {
405ea9
+    verbose "Skipping powerpc* call clobbered registers testing."
405ea9
+    return
405ea9
+}
405ea9
+
405ea9
+set testfile "ppc-clobbered-registers-O2"
405ea9
+set srcfile ${testfile}.c
405ea9
+set binfile [standard_output_file ${testfile}]
405ea9
+set compile_flags "debug additional_flags=-O2"
405ea9
+
405ea9
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${compile_flags}] != "" } {
405ea9
+    unsupported "Testcase compile failed."
405ea9
+    return -1
405ea9
+}
405ea9
+
405ea9
+gdb_exit
405ea9
+gdb_start
405ea9
+gdb_reinitialize_dir $srcdir/$subdir
405ea9
+gdb_load ${binfile}
405ea9
+
405ea9
+if ![runto_main] then {
405ea9
+    perror "Couldn't run to breakpoint"
405ea9
+    continue
405ea9
+}
405ea9
+
405ea9
+gdb_test "b start_sequence" ".*Breakpoint 2 at.*line 6.*" \
405ea9
+  "Insert breakpoint at problematic function"
405ea9
+
405ea9
+gdb_test continue ".*Breakpoint 2.*in start_sequence.*" \
405ea9
+  "Run until problematic function"
405ea9
+
405ea9
+gdb_test backtrace ".*operand0=<value optimized out>.*operand1=<value optimized out>.*" \
405ea9
+  "Check value of call clobbered registers"