summaryrefslogtreecommitdiff
path: root/gdb/event-top.c
diff options
context:
space:
mode:
authorratmice <ratmice>2011-09-02 21:16:53 +0000
committerratmice <ratmice>2011-09-02 21:16:53 +0000
commit16369dbf89c7e65c48f70c35bbacb7dc11488781 (patch)
treee43f3ea12f6374a941e746e05ac20790174e1cfe /gdb/event-top.c
parent116949a3172eb5fd7f7e32fef3a6f5ac08788c9e (diff)
downloadgdb-16369dbf89c7e65c48f70c35bbacb7dc11488781.tar.gz
PR gdb/10720
* event-top.c (cli_command_loop): Replace readline setup with direct call to display_gdb_prompt. (display_gdb_prompt): Do not call observer mechanism during synchronous execution. testsuite: * lib/prompt.exp: New file for testing the first prompt. * gdb.python/py-prompt.exp: Ditto. * gdb.python/py-prompt.c: Ditto (copy of ext-attach.c).
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r--gdb/event-top.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 378827282fa..09bd89f5ab8 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -185,27 +185,7 @@ rl_callback_read_char_wrapper (gdb_client_data client_data)
void
cli_command_loop (void)
{
- /* If we are using readline, set things up and display the first
- prompt, otherwise just print the prompt. */
- if (async_command_editing_p)
- {
- int length;
- char *a_prompt;
- char *gdb_prompt = get_prompt (0);
-
- /* Tell readline what the prompt to display is and what function
- it will need to call after a whole line is read. This also
- displays the first prompt. */
- length = strlen (get_prefix (0))
- + strlen (gdb_prompt) + strlen (get_suffix(0)) + 1;
- a_prompt = (char *) alloca (length);
- strcpy (a_prompt, get_prefix (0));
- strcat (a_prompt, gdb_prompt);
- strcat (a_prompt, get_suffix (0));
- rl_callback_handler_install (a_prompt, input_handler);
- }
- else
- display_gdb_prompt (0);
+ display_gdb_prompt (0);
/* Now it's time to start the event loop. */
start_event_loop ();
@@ -272,8 +252,11 @@ display_gdb_prompt (char *new_prompt)
/* Get the prompt before the observers are called as observer hook
functions may change the prompt. Do not call observers on an
explicit prompt change as passed to this function, as this forms
- a temporary prompt, IE, displayed but not set. */
- if (! new_prompt)
+ a temporary prompt, IE, displayed but not set. Do not call
+ observers for a prompt change if sync_execution is set, it will
+ call us again with sync_execution not set when it wants to
+ display an actual prompt. */
+ if (! sync_execution && ! new_prompt)
{
char *post_gdb_prompt = NULL;
char *pre_gdb_prompt = xstrdup (get_prompt (0));
@@ -288,6 +271,10 @@ display_gdb_prompt (char *new_prompt)
xfree (pre_gdb_prompt);
}
+ /* In the sync_execution && !is_running case we need to display the prompt
+ even though it may be "" to avoid a double prompt, while installing the
+ callback handlers, in the async_editing_p case for pagination,
+ So fall through. */
if (sync_execution && is_running (inferior_ptid))
{
/* This is to trick readline into not trying to display the