From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id n7roLYqL+WAGUwAAWB0awg (envelope-from ) for ; Thu, 22 Jul 2021 11:15:22 -0400 Received: by simark.ca (Postfix, from userid 112) id A83C41EDFB; Thu, 22 Jul 2021 11:15:22 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 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 5849E1E4A3 for ; Thu, 22 Jul 2021 11:15:21 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 865E5387101B for ; Thu, 22 Jul 2021 15:15:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 865E5387101B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626966920; bh=mFPgoD/Ro6LA6gEzxH20c0ERVVDXCU3xPW7lVHGYC4M=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=OQVdhkn/8CZ2YkaHwvYoa0WtNbTFVkSFbLmj0kbnkUQI7KmbmWMN2oOYtgtEuzcfX U1C5aNis816vkPSeVq7dDhmL+suLOEiJX8dLDiIAtSOVT8CdIxFUSUjpoJ3X3ZVvh3 fbE45lhfiyT2cMfa38EXIWRZ7CE5Lv7OyfMAlg4w= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 057A3385801A for ; Thu, 22 Jul 2021 15:14:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 057A3385801A Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 16MFEkv1032696 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Jul 2021 11:14:51 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 16MFEkv1032696 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 8B8A61E4A3; Thu, 22 Jul 2021 11:14:46 -0400 (EDT) Subject: Re: [PATCH] Fix the crash at the end of the runtest To: Andrew Burgess , Bernd Edlinger References: <20210722124457.GC1872618@embecosm.com> <20210722132020.GD1872618@embecosm.com> Message-ID: Date: Thu, 22 Jul 2021 11:14:46 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210722132020.GD1872618@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 22 Jul 2021 15:14:46 +0000 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: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: "gdb-patches@sourceware.org" Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2021-07-22 9:20 a.m., Andrew Burgess wrote: > Here's my proposed fix, along with an explanation of what's going on. > > Thanks, > Andrew > > --- > > commit c6d3cd6e265dd39a27d13428eba48df8c1d50c95 > Author: Andrew Burgess > Date: Thu Jul 22 14:07:15 2021 +0100 > > gdb/testsuite: don't error when trying to unset last_spawn_tty_name > > In spawn_capture_tty_name (lib/gdb.exp) we either set or unset > last_spawn_tty_name depending on whether spawn_out exists or not. > > One situation that might cause spawn_out to not exists is if the spawn > function is called with the argument -leaveopen, which is how it is > called when processes are created as part of a pipeline, the created > process has no tty, instead its output is written to a file > descriptor. > > If a pipe line is created consisting of multiple processes then there > will be multiple sequential calls to spawn, all using -leaveopen. The > first of these calls is fine, no spawn_out is set, and so in > spawn_capture_tty_name we unset last_spawn_tty_name. However, on the > second call to spawn there is still no spawn_out and so in > spawn_capture_tty_name we again try to unset last_spawn_tty_name, this > now throws an error. > > Fix this issue by using -nocomplain with the call to unset in > spawn_capture_tty_name. > > Before this commit I was seeing gdb.base/gnu-debugdata.exp report 1 > pass, and 1 unsupported test. After this commit I now see 16 passes > from this test script. > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index e79e0622f9d..8712669bdce 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -2032,7 +2032,7 @@ proc spawn_capture_tty_name { args } { > if { [info exists spawn_out] } { > set ::last_spawn_tty_name $spawn_out(slave,name) Not caused by your patch, but: pedantically, the "if" should perhaps verify that "spawn_out(slave,name)" specifically exists, not just "spawn_out". Currently (according to "man expect"), "spawn_out(slave,name)" is the only possible "spawn_out" contents. But let's say that the next Expect version sets "spawn_out(foo)", then that code will break (we will enter the "if" and try to read "spawn_out(slave,name)", which may not exist). > } else { > - unset ::last_spawn_tty_name > + unset -nocomplain ::last_spawn_tty_name Perhaps a small comment above this line would be nice. Otherwise, LGTM with or without changes, thanks for looking into it. Simon