diff options
Diffstat (limited to 'gdb/inflow.c')
-rw-r--r-- | gdb/inflow.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/gdb/inflow.c b/gdb/inflow.c index 773ac0b..4f1c8ef 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -1,5 +1,5 @@ /* Low level interface to ptrace, for GDB when running under Unix. - Copyright (C) 1986-2024 Free Software Foundation, Inc. + Copyright (C) 1986-2025 Free Software Foundation, Inc. This file is part of GDB. @@ -55,6 +55,20 @@ static void child_terminal_ours_1 (target_terminal_state); static struct serial *stdin_serial; +/* See terminal.h. */ + +scoped_gdb_ttystate::scoped_gdb_ttystate () +{ + m_ttystate = serial_get_tty_state (stdin_serial); +} + +/* See terminal.h. */ + +scoped_gdb_ttystate::~scoped_gdb_ttystate () +{ + serial_set_tty_state (stdin_serial, m_ttystate); +} + /* Terminal related info we need to keep track of. Each inferior holds an instance of this structure --- we save it whenever the corresponding inferior stops, and restore it to the terminal when @@ -163,6 +177,15 @@ set_initial_gdb_ttystate (void) } } +/* See terminal.h. */ + +void +restore_initial_gdb_ttystate () +{ + if (initial_gdb_ttystate != nullptr) + serial_set_tty_state (stdin_serial, initial_gdb_ttystate); +} + /* Does GDB have a terminal (on stdin)? */ static int @@ -944,9 +967,7 @@ initialize_stdin_serial (void) stdin_serial = serial_fdopen (0); } -void _initialize_inflow (); -void -_initialize_inflow () +INIT_GDB_FILE (inflow) { add_info ("terminal", info_terminal_command, _("Print inferior's saved terminal status.")); |