public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 03/10] gdb: improve show text and help text for 'remote exec-file'
Date: Wed, 23 Aug 2023 13:36:48 +0200	[thread overview]
Message-ID: <5d8bcfd72f5ea3382ddc7794b4f5a9346c71d003.camel@klomp.org> (raw)
In-Reply-To: <e73c4987251de881f3211a767b71328629cfc334.1692200989.git.aburgess@redhat.com>

Hi Andrew,

On Wed, 2023-08-16 at 16:54 +0100, Andrew Burgess wrote:
> The current behaviour for 'show remote exec-file' is this:
> 
>   (gdb) show remote exec-file
> 
>   (gdb) set remote exec-file /abc
>   (gdb) show remote exec-file
>   /abc
>   (gdb)
> 
> The first output, the blank line, is just GDB showing the default
> empty value.
> 
> This output is not really inline with GDB's more full sentence style
> output, so in this commit I've updated things, the output is now:
> 
>   (gdb) show remote exec-file
>   The remote exec-file is unset, the default remote executable will be used.
>   (gdb) set remote exec-file /abc
>   (gdb) show remote exec-file
>   The remote exec-file is "/abc".
>   (gdb)
> 
> Which I think is more helpful to the user.
> 
> I have also updated the help text for this setting.  Previously we had
> a set/show header line, but no body text, now we have:
> 
>   (gdb) help show remote exec-file
>   Show the remote pathname for starting inferiors.
>   This is the path, on the remote target, used when starting an inferior,
>   for example with the "run", "start", or "starti" commands.
>   This setting is only useful when debugging a remote target, otherwise,
>   this setting is not used.
>   (gdb)
> 
> Which is hopefully more helpful.

Yes, I like this, much more helpful to the user.

Reviewed-by: Mark Wielaard <mark@klomp.org>
Tested-by: Mark Wielaard <mark@klomp.org>

> ---
>  gdb/remote.c                                | 15 ++++++++++++---
>  gdb/testsuite/gdb.base/remote-exec-file.exp |  7 +++++--
>  gdb/testsuite/gdb.multi/gdb-settings.exp    |  2 +-
>  3 files changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/gdb/remote.c b/gdb/remote.c
> index dc5dd24797e..6a61a0e41ac 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -1705,7 +1705,12 @@ static void
>  show_remote_exec_file (struct ui_file *file, int from_tty,
>  		       struct cmd_list_element *cmd, const char *value)
>  {
> -  gdb_printf (file, "%s\n", get_remote_exec_file ().c_str ());
> +  const std::string &filename = get_remote_exec_file ();
> +  if (filename.empty ())
> +    gdb_printf (file, _("The remote exec-file is unset, the default remote "
> +			"executable will be used.\n"));
> +  else
> +    gdb_printf (file, "The remote exec-file is \"%s\".\n", filename.c_str ());
>  }

OK.

>  static int
> @@ -15475,8 +15480,12 @@ Transfer files to and from the remote target system."),
>  
>    add_setshow_string_noescape_cmd ("exec-file", class_files,
>  				   _("\
> -Set the remote pathname for \"run\"."), _("\
> -Show the remote pathname for \"run\"."), NULL,
> +Set the remote pathname for starting inferiors."), _("\
> +Show the remote pathname for starting inferiors."), _("\
> +This is the path, on the remote target, used when starting an inferior,\n\
> +for example with the \"run\", \"start\", or \"starti\" commands.\n\
> +This setting is only useful when debugging a remote target, otherwise,\n\
> +this setting is not used."),
>  				   set_remote_exec_file_cb,
>  				   get_remote_exec_file_cb,
>  				   show_remote_exec_file,

OK.

