From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Dragos Tatulea <dragos.tatulea@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Bug 10645: small additions to existing testcase
Date: Wed, 04 Aug 2010 22:57:00 -0000 [thread overview]
Message-ID: <20100804225728.GA2835@host1.dyn.jankratochvil.net> (raw)
In-Reply-To: <AANLkTimgPBkpneh78XQwhboJHU7iPksTVeB=us4N8w2S@mail.gmail.com>
On Tue, 03 Aug 2010 10:11:09 +0200, Dragos Tatulea wrote:
> ---
> gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c | 45 +++++++
> .../gdb.base/watchpoint-hw-unreadable.exp | 127 ++++++++++++++++++++
> 2 files changed, 172 insertions(+), 0 deletions(-)
> create mode 100644 gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c
> create mode 100644 gdb/testsuite/gdb.base/watchpoint-hw-unreadable.exp
>
A GNU ChangeLog entry is missing.
> diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c b/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c
> new file mode 100644
> index 0000000..887c293
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.c
> @@ -0,0 +1,45 @@
> +/* This testcase is part of GDB, the GNU debugger.
> +
> + Copyright 2009 Free Software Foundation, Inc.
^^^^ The date should include also 2010.
[...]
> diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.exp b/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.exp
> new file mode 100644
> index 0000000..034972f
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/watchpoint-hw-unreadable.exp
> @@ -0,0 +1,127 @@
> +# Copyright 2009 Free Software Foundation, Inc.
^^^^ The date should include also 2010.
[...]
> +# Tests watchpoints.
> +# Input: Array of list containing the folowing elements:
> +# 1: W_NAME - watched var name
> +# 2: W_ID - watched var id
> +# 3: OLD_VAL - expected old val
> +# 4: NEW_VAL - expected new val
> +proc gdb_watch_test {arg_array} {
> + upvar $arg_array arg_arr
> + global test
> + global gdb_prompt
> +
> + set expect_output "\r\ninfrun: stopped by watchpoint\r\n.*"
> + foreach {k v} [array get arg_arr] {
> + set w_name [lindex $v 0]
> + set w_id [lindex $v 1]
> + set old_val [lindex $v 2]
> + set new_val [lindex $v 3]
> +
> + set expect_output "$expect_output\r\nHardware watchpoint $w_id: \\$w_name\[\r\n\]+Old value = $old_val\r\nNew value = $new_val"
> + }
> +
> + gdb_test_multiple "continue" $test {
> + -re "$expect_output.*$gdb_prompt $" {
> + #puts "PASS"
> + pass $test
> + }
> + default {
> + #puts "FAIL"
> + fail $test
> + return 0
> + }
I do not see why you could not use simple gdb_test here instead of
gdb_test_multiple.
[...]
> + || [target_info exists gdb,no_hardware_watchpoints]} then {
> + verbose "Skipping watchpoint-hw test."
^^^^^^^^^^^^^ This testfile is named differently.
[...]
> +gdb_test "set debug infrun 1"
^^^^^^^^ -> gdb_test_no_output nowadays.
Not an issue for this patch:
gdb_test could sanity check it must be given some expect string.
> +gdb_test "show debug infrun" "Inferior debugging is 1\\."
> +
> +gdb_test "watch *p" "ardware watchpoint 2: \\\*p"
> +gdb_test "watch **pp" "ardware watchpoint 3: \\\*\\\*pp"
> +set test "catch *p"
All the testcases generate:
PASS: gdb.base/watchpoint-hw-unreadable.exp: catch *p
PASS: gdb.base/watchpoint-hw-unreadable.exp: catch *p
PASS: gdb.base/watchpoint-hw-unreadable.exp: catch *p
The testcase names should be unique.
> +set c(0) [list *p 2 9 10]
> +set c(1) [list **pp 3 9 10]
> +gdb_watch_test c
> +unset c
Just such a qustion, maybe to simplify all the upvar, unset, set lines etc.
using just some?
gdb_watch_test {{*p 2 9 10} {**pp 3 9 10}}
Thanks,
Jan
prev parent reply other threads:[~2010-08-04 22:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-30 21:13 Dragos Tatulea
2010-08-03 8:11 ` Dragos Tatulea
2010-08-04 22:57 ` Jan Kratochvil [this message]
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=20100804225728.GA2835@host1.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=dragos.tatulea@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).