From f38d3ad186f1820596743a04b7394b0749942501 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 21 Jun 2016 01:11:46 +0100 Subject: Make instream be per UI gdb/ChangeLog: 2016-06-21 Pedro Alves * cli/cli-script.c (execute_user_command, read_next_line) (read_next_line): Adjust to per-UI instream. * event-top.c (stdin_event_handler, command_handler) (handle_line_of_input, command_line_handler) (gdb_readline_no_editing_callback, async_sigterm_handler) (gdb_setup_readline): Likewise. * inflow.c: Include top.h. (gdb_has_a_terminal, child_terminal_init_with_pgrp) (gdb_save_tty_state, child_terminal_inferior) (child_terminal_ours_1, copy_terminal_info): Use the main UI. (initialize_stdin_serial): Adjust to per-UI instream. * main.c (captured_command_loop, captured_main): Adjust to per-UI instream. * mi/mi-interp.c (mi_execute_command_wrapper): Likewise. * python/python.c (python_interactive_command): Likewise. * terminal.h (struct ui): Forward declare. (initialize_stdin_serial): Add struct ui parameter. * top.c (instream): Delete. (do_restore_instream_cleanup, read_command_file, dont_repeat) (gdb_readline_no_editing, command_line_input) (input_from_terminal_p, gdb_init): Adjust to per-UI instream. * top.h (struct ui) : New field. (instream): Delete declaration. (quit): Adjust to per-UI instream. gdb/testsuite/ChangeLog: 2016-06-21 Pedro Alves * gdb.gdb/selftest.exp (do_steps_and_nexts): Add new regexp. --- gdb/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gdb/main.c') diff --git a/gdb/main.c b/gdb/main.c index 221888d..2b763a3 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -309,6 +309,8 @@ setup_alternate_signal_stack (void) static int captured_command_loop (void *data) { + struct ui *ui = current_ui; + /* Top-level execution commands can be run in the background from here on. */ current_ui->async = 1; @@ -326,7 +328,7 @@ captured_command_loop (void *data) error) we try to quit. If the quit is aborted, catch_errors() which called this catch the signal and restart the command loop. */ - quit_command (NULL, instream == stdin); + quit_command (NULL, ui->instream == stdin); return 1; } @@ -435,6 +437,7 @@ DEF_VEC_O (cmdarg_s); static int captured_main (void *data) { + struct ui *ui = current_ui; struct captured_main_args *context = (struct captured_main_args *) data; int argc = context->argc; char **argv = context->argv; @@ -504,7 +507,7 @@ captured_main (void *data) ndir = 0; saved_command_line = (char *) xstrdup (""); - instream = stdin; + ui->instream = stdin; #ifdef __MINGW32__ /* Ensure stderr is unbuffered. A Cygwin pty or pipe is implemented -- cgit v1.1