> diff --git a/gdb/testsuite/gdb.base/remote-exec-file.exp b/gdb/testsuite/gdb.base/remote-exec-file.exp
> index 0b198630a07..1411f9636be 100644
> --- a/gdb/testsuite/gdb.base/remote-exec-file.exp
> +++ b/gdb/testsuite/gdb.base/remote-exec-file.exp
> @@ -37,10 +37,13 @@ with_test_prefix "set inf 2" {
>  
>  with_test_prefix "show inf 1" {
>      gdb_test "inferior 1" "Switching to inferior 1.*"
> -    gdb_test "show remote exec-file" "prog1"
> +    gdb_test "show remote exec-file" \
> +	"The remote exec-file is \"prog1\"\\."
> +
>  }
>  
>  with_test_prefix "show inf 2" {
>      gdb_test "inferior 2" "Switching to inferior 2.*"
> -    gdb_test "show remote exec-file" "prog2"
> +    gdb_test "show remote exec-file" \
> +	"The remote exec-file is \"prog2\"\\."
>  }

OK. New expected ouput.

> diff --git a/gdb/testsuite/gdb.multi/gdb-settings.exp b/gdb/testsuite/gdb.multi/gdb-settings.exp
> index e5922221d47..2432192ca9a 100644
> --- a/gdb/testsuite/gdb.multi/gdb-settings.exp
> +++ b/gdb/testsuite/gdb.multi/gdb-settings.exp
> @@ -90,7 +90,7 @@ foreach_with_prefix inf $inferiors {
>      gdb_test "show inferior-tty" "/inf${inf}-tty.*"
>  
>      gdb_test "with remote exec-file tmp-value -- print 1" " = 1"
> -    gdb_test "show remote exec-file" "/inf${inf}-remote-exec"
> +    gdb_test "show remote exec-file" "/inf${inf}-remote-exec.*"
>  
>      # If the inferiors are running check $_gdb_setting_str and
>      # $_gdb_setting return the correct values.

OK. the .* is necessary because there is extra text to match now.

  reply	other threads:[~2023-08-23 11:36 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 15:54 [PATCH 00/10] Improve GDB/gdbserver experience when using a local gdbserver Andrew Burgess
2023-08-16 15:54 ` [PATCH 01/10] gdb: have remote_target::extended_remote_run take the exec filename Andrew Burgess
2023-08-23  9:30   ` Alexandra Petlanova Hajkova
2023-08-16 15:54 ` [PATCH 02/10] gdb: improve how 'remote exec-file' is stored and accessed Andrew Burgess
2023-08-23  8:44   ` Alexandra Petlanova Hajkova
2023-08-16 15:54 ` [PATCH 03/10] gdb: improve show text and help text for 'remote exec-file' Andrew Burgess
2023-08-23 11:36   ` Mark Wielaard [this message]
2023-08-24  8:56   ` Alexandra Petlanova Hajkova
2023-08-16 15:55 ` [PATCH 04/10] gdb/gdbserver: add new qDefaultExecAndArgs packet Andrew Burgess
2023-08-16 16:36   ` Eli Zaretskii
2023-08-28 15:35   ` Tom Tromey
2023-08-16 15:55 ` [PATCH 05/10] gdb: detect when gdbserver has no default executable set Andrew Burgess
2023-08-16 15:55 ` [PATCH 06/10] gdb: make use of is_target_filename Andrew Burgess
2023-08-23 13:35   ` Mark Wielaard
2023-08-16 15:55 ` [PATCH 07/10] gdb: add qMachineId packet Andrew Burgess
2023-08-16 16:34   ` Eli Zaretskii
2023-08-25 14:49     ` Andrew Burgess
2023-08-25 15:01       ` Eli Zaretskii
2023-09-26 14:42         ` Andrew Burgess
2023-09-29  7:45           ` Eli Zaretskii
2023-08-22  2:39   ` Thiago Jung Bauermann
2023-08-23  9:24   ` Mark Wielaard
2023-08-23 11:36     ` Andrew Burgess
2023-08-28 16:06   ` Tom Tromey
2023-08-16 15:55 ` [PATCH 08/10] gdb: remote filesystem can be local to GDB in some cases Andrew Burgess
2023-08-16 16:40   ` Eli Zaretskii
2023-08-16 15:55 ` [PATCH 09/10] gdb: use exec_file with remote targets when possible Andrew Burgess
2023-08-16 15:55 ` [PATCH 10/10] gdb: remote the get_remote_exec_file function Andrew Burgess
2023-08-23 13:42   ` Mark Wielaard
2023-08-22 10:41 ` [PATCH 00/10] Improve GDB/gdbserver experience when using a local gdbserver Alexandra Petlanova Hajkova
2023-08-23 14:32 ` Mark Wielaard
2023-08-23 15:26   ` Andrew Burgess
2023-08-25 15:34 ` [PATCHv2 " Andrew Burgess
2023-08-25 15:34   ` [PATCHv2 01/10] gdb: have remote_target::extended_remote_run take the exec filename Andrew Burgess
2023-08-25 15:34   ` [PATCHv2 02/10] gdb: improve how 'remote exec-file' is stored and accessed Andrew Burgess
2023-08-25 15:34   ` [PATCHv2 03/10] gdb: improve show text and help text for 'remote exec-file' Andrew Burgess
2023-08-25 15:34   ` [PATCHv2 04/10] gdb/gdbserver: add new qDefaultExecAndArgs packet Andrew Burgess
2023-08-26  6:46     ` Eli Zaretskii
2023-08-25 15:34   ` [PATCHv2 05/10] gdb: detect when gdbserver has no default executable set Andrew Burgess
2023-08-25 15:34   ` [PATCHv2 06/10] gdb: make use of is_target_filename Andrew Burgess
2023-08-25 15:34   ` [PATCHv2 07/10] gdb: add qMachineId packet Andrew Burgess
2023-08-26  6:54     ` Eli Zaretskii
2023-08-25 15:34   ` [PATCHv2 08/10] gdb: remote filesystem can be local to GDB in some cases Andrew Burgess
2023-08-26  6:49     ` Eli Zaretskii
2023-08-25 15:34   ` [PATCHv2 09/10] gdb: use exec_file with remote targets when possible Andrew Burgess
2023-08-25 15:34   ` [PATCHv2 10/10] gdb: remove the get_remote_exec_file function 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=5d8bcfd72f5ea3382ddc7794b4f5a9346c71d003.camel@klomp.org \
    --to=mark@klomp.org \
    --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).