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

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