public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Make "show remote exec-file" inferior-aware
Date: Fri, 10 Jan 2020 23:40:00 -0000	[thread overview]
Message-ID: <acdf84a65400f416c60a0c9c14953ba5a73fb0cd@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT acdf84a65400f416c60a0c9c14953ba5a73fb0cd ***

commit acdf84a65400f416c60a0c9c14953ba5a73fb0cd
Author:     Pedro Alves <palves@redhat.com>
AuthorDate: Fri Jan 10 20:05:42 2020 +0000
Commit:     Pedro Alves <palves@redhat.com>
CommitDate: Fri Jan 10 20:05:42 2020 +0000

    Make "show remote exec-file" inferior-aware
    
    The "set remote exec-file" setting is per-inferior, but the "show
    remote exec-file" command always shows the last set exec-file,
    irrespective of the current inferior.  E.g.:
    
     # Set inferior 1's exec-file:
     (gdb) set remote exec-file prog1
    
     # Add inferior 2, switch to it, and set its exec-file:
     (gdb) add-inferior
     Added inferior 2
     (gdb) inferior 2
     (gdb) set remote exec-file prog2
    
     # Switch back to inferior 1, and show its exec-file:
     (gdb) inferior 1
     (gdb) show remote exec-file
     prog2
     ^^^^^ should show "prog1" instead here.
    
    gdb/ChangeLog:
    2020-01-10  Pedro Alves  <palves@redhat.com>
    
            * remote.c (show_remote_exec_file): Show the current inferior's
            exec-file instead of the command variable's value.
    
    gdb/testsuite/ChangeLog:
    2020-01-10  Pedro Alves  <palves@redhat.com>
    
            * gdb.base/remote-exec-file.exp: New file.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index dba48a52ae..af46e69fb3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-10  Pedro Alves  <palves@redhat.com>
+
+	* remote.c (show_remote_exec_file): Show the current inferior's
+	exec-file instead of the command variable's value.
+
 2020-01-10  Pedro Alves  <palves@redhat.com>
 
 	* record-full.c (record_full_resume_ptid): New global.
diff --git a/gdb/remote.c b/gdb/remote.c
index 082499e6e8..539b27ebd2 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1268,7 +1268,7 @@ static void
 show_remote_exec_file (struct ui_file *file, int from_tty,
 		       struct cmd_list_element *cmd, const char *value)
 {
-  fprintf_filtered (file, "%s\n", remote_exec_file_var);
+  fprintf_filtered (file, "%s\n", get_remote_exec_file ());
 }
 
 static int
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4a2591e4a5..4b38c214da 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2020-01-10  Pedro Alves  <palves@redhat.com>
+
+	* gdb.base/remote-exec-file.exp: New file.
+
 2020-01-10  Pedro Alves  <palves@redhat.com>
 
 	* gdb.base/fork-running-state.exp (do_test): Adjust expected
diff --git a/gdb/testsuite/gdb.base/remote-exec-file.exp b/gdb/testsuite/gdb.base/remote-exec-file.exp
new file mode 100644
index 0000000000..277e40521e
--- /dev/null
+++ b/gdb/testsuite/gdb.base/remote-exec-file.exp
@@ -0,0 +1,46 @@
+# Copyright 2019-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that "show remote exec-file" displays each inferior's
+# exec-file.  Regression test for a bug where "show remote exec-file"
+# would show the last exec-file set, irrespective of the current
+# inferior.
+
+clean_restart
+
+# Set remote exec-file in inferior 1.
+with_test_prefix "set inf 1" {
+    gdb_test_no_output "set remote exec-file prog1"
+}
+
+# Set remote exec-file in inferior 2.
+with_test_prefix "set inf 2" {
+    gdb_test "add-inferior" "Added inferior 2" "add inferior 2"
+    gdb_test "inferior 2" "Switching to inferior 2.*"
+    gdb_test_no_output "set remote exec-file prog2"
+}
+
+# Check that "show remote exec-file" diplays each inferior's
+# exec-file.
+
+with_test_prefix "show inf 1" {
+    gdb_test "inferior 1" "Switching to inferior 1.*"
+    gdb_test "show remote exec-file" "prog1"
+}
+
+with_test_prefix "show inf 2" {
+    gdb_test "inferior 2" "Switching to inferior 2.*"
+    gdb_test "show remote exec-file" "prog2"
+}


             reply	other threads:[~2020-01-10 23:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10 23:40 gdb-buildbot [this message]
2020-01-10 23:40 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2020-01-11  0:16 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2020-01-11 20:03 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-01-11 20:03 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-01-11 20:33 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-01-11 21:35 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-01-11 21:48 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

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=acdf84a65400f416c60a0c9c14953ba5a73fb0cd@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@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).