From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23127 invoked by alias); 8 Oct 2007 18:45:56 -0000 Received: (qmail 23118 invoked by uid 22791); 8 Oct 2007 18:45:55 -0000 X-Spam-Check-By: sourceware.org Received: from igw1.br.ibm.com (HELO igw1.br.ibm.com) (32.104.18.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 08 Oct 2007 18:45:48 +0000 Received: from mailhub1.br.ibm.com (mailhub1 [9.18.232.109]) by igw1.br.ibm.com (Postfix) with ESMTP id 5A30B32C079 for ; Mon, 8 Oct 2007 15:27:00 -0300 (BRT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by mailhub1.br.ibm.com (8.13.8/8.13.8/NCO v8.5) with ESMTP id l98IjhTx1409106 for ; Mon, 8 Oct 2007 15:45:45 -0300 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l98Ijgjg025655 for ; Mon, 8 Oct 2007 15:45:42 -0300 Received: from dyn531757.br.ibm.com ([9.18.238.24]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l98IjfmE025615; Mon, 8 Oct 2007 15:45:41 -0300 Subject: Re: [PATCH] PPC Call-clobbered registers testcase From: Luis Machado Reply-To: luisgpm@linux.vnet.ibm.com To: Daniel Jacobowitz Cc: gdb-patches@sourceware.org In-Reply-To: <20071006161230.GA10179@caradoc.them.org> References: <1190644886.4375.2.camel@localhost> <1190726512.4376.0.camel@localhost> <20071006161230.GA10179@caradoc.them.org> Content-Type: multipart/mixed; boundary="=-aAa/aIKIRCu4hjVluNiS" Date: Mon, 08 Oct 2007 18:55:00 -0000 Message-Id: <1191869140.4322.10.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00174.txt.bz2 --=-aAa/aIKIRCu4hjVluNiS Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 2544 Thanks for reviewing, Hopefully i addressed all of the issues in this updated version. I'm aiming at gdb.opt for this one. - Addressed the directory structure in the Changelog - Not PowerPC-specific anymore - Copyrighted c file - Optimize compile flag - Defined __attribute__(x) As for the last comment, about passing on correct values, the correct behaviour, at least in this test case, is for GDB to display those values as optimized since they no longer are proven to be correct. Anything i'm failing to see in this case? Regards, On Sat, 2007-10-06 at 12:12 -0400, Daniel Jacobowitz wrote: > Thanks for doing this. > > On Tue, Sep 25, 2007 at 10:21:51AM -0300, Luis Machado wrote: > > 2007-09-24 Luis Machado > > > > * ppc-clobbered-registers-O2.c: New testcase source file. > > * ppc-clobbered-registers-O2.exp: New testcase expect file. > > The directory name should be included here. Also, gdb.trace doesn't > mean what you think it does :-) It's for tracepoint tests; so instead > you probably want gdb.base. > > Alternatively, a new gdb.opt for optimized code tests. CodeSourcery > has a project I hope we will be contributing by the beginning of next > year that puts a few testcases in gdb.opt; if no one thinks that's a > bad idea, then let's start the directory now. > > There's nothing PowerPC specific about these tests. So I would > recommend not putting ppc in their names or skipping them for > non-PowerPC targets. It will turn up the same bug on other platforms > that passed arguments in registers, hopefully. > > > 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)) > > New test cases should have a copyright header, please. And let's use > > #ifndef __GNUC__ > #define __attribute__(x) > #endif > > so that non-GNU compilers can have a chance to run the test too. At > least in theory. > > > +set compile_flags "debug additional_flags=-O2" > > "debug optimize=-O2" > > > +gdb_test backtrace ".*operand0=.*operand1=.*" \ > > + "Check value of call clobbered registers" > > May as well let the test pass if it sees the correct values, too. > -- Luis Machado IBM Linux Technology Center e-mail: luisgpm@linux.vnet.ibm.com --=-aAa/aIKIRCu4hjVluNiS Content-Disposition: attachment; filename=clobbered-registers-testcase.diff Content-Type: text/x-patch; name=clobbered-registers-testcase.diff; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 3863 2007-10-08 Luis Machado * gdb.opt/clobbered-registers-O2.c: New testcase source file. * gdb.opt/clobbered-registers-O2.exp: New testcase expect file. Index: gdb/testsuite/gdb.opt/clobbered-registers-O2.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb/testsuite/gdb.opt/clobbered-registers-O2.c 2007-10-08 09:36:28.000000000 -0700 @@ -0,0 +1,44 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2007 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 3 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, see . + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + +#ifndef __GNUC__ +#define __attribute__(x) +#endif + +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.opt/clobbered-registers-O2.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb/testsuite/gdb.opt/clobbered-registers-O2.exp 2007-10-08 11:20:17.000000000 -0700 @@ -0,0 +1,56 @@ +# Copyright 2007 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 not show incorrect values. + +set prms_id 0 +set bug_id 0 + +set testfile "clobbered-registers-O2" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +set compile_flags "debug optimize=-O2" + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${compile_flags}] != "" } { + untested clobbered-registers-O2.exp + 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 29.*" \ + "Insert breakpoint at problematic function" + +gdb_test continue ".*Breakpoint 2.*in start_sequence.*" \ + "Run until problematic function" + +gdb_test backtrace ".*operand0=.*operand1=.*" \ + "Check value of call clobbered registers" --=-aAa/aIKIRCu4hjVluNiS--