aboutsummaryrefslogtreecommitdiff
path: root/gdb/windows-nat.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/windows-nat.c
parentcfc16775b7678e1ad8f9fce048652defd78e3787 (diff)
downloadgdb-05779d57f9f4e7cbb6d4c79d8851d35a422bdd0d.zip
gdb-05779d57f9f4e7cbb6d4c79d8851d35a422bdd0d.tar.gz
gdb-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/windows-nat.c')
-rw-r--r--gdb/windows-nat.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 68df87d..188a920 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2730,7 +2730,7 @@ windows_nat_target::create_inferior (const char *exec_file,
PROCESS_INFORMATION pi;
BOOL ret;
DWORD flags = 0;
- const char *inferior_io_terminal = get_inferior_io_terminal ();
+ const char *inferior_tty = current_inferior ()->tty ();
if (!exec_file)
error (_("No executable specified, use `target exec'."));
@@ -2829,14 +2829,14 @@ windows_nat_target::create_inferior (const char *exec_file,
w32_env = NULL;
}
- if (!inferior_io_terminal)
+ if (inferior_tty == nullptr)
tty = ostdin = ostdout = ostderr = -1;
else
{
- tty = open (inferior_io_terminal, O_RDWR | O_NOCTTY);
+ tty = open (inferior_tty, O_RDWR | O_NOCTTY);
if (tty < 0)
{
- print_sys_errmsg (inferior_io_terminal, errno);
+ print_sys_errmsg (inferior_tty, errno);
ostdin = ostdout = ostderr = -1;
}
else
@@ -2901,19 +2901,19 @@ windows_nat_target::create_inferior (const char *exec_file,
allargs_len = strlen (allargs_copy);
}
/* If not all the standard streams are redirected by the command
- line, use inferior_io_terminal for those which aren't. */
- if (inferior_io_terminal
+ line, use INFERIOR_TTY for those which aren't. */
+ if (inferior_tty != nullptr
&& !(fd_inp >= 0 && fd_out >= 0 && fd_err >= 0))
{
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = 0;
sa.bInheritHandle = TRUE;
- tty = CreateFileA (inferior_io_terminal, GENERIC_READ | GENERIC_WRITE,
+ tty = CreateFileA (inferior_tty, GENERIC_READ | GENERIC_WRITE,
0, &sa, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (tty == INVALID_HANDLE_VALUE)
warning (_("Warning: Failed to open TTY %s, error %#x."),
- inferior_io_terminal, (unsigned) GetLastError ());
+ inferior_tty, (unsigned) GetLastError ());
}
if (redirected || tty != INVALID_HANDLE_VALUE)
{