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

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