From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 39D923858005 for ; Wed, 12 Apr 2023 21:08:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 39D923858005 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681333730; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wafnNOyK+lY+KtyQUAsjkYGAIbOo7jn4QbZrvx89ic0=; b=fpAp6zSXYaueCU0nKgaLcDCJuLuAqgVDcalGAVLnoFXsDHss/zNdeDtvfbF8wCTSkmsU2Y LFfdS0LotRYo6FVMze355ysMvfmaBIr6qhGDLbdjLGkIUMsLBdUNqtgQxWAtWem4Kk5PyT TdEgx0cuWYI0py02fW5NNrqhMDbjiSU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-591-ffDp7NSNM4G3ZJIOu65GSQ-1; Wed, 12 Apr 2023 17:08:49 -0400 X-MC-Unique: ffDp7NSNM4G3ZJIOu65GSQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8A040811E7C for ; Wed, 12 Apr 2023 21:08:49 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.242.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 043B2492C13 for ; Wed, 12 Apr 2023 21:08:48 +0000 (UTC) From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= To: gdb-patches@sourceware.org Subject: [PATCH] gdb.base/watchpoint-unaligned.exp: Fix TCL error. Date: Wed, 12 Apr 2023 23:08:46 +0200 Message-Id: <20230412210846.127441-1-ahajkova@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Alexandra Hajkova 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