Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <luisgpm@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] PPC Call-clobbered registers testcase
Date: Mon, 24 Sep 2007 14:41:00 -0000	[thread overview]
Message-ID: <1190644886.4375.2.camel@localhost> (raw)

[-- Attachment #1: Type: text/plain, Size: 289 bytes --]

Hi,

Accompaining the patch the deals with call-clobbered registers on PPC,
follows the testcase to make sure it's being handled correctly.
Suggestions and improvements are welcome.

:ADDPATCH ppc-testcase:


-- 
Luis Machado
IBM Linux Technology Center
e-mail: luisgpm@linux.vnet.ibm.com

[-- Attachment #2: clobbered-registers-testcase.diff --]
[-- Type: text/x-patch, Size: 3100 bytes --]

2007-09-24  Luis Machado  <luisgpm@br.ibm.com>

    * ppc-clobbered-registers-O2.c: New testcase source file.
    * ppc-clobbered-registers-O2.exp: New testcase expect file.

Index: gdb/testsuite/gdb.trace/ppc-clobbered-registers-O2.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gdb/testsuite/gdb.trace/ppc-clobbered-registers-O2.c	2007-09-24 07:26:39.000000000 -0700
@@ -0,0 +1,21 @@
+
+unsigned * __attribute__((noinline))
+start_sequence (unsigned * x, unsigned * y)
+{
+	return (unsigned *)0xdeadbeef;
+};
+
+unsigned __attribute__((noinline))
+gen_movsd (unsigned * operand0, unsigned * operand1)
+{
+	return *start_sequence(operand0, operand1);
+}
+
+int main(void)
+{
+  unsigned x, y;
+
+  x = 13;
+  y = 14;
+  return (int)gen_movsd (&x, &y);
+}
Index: gdb/testsuite/gdb.trace/ppc-clobbered-registers-O2.exp
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gdb/testsuite/gdb.trace/ppc-clobbered-registers-O2.exp	2007-09-24 07:26:39.000000000 -0700
@@ -0,0 +1,61 @@
+# Copyright 2006 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+    strace $tracelevel
+}
+
+# Test displaying call clobbered registers in optimized binaries for ppc.
+# GDB should now show incorrect values.
+
+set prms_id 0
+set bug_id 0
+
+if ![istarget "powerpc64-*"] then {
+    verbose "Skipping powerpc64 call clobbered registers testing."
+    return
+}
+
+set testfile "ppc-clobbered-registers-O2"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+set compile_flags "debug additional_flags=-O2"
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${compile_flags}] != "" } {
+    unsupported "Testcase compile failed."
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+    perror "Couldn't run to breakpoint"
+    continue
+}
+
+gdb_test "b start_sequence" ".*Breakpoint 2 at.*line 6.*" \
+  "Insert breakpoint at problematic function"
+
+gdb_test continue ".*Breakpoint 2.*in start_sequence.*" \
+  "Run until problematic function"
+
+gdb_test backtrace ".*operand0=<value optimized out>.*operand1=<value optimized out>.*" \
+  "Check value of call clobbered registers"

             reply	other threads:[~2007-09-24 14:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24 14:41 Luis Machado [this message]
2007-09-25 16:21 ` Luis Machado
2007-10-06 16:12   ` Daniel Jacobowitz
2007-10-08 18:55     ` Luis Machado
2007-10-08 19:06       ` Daniel Jacobowitz
2007-10-08 19:14         ` Luis Machado
2007-10-08 19:35           ` Daniel Jacobowitz
2007-10-23 22:18             ` Luis Machado
2007-10-24 21:00               ` Daniel Jacobowitz
2007-10-25 19:06                 ` Luis Machado
2007-10-25 19:30                   ` Daniel Jacobowitz
2007-10-25 20:36                     ` Luis Machado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1190644886.4375.2.camel@localhost \
    --to=luisgpm@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox