aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/top.c18
-rw-r--r--gdb/top.h4
-rw-r--r--gdb/tui/tui-io.c2
4 files changed, 34 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6ec04d0..693de09 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,16 @@
2015-08-21 Patrick Palka <patrick@parcs.ath.cx>
+ * top.h (gdb_in_secondary_prompt_p): Declare.
+ * top.c (gdb_secondary_prompt_depth): Define.
+ (gdb_in_secondary_prompt_p): Define.
+ (gdb_readline_wrapper_cleanup): Decrement
+ gdb_secondary_prompt_depth.
+ (gdb_readline_wrapper): Increment gdb_secondary_prompt_depth.
+ * tui/tui-io.c (tui_getc): Don't clear the prompt line if we
+ are in a secondary prompt.
+
+2015-08-21 Patrick Palka <patrick@parcs.ath.cx>
+
* tui/tui-io.c (tui_getc): Use tui_putc instead of waddch to
emit the newline.
diff --git a/gdb/top.c b/gdb/top.c
index 061b52f..cb3c761 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -754,6 +754,21 @@ static char *gdb_readline_wrapper_result;
return. */
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)
+{
+ return gdb_secondary_prompt_depth > 0;
+}
+
+
/* This function is called when readline has seen a complete line of
text. */
@@ -808,6 +823,8 @@ gdb_readline_wrapper_cleanup (void *arg)
gdb_readline_wrapper_result = NULL;
gdb_readline_wrapper_done = 0;
+ gdb_secondary_prompt_depth--;
+ gdb_assert (gdb_secondary_prompt_depth >= 0);
after_char_processing_hook = saved_after_char_processing_hook;
saved_after_char_processing_hook = NULL;
@@ -833,6 +850,7 @@ gdb_readline_wrapper (const char *prompt)
cleanup->target_is_async_orig = target_is_async_p ();
+ gdb_secondary_prompt_depth++;
back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup);
if (cleanup->target_is_async_orig)
diff --git a/gdb/top.h b/gdb/top.h
index 987279b..914a272 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -65,6 +65,10 @@ extern char *get_prompt (void);
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. */
+
+extern int gdb_in_secondary_prompt_p (void);
+
/* From random places. */
extern int readnow_symbol_files;
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index bca1f58..c7a092f 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -585,7 +585,7 @@ tui_getc (FILE *fp)
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)
+ if (rl_end == 0 && !gdb_in_secondary_prompt_p ())
{
wmove (w, getcury (w), 0);