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

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