From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6CukKWu/tWOTTg8AWB0awg (envelope-from ) for ; Wed, 04 Jan 2023 13:03:23 -0500 Received: by simark.ca (Postfix, from userid 112) id A832E1E222; Wed, 4 Jan 2023 13:03:23 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=VSmwSUVj; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 327711E112 for ; Wed, 4 Jan 2023 13:03:23 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A6FE3858C54 for ; Wed, 4 Jan 2023 18:03:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A6FE3858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672855400; bh=IheA7gBmkeICr2WP409/mIZHkvIN1nRLVS1PpG0wtEg=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=VSmwSUVjZ+u/2pNve2UzxnE96q6aXP39jULwJjlNvbHhzgEmSk7Z7vHD2aIueJTm4 tmLmMjCMC9aSE/c5vGWhuoEmaP2t3UCFsTB7yWlhXBmal9adPfRNc3urmx/Ho0zSox K39ThFCAlx49tR0khY9yvBgP8hT3EuvGmKB18uwE= Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id 1A1D73858C53 for ; Wed, 4 Jan 2023 18:03:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A1D73858C53 Received: from ubuntu.lan (unknown [IPv6:2a02:390:9086::146]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 161578018A; Wed, 4 Jan 2023 18:02:59 +0000 (UTC) Date: Wed, 4 Jan 2023 18:02:48 +0000 To: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: use gdb_test_multiple in gdb_breakpoint Message-ID: <20230104180248.4bumo5mm4vvpjx6c@ubuntu.lan> References: <20230103192216.108444-1-simon.marchi@polymtl.ca> <20230104091559.rqo2774ba566j5sg@ubuntu.lan> <9b050608-4bb6-dbc3-69f6-ebc9ad2cc303@polymtl.ca> <20230104161817.qbvbspsqcqrjw6w2@ubuntu.lan> <7d38d82e-1beb-c3dc-441a-b4e455351020@polymtl.ca> <20230104174038.aeau2an7tmufa3pj@ubuntu.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230104174038.aeau2an7tmufa3pj@ubuntu.lan> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Wed, 04 Jan 2023 18:02:59 +0000 (UTC) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Something like this should fix the issue:. From 25585cc98812c90f819d78742243299a933ac879 Mon Sep 17 00:00:00 2001 From: Lancelot SIX Date: Wed, 4 Jan 2023 17:58:08 +0000 Subject: [PATCH] gdb: ensure test_name is initialized in gdb_breakpoint A refactoring in 4b9728bec15 (gdb: use gdb_test_multiple in gdb_breakpoint) left the $test_name variable initialized. This patch fixes this. --- gdb/testsuite/lib/gdb.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index ba16b2ab315..e17eace4cb1 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -639,8 +639,9 @@ proc gdb_breakpoint { linespec args } { set print_pass 1 } + set test_name "gdb_breakpoint: set breakpoint at $linespec" # The first two regexps are what we get with -g, the third is without -g. - gdb_test_multiple "$break_command $linespec" "gdb_breakpoint: set breakpoint at $linespec" { + gdb_test_multiple "$break_command $linespec" $test_name { -re "$break_message \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "$break_message \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "$break_message \[0-9\]* at .*$gdb_prompt $" {} -- 2.34.1 Best, Lancelot. On Wed, Jan 04, 2023 at 05:40:38PM +0000, Lancelot SIX via Gdb-patches wrote: > On Wed, Jan 04, 2023 at 11:22:55AM -0500, Simon Marchi via Gdb-patches wrote: > > > > > > On 1/4/23 11:18, Lancelot SIX wrote: > > >> Oh, right, I missed that. I folded the test name in the > > >> gdb_test_multiple call (removed the test_name var) and used > > >> $gdb_test_name in the fail call. I updated the patch locally. Should I > > >> add your Reviewed-By after those changes? > > >> > > >> Simon > > >> > > > > > > Yes, with those change, feel free to add > > > > > > Reviewed-By: Lancelot Six > > > > > > Best, > > > Lancelot. > > > > Thanks, pushed! > > > > Simon > > Hi, > > I just saw the resulting patch, and is seems that $test_name is > (conditionally) used after the gdb_test_multiple: > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 135ace68d5e..ba16b2ab315 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -639,18 +639,15 @@ proc gdb_breakpoint { linespec args } { > set print_pass 1 > } > > - set test_name "gdb_breakpoint: set breakpoint at $linespec" > - > - send_gdb "$break_command $linespec\n" > # The first two regexps are what we get with -g, the third is without -g. > - gdb_expect 30 { > + gdb_test_multiple "$break_command $linespec" "gdb_breakpoint: set breakpoint at $linespec" { > -re "$break_message \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {} > -re "$break_message \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {} > -re "$break_message \[0-9\]* at .*$gdb_prompt $" {} > -re "$break_message \[0-9\]* \\(.*\\) pending.*$gdb_prompt $" { > if {$pending_response == "n"} { > if { $print_fail } { > - fail $test_name > + fail $gdb_name_name > } > return 0 > } > @@ -659,35 +656,6 @@ proc gdb_breakpoint { linespec args } { > send_gdb "$pending_response\n" > exp_continue > } > - -re "A problem internal to GDB has been detected" { > - if { $print_fail } { > - fail "$test_name (GDB internal error)" > - } > - gdb_internal_error_resync > - return 0 > - } > - -re "$gdb_prompt $" { > - if { $print_fail } { > - fail $test_name > - } > - return 0 > - } > - eof { > - perror "GDB process no longer exists" > - global gdb_spawn_id > - set wait_status [wait -i $gdb_spawn_id] > - verbose -log "GDB process exited with wait status $wait_status" > - if { $print_fail } { > - fail "$test_name (eof)" > - } > - return 0 > - } > - timeout { > - if { $print_fail } { > - fail "$test_name (timeout)" > - } > - return 0 > - } > } > if { $print_pass } { > pass $test_name > > Just here ^ $test_name is used, but the patch does not set it anymore. > Looks like that it should become something like: > > set test_name "gdb_breakpoint: set breakpoint at $linespec" > gdb_test_multiple "$break_command $linespec" $test_name { > # unchanged > } > if { $print_pass } { > pass $test_name > } > > Sorry I missed that earlier. > > Lancelot.