From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id C05A13858C78 for ; Fri, 12 May 2023 13:50:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C05A13858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.170] (unknown [167.248.160.41]) (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 308781E0D4; Fri, 12 May 2023 09:50:41 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1683899441; bh=q2jcBCZSwFMDqeIehBK1EAlDbAqG8HURY/VajH3WwKo=; h=Date:Subject:To:References:From:In-Reply-To:From; b=UEnMkE91RU869vlzFdN5Dg/dqGut/RwiEGQKeCeDVkxoQDVgboUkoFlkp4hQrJBg/ bpyZTC0zR0z8phqBgeCKL+Id7hCnpKQ3Kay60ocdDS6Rq1tsdnhkTKQvgSKv3e5et1 C7Lm6RG+ehIBiGSDigUcKWDPeG4T3QerWUMETsmo= Message-ID: Date: Fri, 12 May 2023 09:50:40 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] gdb/testsuite: make gdb_supported_languages a caching proc Content-Language: fr To: Andrew Burgess , gdb-patches@sourceware.org References: From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,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 List-Id: On 5/12/23 06:00, Andrew Burgess via Gdb-patches wrote: > Rewrite gdb_supported_languages as a caching proc that actually > queries GDB for the list of supported languages, rather than just > containing a hard-coded list of languages. > > There's only one test that uses this proc right now, > gdb.python/py-function.exp, and that still passes after this change, > with no changes in the test names. > --- > gdb/testsuite/lib/gdb.exp | 27 ++++++++++++++++++++++----- > 1 file changed, 22 insertions(+), 5 deletions(-) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 010da097766..52af0c7358f 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -8591,11 +8591,28 @@ proc cd { dir } { > } > > # Return a list of all languages supported by GDB, suitable for use in > -# 'set language NAME'. This doesn't include either the 'local' or > -# 'auto' keywords. > -proc gdb_supported_languages {} { > - return [list c objective-c c++ d go fortran modula-2 asm pascal \ > - opencl rust minimal ada] > +# 'set language NAME'. This doesn't include the languages auto, > +# local, or unknown. > +gdb_caching_proc gdb_supported_languages {} { > + # The extra space after 'complete set language ' in the command below is > + # critical. Only with that space will GDB complete the next level of > + # the command, i.e. fill in the actual language names. > + set output [remote_exec host $::GDB "$::INTERNAL_GDBFLAGS -batch -ex \"complete set language \""] > + > + set langs {} > + if {[lindex $output 0] == 0} { Maybe error out if the exit status is not 0? Otherwise: Approved-By: Simon Marchi Simon