aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2020-06-27 14:56:05 +0100
committerPedro Alves <palves@redhat.com>2020-06-27 14:56:05 +0100
commit05779d57f9f4e7cbb6d4c79d8851d35a422bdd0d (patch)
tree08fc108bb88e458292ed728fd5ea5cb3e97dcf84 /gdb/infcmd.c
parentcfc16775b7678e1ad8f9fce048652defd78e3787 (diff)
downloadbinutils-05779d57f9f4e7cbb6d4c79d8851d35a422bdd0d.zip
binutils-05779d57f9f4e7cbb6d4c79d8851d35a422bdd0d.tar.gz
binutils-05779d57f9f4e7cbb6d4c79d8851d35a422bdd0d.tar.bz2
Make {get,set}_inferior_io_terminal inferior methods
This converts the get_inferior_io_terminal and set_inferior_io_terminal free functions to inferior methods. Since the related commands are called "tty", "{set,show} inferior-tty", and MI's "-inferior-tty-{set,show}", to make the connection between the commands and the code more obvious, the methods are named set_tty/tty instead of set_io_terminal/io_terminal. gdb/ChangeLog: * fork-child.c (prefork_hook): Adjust. * infcmd.c (set_inferior_io_terminal, get_inferior_io_terminal): Delete. (set_inferior_tty_command, show_inferior_tty_command): Adjust. * inferior.c (inferior::set_tty, inferior::tty): New methods. * inferior.h (set_inferior_io_terminal, get_inferior_io_terminal): Remove declarations. (struct inferior) <set_tty, tty>: New methods. (struct inferior) <terminal>: Rename to ... (struct inferior) <m_terminal>: ... this and make private. * main.c (captured_main_1): Adjust. * mi/mi-cmd-env.c (mi_cmd_inferior_tty_set): Adjust. (mi_cmd_inferior_tty_show): Adjust. * nto-procfs.c (nto_procfs_target::create_inferior): Adjust. * windows-nat.c (windows_nat_target::create_inferior): Adjust.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 17f7b9a..64eea88 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -100,25 +100,6 @@ enum stop_stack_kind stop_stack_dummy;
int stopped_by_random_signal;
-/* Accessor routines. */
-
-/* Set the io terminal for the current inferior. Ownership of
- TERMINAL_NAME is not transferred. */
-
-void
-set_inferior_io_terminal (const char *terminal_name)
-{
- if (terminal_name != NULL && *terminal_name != '\0')
- current_inferior ()->terminal = make_unique_xstrdup (terminal_name);
- else
- current_inferior ()->terminal = NULL;
-}
-
-const char *
-get_inferior_io_terminal (void)
-{
- return current_inferior ()->terminal.get ();
-}
static void
set_inferior_tty_command (const char *args, int from_tty,
@@ -126,7 +107,7 @@ set_inferior_tty_command (const char *args, int from_tty,
{
/* CLI has assigned the user-provided value to inferior_io_terminal_scratch.
Now route it to current inferior. */
- set_inferior_io_terminal (inferior_io_terminal_scratch);
+ current_inferior ()->set_tty (inferior_io_terminal_scratch);
}
static void
@@ -135,13 +116,13 @@ show_inferior_tty_command (struct ui_file *file, int from_tty,
{
/* Note that we ignore the passed-in value in favor of computing it
directly. */
- const char *inferior_io_terminal = get_inferior_io_terminal ();
+ const char *inferior_tty = current_inferior ()->tty ();
- if (inferior_io_terminal == NULL)
- inferior_io_terminal = "";
+ if (inferior_tty == nullptr)
+ inferior_tty = "";
fprintf_filtered (gdb_stdout,
_("Terminal for future runs of program being debugged "
- "is \"%s\".\n"), inferior_io_terminal);
+ "is \"%s\".\n"), inferior_tty);
}
const char *