+2016-06-21 Pedro Alves <palves@redhat.com>
+
+ * top.c (gdb_secondary_prompt_depth): Delete.
+ (gdb_in_secondary_prompt_p): Add ui parameter. Use it.
+ (gdb_readline_wrapper_cleanup, gdb_readline_wrapper): Adjust to
+ per-UI gdb_secondary_prompt_depth.
+ * top.h (struct ui) <secondary_prompt_depth>: New field.
+
2016-06-21 Pedro Alves <palves@redhat.com>
* cli/cli-interp.c (cli_interpreter_pre_command_loop): New
static void (*saved_after_char_processing_hook) (void);
-/* The number of nested readline secondary prompts that are currently
- active. */
-
-static int gdb_secondary_prompt_depth = 0;
-
/* See top.h. */
int
-gdb_in_secondary_prompt_p (void)
+gdb_in_secondary_prompt_p (struct ui *ui)
{
- return gdb_secondary_prompt_depth > 0;
+ return ui->secondary_prompt_depth > 0;
}
gdb_readline_wrapper_result = NULL;
gdb_readline_wrapper_done = 0;
- gdb_secondary_prompt_depth--;
- gdb_assert (gdb_secondary_prompt_depth >= 0);
+ ui->secondary_prompt_depth--;
+ gdb_assert (ui->secondary_prompt_depth >= 0);
after_char_processing_hook = saved_after_char_processing_hook;
saved_after_char_processing_hook = NULL;
cleanup->target_is_async_orig = target_is_async_p ();
- gdb_secondary_prompt_depth++;
+ ui->secondary_prompt_depth++;
back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup);
if (cleanup->target_is_async_orig)
"start" -ex "next"') are processed. */
int async;
+ /* The number of nested readline secondary prompts that are
+ currently active. */
+ int secondary_prompt_depth;
+
/* stdio stream that command input is being read from. Set to stdin
normally. Set by source_command to the file we are sourcing.
Set to NULL if we are executing a user-defined command or
by gdb for its command prompt. */
extern void set_prompt (const char *s);
-/* Return 1 if the current input handler is a secondary prompt, 0 otherwise. */
+/* Return 1 if UI's current input handler is a secondary prompt, 0
+ otherwise. */
-extern int gdb_in_secondary_prompt_p (void);
+extern int gdb_in_secondary_prompt_p (struct ui *ui);
/* From random places. */
extern int readnow_symbol_files;
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
- && !gdb_in_secondary_prompt_p ())
+ && !gdb_in_secondary_prompt_p (current_ui))
tui_set_key_mode (TUI_SINGLE_KEY_MODE);
if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
with empty lines with gdb prompt at beginning. Instead of that,
stay on the same line but provide a visual effect to show the
user we recognized the command. */
- if (rl_end == 0 && !gdb_in_secondary_prompt_p ())
+ if (rl_end == 0 && !gdb_in_secondary_prompt_p (current_ui))
{
wmove (w, getcury (w), 0);
{
rl_already_prompted = 1;
if (tui_current_key_mode != TUI_COMMAND_MODE
- && !gdb_in_secondary_prompt_p ())
+ && !gdb_in_secondary_prompt_p (current_ui))
tui_set_key_mode (TUI_SINGLE_KEY_MODE);
tui_redisplay_readline ();
return 0;