From: Daniel Jacobowitz <drow@false.org>
To: Luis Machado <luisgpm@linux.vnet.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] PPC Call-clobbered registers testcase
Date: Wed, 24 Oct 2007 21:00:00 -0000 [thread overview]
Message-ID: <20071024205901.GS10943@caradoc.them.org> (raw)
In-Reply-To: <1193180757.5333.3.camel@localhost>
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 <luisgpm@br.ibm.com>
>
> * 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 <value optimized out> 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 <value optimized out> 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 = (<value optimized out>|13)"
gdb_test "print operand1" \
"\\\$$decimal = (<value optimized out>|14)"
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2007-10-24 20:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-24 14:41 Luis Machado
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 [this message]
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=20071024205901.GS10943@caradoc.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=luisgpm@linux.vnet.ibm.com \
/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