aboutsummaryrefslogtreecommitdiff
path: root/gdb/inflow.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-06-21 01:11:54 +0100
committerPedro Alves <palves@redhat.com>2016-06-21 01:11:54 +0100
commit268a799a454ce862f516ff2215290fae08eca7fa (patch)
treef68a29246ef353cdcefa73f01979fb931957ff21 /gdb/inflow.c
parent07169ff772077f566c6540f623d7d609babc4c81 (diff)
downloadfsf-binutils-gdb-268a799a454ce862f516ff2215290fae08eca7fa.zip
fsf-binutils-gdb-268a799a454ce862f516ff2215290fae08eca7fa.tar.gz
fsf-binutils-gdb-268a799a454ce862f516ff2215290fae08eca7fa.tar.bz2
Make stdin be per UI
This commit makes each UI have its own "stdin" stream pointer. This is used to determine whether the "from_tty" argument to execute_command, etc. should be true. Related, this commit makes input_from_terminal_p take an UI parameter, and then avoids the gdb_has_a_terminal in it. gdb_has_a_terminal only returns info on gdb's own main/primary terminal (the real stdin). However, the places that call input_from_terminal_p really want to know is whether the command came from an interactive tty. This patch thus renames input_from_terminal_p to input_interactive_p for clarity, and then makes input_interactive_p check for "set interactive" itself, along with ISATTY, instead of calling gdb_has_a_terminal. Actually, quit_force wants to call input_interactive_p _after_ stdin is closed, we can't call ISATTY that late. So instead we save the result of ISATTY in a field of the UI. gdb/ChangeLog: 2016-06-21 Pedro Alves <palves@redhat.com> * cli/cli-script.c (read_next_line): Adjust to per-UI stdin. (read_command_lines): Use input_interactive_p instead of input_from_terminal_p. * defs.h (struct ui): Forward declare. (input_from_terminal_p): Rename to ... (input_interactive_p): ... this. * event-top.c (stdin_event_handler): Pass 0 as from_tty argument to quit_command. (command_handler): Adjust to per-UI stdin. (handle_line_of_input): Adjust to per-UI stdin and use input_interactive_p instead of ISATTY and input_from_terminal_p. (gdb_readline_no_editing_callback): Adjust to per-UI stdin. (command_line_handler): Always pass true as "from_tty" parameter of handle_line_of_input and execute_command. (async_sigterm_handler): Pass 0 as from_tty argument to quit_command. * inflow.c (interactive_mode, show_interactive_mode): Moved to ... (gdb_has_a_terminal): Don't check interactive_mode here. (_initialize_inflow): Don't install "set interactive-mode" here. * main.c (captured_command_loop): Adjust to per-UI stdin. * mi/mi-interp.c (mi_execute_command_wrapper): Adjust to per-UI stdin. * top.c (new_ui): Save the stdin stream and whether it's a tty. (dont_repeat): Adjust to per-UI stdin. (command_line_input): Adjust to per-UI stdin and to use input_interactive_p. (quit_force): Write history if any UI supports interactive input. (interactive_mode, show_interactive_mode): Move here, from inflow.c. (input_from_terminal_p): Rename to ... (input_interactive_p): ... this, and check the "interactive_mode" global instead of calling gdb_has_a_terminal. (_initialize_top): Install "set interactive-mode" here. * top.h (struct ui) <stdin_stream, input_interactive_p>: New fields. * utils.c (quit): Pass 0 as from_tty argument to quit_force. (defaulted_query): Adjust to per-UI stdin and to use input_interactive_p.
Diffstat (limited to 'gdb/inflow.c')
-rw-r--r--gdb/inflow.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 4c80dbd..4cbcd5c 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -142,24 +142,6 @@ enum gdb_has_a_terminal_flag_enum
}
gdb_has_a_terminal_flag = have_not_checked;
-/* The value of the "interactive-mode" setting. */
-static enum auto_boolean interactive_mode = AUTO_BOOLEAN_AUTO;
-
-/* Implement the "show interactive-mode" option. */
-
-static void
-show_interactive_mode (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
-{
- if (interactive_mode == AUTO_BOOLEAN_AUTO)
- fprintf_filtered (file, "Debugger's interactive mode "
- "is %s (currently %s).\n",
- value, gdb_has_a_terminal () ? "on" : "off");
- else
- fprintf_filtered (file, "Debugger's interactive mode is %s.\n", value);
-}
-
/* Set the initial tty state that is to be inherited by new inferiors. */
void
@@ -172,9 +154,6 @@ set_initial_gdb_ttystate (void)
int
gdb_has_a_terminal (void)
{
- if (interactive_mode != AUTO_BOOLEAN_AUTO)
- return interactive_mode == AUTO_BOOLEAN_TRUE;
-
switch (gdb_has_a_terminal_flag)
{
case yes:
@@ -899,20 +878,6 @@ _initialize_inflow (void)
add_info ("terminal", term_info,
_("Print inferior's saved terminal status."));
- add_setshow_auto_boolean_cmd ("interactive-mode", class_support,
- &interactive_mode, _("\
-Set whether GDB's standard input is a terminal."), _("\
-Show whether GDB's standard input is a terminal."), _("\
-If on, GDB assumes that standard input is a terminal. In practice, it\n\
-means that GDB should wait for the user to answer queries associated to\n\
-commands entered at the command prompt. If off, GDB assumes that standard\n\
-input is not a terminal, and uses the default answer to all queries.\n\
-If auto (the default), determine which mode to use based on the standard\n\
-input settings."),
- NULL,
- show_interactive_mode,
- &setlist, &showlist);
-
terminal_is_ours = 1;
/* OK, figure out whether we have job control. If neither termios nor