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

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