public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/testsuite: make gdb_supported_languages a caching proc
Date: Fri, 12 May 2023 09:50:40 -0400	[thread overview]
Message-ID: <cf3aa159-544e-986a-36f1-3e1a2a52ef50@simark.ca> (raw)
In-Reply-To: <e6eacf59606493fcd6a5401443c590f3b404f670.1683885563.git.aburgess@redhat.com>

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.marchi@efficios.com>

Simon

  reply	other threads:[~2023-05-12 13:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 10:00 Andrew Burgess
2023-05-12 13:50 ` Simon Marchi [this message]
2023-05-16 10:38   ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf3aa159-544e-986a-36f1-3e1a2a52ef50@simark.ca \
    --to=simark@simark.ca \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).