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

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