From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9148 invoked by alias); 24 Oct 2007 20:59:11 -0000 Received: (qmail 9132 invoked by uid 22791); 24 Oct 2007 20:59:10 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 24 Oct 2007 20:59:04 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 5A3AA98343; Wed, 24 Oct 2007 20:59:03 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 15FB5981F2; Wed, 24 Oct 2007 20:59:03 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1IknJd-0005wH-Un; Wed, 24 Oct 2007 16:59:01 -0400 Date: Wed, 24 Oct 2007 21:00:00 -0000 From: Daniel Jacobowitz To: Luis Machado Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] PPC Call-clobbered registers testcase Message-ID: <20071024205901.GS10943@caradoc.them.org> Mail-Followup-To: Luis Machado , gdb-patches@sourceware.org References: <1190644886.4375.2.camel@localhost> <1190726512.4376.0.camel@localhost> <20071006161230.GA10179@caradoc.them.org> <1191869140.4322.10.camel@localhost> <20071008185507.GA28479@caradoc.them.org> <1191870400.4322.13.camel@localhost> <20071008191416.GA30019@caradoc.them.org> <1193180757.5333.3.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1193180757.5333.3.camel@localhost> User-Agent: Mutt/1.5.15 (2007-04-09) 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/msg00629.txt.bz2 On Tue, Oct 23, 2007 at 08:05:57PM -0300, Luis Machado wrote: > Hi, > > I've modified the patch to reflect the behaviour on x86 systems. On x86 > it shows the values, but they're incorrectly shown as being equal, and > they shouldn't be. > > On ppc they're expected to be "optmized out". > > This patch includes a new directory, "gdb.opt", for testing optimized > binaries. > > Does this look OK? No, sorry, but you're going the right direction :-) > 2007-10-23 Luis Machado > > * gdb.opt/clobbered-registers-O2.c: New testcase source file. > * gdb.opt/clobbered-registers-O2.exp: New testcase expect file. > * gdb.opt/Makefile.in: New makefile > * Makefile.in: Create new directory "gdb.opt" > * configure.ac: Add "gdb.opt" directory > * configure: Add "gdb.opt" directory Periods at the end of entries. You should just say "Regenerated." for things like the configure script. > + Please email any bugs, comments, and/or additions to this file to: > + bug-gdb@prep.ai.mit.edu */ It's not a big deal, but please don't add this to new files. I don't think that address has worked in a decade or more. We should get rid of it. > +send_gdb "frame 1\n" > + > +gdb_expect 10 { > + -re "#1.*in gen_movsd.*" { pass "frame 1 backtrace" } > + default { fail "frame 1 backtrace error" } > +} Please avoid using send_gdb or gdb_expect, unless you have special needs for them. If you have only one pass pattern, use gdb_test; if you have more than one, use gdb_test_multiple. It works like gdb_expect but includes the send_gdb and handles all sorts of unexpected output for you. > +gdb_expect 5 { > + -re "\\$\[0-9\]* = <(.*)>.*$gdb_prompt $" { > + set operand0 "optimized" > + } No need for the wildcare here. You can match or however that's spelled. Also, you need one more backslash on the $; the two \\ become a backslash in the regular expression, but that leaves the unescaped $ at risk of TCL variable expansion. > +set result1 [string compare $operand0 "optimized"] > +set result2 [string compare $operand1 "optimized"] > + > +# The PowerPC test ends here. If both values are optimized, then > +# we are fine with it. > +if {!$result1 && !$result2} { > + pass "Both values were optimized" > + return > +} > + > +# This is a x86-specific test since it doesn't show the values > +# as optimized, but they appear as equal values. That is > +# incorrect. > +set result1 [string compare $operand0 $operand1] > + > +if {!$result1} { > + fail "Values are displayed but are incorrect" > + return -1 > +} Every test should be either pass or fail, and it should pass and fail with the same message. We make an exception in the GDB testsuite, by allowing (reason) after a failure message, but that's it. This suggests a simpler formulation for your test. What are you trying to avoid? Incorrect values. So is a pass, and 13 (or 14 for the second one) is a pass, and everything else is a fail. gdb_test "print operand0" \ "\\\$$decimal = (|13)" gdb_test "print operand1" \ "\\\$$decimal = (|14)" -- Daniel Jacobowitz CodeSourcery