diff options
author | Pedro Alves <palves@redhat.com> | 2019-09-06 22:54:03 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2019-09-06 23:27:52 +0100 |
commit | 6227a6614ca9b363622660129273c4cb8a9c10c0 (patch) | |
tree | 14ba98090de6c1c8559b06c3ba8f40237bc9f957 | |
parent | 1e81a82ceb1c4e503e90c8b2d4441afef802df8c (diff) | |
download | binutils-gdb-6227a6614ca9b363622660129273c4cb8a9c10c0.tar.gz |
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:
yyyy-mm-dd 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:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* gdb.base/remote-exec-file.exp: New file.
-rw-r--r-- | gdb/remote.c | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/remote-exec-file.exp | 46 |
2 files changed, 47 insertions, 1 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index ae06c4ba791..db6f1a0e594 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1272,7 +1272,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/gdb.base/remote-exec-file.exp b/gdb/testsuite/gdb.base/remote-exec-file.exp new file mode 100644 index 00000000000..3db009b830a --- /dev/null +++ b/gdb/testsuite/gdb.base/remote-exec-file.exp @@ -0,0 +1,46 @@ +# Copyright 2019 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" +} |