From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id B1307398B898 for ; Wed, 9 Jun 2021 15:15:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B1307398B898 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 159FF2eA028161 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 9 Jun 2021 11:15:06 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 159FF2eA028161 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)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1F0841E813; Wed, 9 Jun 2021 11:15:02 -0400 (EDT) Subject: Re: [PATCH] gdb/testsuite: capture GDB tty name in default_gdb_spawn To: Tom Tromey , Simon Marchi via Gdb-patches References: <20210608212126.1673188-1-simon.marchi@polymtl.ca> <874ke7jcrv.fsf@tromey.com> From: Simon Marchi Message-ID: <269336aa-5500-c03e-9e00-81279c24e5be@polymtl.ca> Date: Wed, 9 Jun 2021 11:15:01 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <874ke7jcrv.fsf@tromey.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 Wed, 9 Jun 2021 15:15:02 +0000 X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Wed, 09 Jun 2021 15:15:08 -0000 On 2021-06-09 11:09 a.m., Tom Tromey wrote: > Simon> + # Capture GDB's TTY name, so we can save it below. > Simon> + rename spawn builtin_spawn > Simon> + rename spawn_capture_tty_name spawn > Simon> + set code [catch {uplevel 1 { > Simon> + remote_spawn host "$::GDB $::INTERNAL_GDBFLAGS $::GDBFLAGS [host_info gdb_opts]" > Simon> + }} res] > Simon> + rename spawn spawn_capture_tty_name > Simon> + rename builtin_spawn spawn > Simon> + > Simon> + # If remote_spawn threw an error, propagate it. > Simon> + if { $code == 1 } { > Simon> + return -code $code -errorinfo $::errorInfo -errorcode $::errorCode $res > Simon> + } > > It would be simpler to just always rename+wrap spawn, and then only > stash the result in this particular case. However, it's also fine this > way. Yeah, I wanted to avoid overriding it all the time, to avoid bad suprises. Although if we don't introduce bugs, it should be fine ;). Simon