From: "Alexandra Hájková" <ahajkova@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] gdb.base/watchpoint-unaligned.exp: Fix TCL error.
Date: Wed, 12 Apr 2023 23:08:46 +0200 [thread overview]
Message-ID: <20230412210846.127441-1-ahajkova@redhat.com> (raw)
From: Alexandra Hajkova <ahajkova@redhat.com>
When running this test on aarch64 I've got TCL error:
ERROR: can't read "wpoffset_to_wpnum(1)": no such element in array
ERROR: tcl error code TCL READ VARNAME
ERROR: tcl error info:
can't read "wpoffset_to_wpnum(1)": no such element in array ...
This patch adds checks whether the wpoffset_to_wpnum array member
exists to avoid the error.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30340
---
.../gdb.base/watchpoint-unaligned.exp | 38 ++++++++++---------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp
index ce5a1e5bf66..d470368a6e3 100644
--- a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp
@@ -121,27 +121,31 @@ foreach wpcount {4 7} {
gdb_test_no_output -nopass "set variable offset = 1"
set test "continue"
set got_hit 0
- gdb_test_multiple $test $test {
- -re "\r\nCould not insert hardware watchpoint .*\r\n$gdb_prompt $" {
- }
- -re "$rwatch_exp $wpoffset_to_wpnum(1):.*alue = .*\r\n$gdb_prompt $" {
- set got_hit 1
- send_gdb "continue\n"
- exp_continue
- }
- -re " start_again .*\r\n$gdb_prompt $" {
- }
+ if {[info exists wpoffset_to_wpnum(1)]} {
+ gdb_test_multiple $test $test {
+ -re "\r\nCould not insert hardware watchpoint .*\r\n$gdb_prompt $" {
+ }
+ -re "$rwatch_exp $wpoffset_to_wpnum(1):.*alue = .*\r\n$gdb_prompt $" {
+ set got_hit 1
+ send_gdb "continue\n"
+ exp_continue
+ }
+ -re " start_again .*\r\n$gdb_prompt $" {
+ }
+ }
}
for {set wpoffset 1} {$wpoffset <= $wpcount} {incr wpoffset} {
- if {$wpoffset_to_wpnum($wpoffset)} {
- gdb_test_no_output "delete $wpoffset_to_wpnum($wpoffset)" ""
- }
+ if {[info exists wpoffset_to_wpnum($wpoffset)] &&
+ $wpoffset_to_wpnum($wpoffset)} {
+ gdb_test_no_output "delete $wpoffset_to_wpnum($wpoffset)" ""
+ }
}
set test "wpcount($wpcount)"
- if {!$wpoffset_to_wpnum([expr $wpcount - 1])} {
- untested $test
- continue
- }
+ if {[info exists wpoffset_to_wpnum([expr $wpcount - 1])] &&
+ !$wpoffset_to_wpnum([expr $wpcount - 1])} {
+ untested $test
+ continue
+ }
if {$wpcount > 4} {
if {![istarget "s390*-*-*"]} {
setup_kfail tdep/22389 *-*-*
--
2.39.2
next reply other threads:[~2023-04-12 21:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 21:08 Alexandra Hájková [this message]
2023-04-13 13:55 ` Luis Machado
2023-04-25 10:47 ` [PATCH v2] gdb.base/watchpoint-unaligned.exp: Always initialize wpoffset_to_wpnum Alexandra Hájková
2023-05-02 11:34 ` Luis Machado
2023-05-02 13:50 ` Andrew Burgess
2023-05-02 14:53 ` Tom Tromey
2023-05-05 16:23 ` Andrew Burgess
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=20230412210846.127441-1-ahajkova@redhat.com \
--to=ahajkova@redhat.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).