]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: improve show text and help text for 'remote exec-file'
authorAndrew Burgess <aburgess@redhat.com>
Thu, 20 Jul 2023 10:12:40 +0000 (11:12 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Sun, 14 Sep 2025 14:57:09 +0000 (15:57 +0100)
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 file name for starting inferiors.
  This is the file name, 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 I think is more helpful.

Reviewed-By: Mark Wielaard <mark@klomp.org>
Tested-By: Mark Wielaard <mark@klomp.org>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/remote.c
gdb/testsuite/gdb.base/remote-exec-file.exp
gdb/testsuite/gdb.multi/gdb-settings.exp

index 5535afbc1000a6ee5e489db7534fd7f127f34d33..e1b54c6f9afa5074b8eeb62e987477a54da95b64 100644 (file)
@@ -1890,7 +1890,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 ());
 }
 
 static int
@@ -16654,8 +16659,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 file name for starting inferiors."), _("\
+Show the remote file name for starting inferiors."), _("\
+This is the file name, on the remote target, used when starting an\n\
+inferior, for example with the \"run\", \"start\", or \"starti\"\n\
+commands.  This setting is only useful when debugging a remote target,\n\
+otherwise, this setting is not used."),
                                   set_remote_exec_file_cb,
                                   get_remote_exec_file,
                                   show_remote_exec_file,
index b73528114c4a4495f6be1783c53b47ca5c08b540..baaf03952e6da359909adf8794277c5acf88d941 100644 (file)
@@ -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\"\\."
 }
index 026a10ba68a27588afe6bf92633f9708e1abf1b1..97961f5b93337f516ee461d8de4a095f73bb699d 100644 (file)
@@ -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.