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

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