--- event-top.c.orig 2002-07-03 22:27:12.000000000 +0200 +++ event-top.c 2002-09-22 12:39:54.000000000 +0200 @@ -350,7 +350,7 @@ change_annotation_level (void) if (strcmp (PREFIX (0), "") && strcmp (SUFFIX (0), "")) { /* Pop the top of the stack, we are going back to annotation < 1. */ - pop_prompt (); + pop_prompt (1); } } } @@ -378,11 +378,11 @@ push_prompt (char *prefix, char *prompt, /* Pops the top of the prompt stack, and frees the memory allocated for it. */ void -pop_prompt (void) +pop_prompt (int change_annotation_level) { /* If we are not during a 'synchronous' execution command, in which case, the top prompt would be empty. */ - if (strcmp (PROMPT (0), "")) + if (change_annotation_level && strcmp (PROMPT (0), "")) /* This is for the case in which the prompt is set while the annotation level is 2. The top prompt will be changed, but when we return to annotation level < 2, we want that new prompt to be @@ -430,7 +430,7 @@ async_enable_stdin (void *dummy) sync_execution. Current target_terminal_ours() implementations check for sync_execution before switching the terminal. */ target_terminal_ours (); - pop_prompt (); + pop_prompt (0); sync_execution = 0; } @@ -636,7 +636,7 @@ command_line_handler (char *rl) p = readline_input_state.linebuffer_ptr; xfree (readline_input_state.linebuffer); more_to_come = 0; - pop_prompt (); + pop_prompt (0); } #ifdef STOP_SIGNAL --- event-top.h.orig 2001-11-27 05:15:10.000000000 +0100 +++ event-top.h 2002-09-22 12:37:44.000000000 +0200 @@ -88,7 +88,7 @@ extern void handle_stop_sig (int sig); #endif #endif extern void handle_sigint (int sig); -extern void pop_prompt (void); +extern void pop_prompt (int change_annotation_level); extern void push_prompt (char *prefix, char *prompt, char *suffix); extern void gdb_readline2 (void *client_data); extern void mark_async_signal_handler_wrapper (void *token); --- top.c.orig 2002-09-15 01:32:00.000000000 +0200 +++ top.c 2002-09-22 12:42:16.000000000 +0200 @@ -960,6 +960,8 @@ static char *history_filename; char * gdb_readline_wrapper (char *prompt) { + char *ret; + /* Set the hook that works in this case. */ if (event_loop_p && after_char_processing_hook) { @@ -967,7 +969,11 @@ gdb_readline_wrapper (char *prompt) after_char_processing_hook = NULL; } - return readline (prompt); + push_prompt ("", prompt, ""); + ret = readline (prompt); + pop_prompt (0); + + return ret; }