| Index: gdb/tui/tui-io.c
|
| diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
|
| index 2fb7bb436c338e4832f2756b72702ca2e7850cf6..19b02916b5a11a3c40995a5092f4101a4a5b22ab 100644
|
| --- a/gdb/tui/tui-io.c
|
| +++ b/gdb/tui/tui-io.c
|
| @@ -1,6 +1,6 @@
|
| /* TUI support I/O functions.
|
|
|
| - Copyright (C) 1998-2004, 2007-2012 Free Software Foundation, Inc.
|
| + Copyright (C) 1998-2013 Free Software Foundation, Inc.
|
|
|
| Contributed by Hewlett-Packard Company.
|
|
|
| @@ -37,6 +37,7 @@
|
| #include <fcntl.h>
|
| #include <signal.h>
|
| #include <stdio.h>
|
| +#include "filestuff.h"
|
|
|
| #include "gdb_curses.h"
|
|
|
| @@ -211,8 +212,11 @@ tui_redisplay_readline (void)
|
|
|
| /* Detect when we temporarily left SingleKey and now the readline
|
| edit buffer is empty, automatically restore the SingleKey
|
| - mode. */
|
| - if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0)
|
| + mode. The restore must only be done if the command has finished.
|
| + The command could call prompt_for_continue and we must not
|
| + restore SingleKey so that the prompt and normal keymap are used. */
|
| + if (tui_current_key_mode == TUI_ONE_COMMAND_MODE && rl_end == 0
|
| + && immediate_quit == 0)
|
| tui_set_key_mode (TUI_SINGLE_KEY_MODE);
|
|
|
| if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
|
| @@ -416,7 +420,8 @@ tui_rl_display_match_list (char **matches, int len, int max)
|
| {
|
| char msg[256];
|
|
|
| - sprintf (msg, "\nDisplay all %d possibilities? (y or n)", len);
|
| + xsnprintf (msg, sizeof (msg),
|
| + "\nDisplay all %d possibilities? (y or n)", len);
|
| tui_puts (msg);
|
| if (get_y_or_n () == 0)
|
| {
|
| @@ -604,15 +609,14 @@ tui_initialize_io (void)
|
| tui_stderr = tui_fileopen (stderr);
|
| tui_out = tui_out_new (tui_stdout);
|
|
|
| - /* Create the default UI. It is not created because we installed a
|
| - deprecated_init_ui_hook. */
|
| + /* Create the default UI. */
|
| tui_old_uiout = cli_out_new (gdb_stdout);
|
|
|
| #ifdef TUI_USE_PIPE_FOR_READLINE
|
| /* Temporary solution for readline writing to stdout: redirect
|
| readline output in a pipe, read that pipe and output the content
|
| in the curses command window. */
|
| - if (pipe (tui_readline_pipe) != 0)
|
| + if (gdb_pipe_cloexec (tui_readline_pipe) != 0)
|
| {
|
| fprintf_unfiltered (gdb_stderr, "Cannot create pipe for readline");
|
| exit (1);
|
|
|