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

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