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

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