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/cli/cli-script.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'gdb/cli') diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 5fc01b3..0507c55 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -352,6 +352,7 @@ do_restore_user_call_depth (void * call_depth) void execute_user_command (struct cmd_list_element *c, char *args) { + struct ui *ui = current_ui; struct command_line *cmdlines; struct cleanup *old_chain; enum command_control_type ret; @@ -372,8 +373,8 @@ execute_user_command (struct cmd_list_element *c, char *args) /* Set the instream to 0, indicating execution of a user-defined function. */ - make_cleanup (do_restore_instream_cleanup, instream); - instream = (FILE *) 0; + make_cleanup (do_restore_instream_cleanup, ui->instream); + ui->instream = NULL; /* Also set the global in_user_command, so that NULL instream is not confused with Insight. */ @@ -931,6 +932,7 @@ realloc_body_list (struct command_line *command, int new_length) static char * read_next_line (void) { + struct ui *ui = current_ui; char *prompt_ptr, control_prompt[256]; int i = 0; @@ -938,7 +940,8 @@ read_next_line (void) error (_("Control nesting too deep!")); /* Set a prompt based on the nesting of the control commands. */ - if (instream == stdin || (instream == 0 && deprecated_readline_hook != NULL)) + if (ui->instream == stdin + || (ui->instream == 0 && deprecated_readline_hook != NULL)) { for (i = 0; i < control_level; i++) control_prompt[i] = ' '; @@ -949,7 +952,7 @@ read_next_line (void) else prompt_ptr = NULL; - return command_line_input (prompt_ptr, instream == stdin, "commands"); + return command_line_input (prompt_ptr, ui->instream == stdin, "commands"); } /* Process one input line. If the command is an "end", return such an -- cgit v1.1