public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: John Baldwin <jhb@FreeBSD.org>, gdb-patches@sourceware.org
Subject: Re: [PATCH 3/4] Add a have_native_target helper function for use with require.
Date: Thu, 6 Jul 2023 12:24:10 -0400	[thread overview]
Message-ID: <c24f7241-38de-c3c4-073a-924b1fe2fa4a@simark.ca> (raw)
In-Reply-To: <20230526175742.66885-4-jhb@FreeBSD.org>

> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 133d914aff8..128c0779b69 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -9739,6 +9739,23 @@ gdb_caching_proc have_compile_and_link_flag { flag } {
>  		additional_flags=$flag]
>  }
>  
> +# Return 1 if this GDB is configured with a "native" target.
> +
> +gdb_caching_proc have_native_target {} {
> +    global gdb_prompt
> +
> +    set test "help target native"
> +    gdb_test_multiple $test $test {
> +	-re "Undefined target command.*$gdb_prompt $" {
> +	    return 0
> +	}
> +	-re "Native process.*$gdb_prompt $" {
> +	    return 1
> +	}
> +    }
> +    return 0
> +}
Touching this code would be an opportunity to modernize it.  I think
that if you do:

  gdb_test_multiple "help target native"  "" {

the command is automatically used as the test name (so, no need for the
test variable).

Then, instead of having "$gdb_prompt $", you can probably use -wrap:

  -re -wrap "Undefined target command.*"

  -re -wrap "Native process.*"

Simon


  reply	other threads:[~2023-07-06 16:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26 17:57 [PATCH 0/4] Handle null inferiors in target::read_description John Baldwin
2023-05-26 17:57 ` [PATCH 1/4] *-fbsd-nat: Handle null inferior in read_description John Baldwin
2023-07-06 16:18   ` Simon Marchi
2023-07-06 16:56     ` John Baldwin
2023-05-26 17:57 ` [PATCH 2/4] *-linux-nat: " John Baldwin
2023-06-12  8:56   ` Luis Machado
2023-06-12 17:43     ` John Baldwin
2023-05-26 17:57 ` [PATCH 3/4] Add a have_native_target helper function for use with require John Baldwin
2023-07-06 16:24   ` Simon Marchi [this message]
2023-07-06 17:18     ` John Baldwin
2023-05-26 17:57 ` [PATCH 4/4] Test that native targets can read a tdesc without a process attached John Baldwin
2023-06-09 16:55 ` [PING] [PATCH 0/4] Handle null inferiors in target::read_description John Baldwin
2023-06-30 14:22   ` John Baldwin

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=c24f7241-38de-c3c4-073a-924b1fe2fa4a@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.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).