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

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