Message ID | 20230425104732.126979-1-ahajkova@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 56C153858C20 for <patchwork@sourceware.org>; Tue, 25 Apr 2023 10:48:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 56C153858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682419680; bh=2aabisfFPIa12+26aJ/mJiFpAB8JlPjZJHcJN6NTJ6U=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Jl/RSBxgXnCcp48Hrjzj0LXZDDvEchbYSEnPz2I6J4H/gguhS9i2T04YWCbtH6zFj gaJ9LWcrhv+eB1x4qiMsX3G0NumAhfiogTNa6Izw/MbkijdiS6OCesS7Q5FFElsHNF bIWwqiifsbtMk+0rJLaOfzDh6Lrbd/RHYzCWRFwg= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0FF7F3858D1E for <gdb-patches@sourceware.org>; Tue, 25 Apr 2023 10:47:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FF7F3858D1E Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-632-EU5xmCqVMhOy4sqcfIiTgQ-1; Tue, 25 Apr 2023 06:47:35 -0400 X-MC-Unique: EU5xmCqVMhOy4sqcfIiTgQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 449841C05148 for <gdb-patches@sourceware.org>; Tue, 25 Apr 2023 10:47:35 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.242.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A924614171B8 for <gdb-patches@sourceware.org>; Tue, 25 Apr 2023 10:47:34 +0000 (UTC) To: gdb-patches@sourceware.org Subject: [PATCH v2] gdb.base/watchpoint-unaligned.exp: Always initialize wpoffset_to_wpnum Date: Tue, 25 Apr 2023 12:47:32 +0200 Message-Id: <20230425104732.126979-1-ahajkova@redhat.com> In-Reply-To: <20230412210846.127441-1-ahajkova@redhat.com> References: <20230412210846.127441-1-ahajkova@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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.8 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: =?utf-8?q?Alexandra_H=C3=A1jkov=C3=A1_via_Gdb-patches?= <gdb-patches@sourceware.org> Reply-To: =?utf-8?q?Alexandra_H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
[v2] gdb.base/watchpoint-unaligned.exp: Always initialize wpoffset_to_wpnum
|
|
Commit Message
Alexandra Petlanova Hajkova
April 25, 2023, 10:47 a.m. UTC
to avoid TCL error which happens in some aarch64 types. ERROR: in testcase /root/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/watchpoint-unaligned.exp 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 while executing Fixes bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30340 --- The test uses gdb_test_multiple, and there are plenty of other reasons (see gdb_test_multiple in lib/gdb.exp) that a test using gdb_test_multiple might fail. We're never going to recreate each of those in the gdb.base/watchpoint-unaligned.exp script just so that we can ensure the variable is initialized. Instead we should just ensure the variable is always initialized. gdb/testsuite/gdb.base/watchpoint-unaligned.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Hi, On 4/25/23 11:47, Alexandra Hájková via Gdb-patches wrote: > to avoid TCL error which happens in some aarch64 types. > > ERROR: in testcase /root/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/watchpoint-unaligned.exp > 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 > while executing > > Fixes bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30340 > --- > The test uses gdb_test_multiple, and there are plenty of other reasons (see gdb_test_multiple in lib/gdb.exp) that a test using gdb_test_multiple might fail. We're never going to recreate each of those in the gdb.base/watchpoint-unaligned.exp script just so that we can ensure the variable is initialized. Instead we should just ensure the variable is always initialized. > > gdb/testsuite/gdb.base/watchpoint-unaligned.exp | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp > index ce5a1e5bf66..d31a9cdc2c8 100644 > --- a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp > +++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp > @@ -103,6 +103,8 @@ foreach wpcount {4 7} { > for {set wpoffset 1} {$wpoffset <= $wpcount} {incr wpoffset} { > set test "$rwatch data.u.size1\[$wpoffset\]" > set wpnum "" > + # Initialize the result incase the test fails. > + set wpoffset_to_wpnum($wpoffset) 0 > gdb_test_multiple $test $test { > -re "$rwatch_exp (\[0-9\]+): .*\r\n$gdb_prompt $" { > set wpoffset_to_wpnum($wpoffset) $expect_out(1,string) > @@ -113,7 +115,6 @@ foreach wpcount {4 7} { > setup_xfail breakpoints/23131 "arm*-*-*" > } > fail $test > - set wpoffset_to_wpnum($wpoffset) 0 > } > } > } Thanks. I think this approach is a reasonable one. Reviewed-by: Luis Machado <luis.machado@arm.com>
Alexandra Hájková via Gdb-patches <gdb-patches@sourceware.org> writes: > to avoid TCL error which happens in some aarch64 types. Commit messages should ideally be written as proper sentences, so start with a capital letter. > > ERROR: in testcase /root/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/watchpoint-unaligned.exp > 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 > while executing > > Fixes bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30340 Looking through the commit log there's only one other instances of 'Fixes bug:', the GDB style is usually just 'Bug:' -- being consistent makes it much easier to search for these labels. Also, at one point we had to reference the traditional bug tag in order to get this commit automatically linked with the bugzilla report - so we needed to include something like 'PR gdb/30340'. I don't know if this is still needed or not -- I've never bothered to find out as I just include both forms. > --- > The test uses gdb_test_multiple, and there are plenty of other reasons (see gdb_test_multiple in lib/gdb.exp) that a test using gdb_test_multiple might fail. We're never going to recreate each of those in the gdb.base/watchpoint-unaligned.exp script just so that we can ensure the variable is initialized. Instead we should just ensure the variable is always initialized. It's not clear if this is intended to be part of the commit message or not. It seems like there's helpful text in here, but it's not wrapped to a reasonable width. That said, for such a small change, maybe we don't need to include any additional text, folk can just figure out what's going on from the code change. > > gdb/testsuite/gdb.base/watchpoint-unaligned.exp | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp > index ce5a1e5bf66..d31a9cdc2c8 100644 > --- a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp > +++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp > @@ -103,6 +103,8 @@ foreach wpcount {4 7} { > for {set wpoffset 1} {$wpoffset <= $wpcount} {incr wpoffset} { > set test "$rwatch data.u.size1\[$wpoffset\]" > set wpnum "" > + # Initialize the result incase the test fails. > + set wpoffset_to_wpnum($wpoffset) 0 > gdb_test_multiple $test $test { > -re "$rwatch_exp (\[0-9\]+): .*\r\n$gdb_prompt $" { > set wpoffset_to_wpnum($wpoffset) $expect_out(1,string) > @@ -113,7 +115,6 @@ foreach wpcount {4 7} { > setup_xfail breakpoints/23131 "arm*-*-*" > } > fail $test > - set wpoffset_to_wpnum($wpoffset) 0 > } > } > } The change itself looks great. Reviewed-By: Andrew Burgess <aburgess@redhat.com> Thanks, Andrew > -- > 2.40.0
>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:
Andrew> Also, at one point we had to reference the traditional bug tag in order
Andrew> to get this commit automatically linked with the bugzilla report - so we
Andrew> needed to include something like 'PR gdb/30340'. I don't know if this
Andrew> is still needed or not -- I've never bothered to find out as I just
Andrew> include both forms.
Either form is recognized by the commit script now. I tend to leave out
the old form and just rely on the Bug trailer now, though I've found
that sometimes referencing the bug leads to clearer text.
Tom
Tom Tromey <tom@tromey.com> writes: >>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes: > > Andrew> Also, at one point we had to reference the traditional bug tag in order > Andrew> to get this commit automatically linked with the bugzilla report - so we > Andrew> needed to include something like 'PR gdb/30340'. I don't know if this > Andrew> is still needed or not -- I've never bothered to find out as I just > Andrew> include both forms. > > Either form is recognized by the commit script now. I tend to leave out > the old form and just rely on the Bug trailer now, though I've found > that sometimes referencing the bug leads to clearer text. Thanks, I missed when this changed. I'll try keep this in mind for future patches. Thanks, Andrew
diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp index ce5a1e5bf66..d31a9cdc2c8 100644 --- a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp +++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp @@ -103,6 +103,8 @@ foreach wpcount {4 7} { for {set wpoffset 1} {$wpoffset <= $wpcount} {incr wpoffset} { set test "$rwatch data.u.size1\[$wpoffset\]" set wpnum "" + # Initialize the result incase the test fails. + set wpoffset_to_wpnum($wpoffset) 0 gdb_test_multiple $test $test { -re "$rwatch_exp (\[0-9\]+): .*\r\n$gdb_prompt $" { set wpoffset_to_wpnum($wpoffset) $expect_out(1,string) @@ -113,7 +115,6 @@ foreach wpcount {4 7} { setup_xfail breakpoints/23131 "arm*-*-*" } fail $test - set wpoffset_to_wpnum($wpoffset) 0 } } }