2007-07-01 Daniel Jacobowitz <dan@codesourcery.com>
authorDaniel Jacobowitz <drow@false.org>
Sun, 1 Jul 2007 22:37:52 +0000 (22:37 +0000)
committerDaniel Jacobowitz <drow@false.org>
Sun, 1 Jul 2007 22:37:52 +0000 (22:37 +0000)
* top.c (gdb_readline_wrapper_line): Call rl_callback_handler_remove.
(struct gdb_readline_wrapper_cleanup): Remove prompt_orig.
(gdb_readline_wrapper_cleanup): Do not reset the prompt.
(gdb_readline_wrapper): Do not save the prompt.  Pass our prompt
to display_gdb_prompt.

2007-07-01  Nick Roberts  <nickrob@snap.net.nz>
    Daniel Jacobowitz  <dan@codesourcery.com>

* gdb.base/annota3.exp: Test for if construct.

gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/annota3.exp
gdb/top.c

index 3cc6fb712bc537dfcfee779edda6bb17990d4901..9fa7e7b74f48b6c0a282db1ec75dccb6f70a3ef0 100644 (file)
@@ -1,3 +1,11 @@
+2007-07-01  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * top.c (gdb_readline_wrapper_line): Call rl_callback_handler_remove.
+       (struct gdb_readline_wrapper_cleanup): Remove prompt_orig.
+       (gdb_readline_wrapper_cleanup): Do not reset the prompt.
+       (gdb_readline_wrapper): Do not save the prompt.  Pass our prompt
+       to display_gdb_prompt.
+
 2007-07-01  Daniel Jacobowitz  <dan@codesourcery.com>
 
        PR symtab/2161
index 911a977ff8533eedb52fb40a65eade672a28a1fb..928b737a940367ffd54cc94c81bb72f13eccb6e4 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-01  Nick Roberts  <nickrob@snap.net.nz>
+           Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gdb.base/annota3.exp: Test for if construct.
+
 2007-06-26  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * gdb.base/chng-syms.exp: Handle glibc's __GI_exit.
index 7e8e10b6ed4dcaa8e66fab1e5988d12dd4242418..d9f7639218f3049a4c5f48cf11d3d5ac78894733 100644 (file)
@@ -99,7 +99,29 @@ gdb_expect_list "annotation set at level 3" "\r\n$gdb_prompt$" {
     "set annotate 3"
 }
 
-
+#
+# if construct:
+#
+send_gdb "if 1\n"
+gdb_expect {
+    -re "^if 1\r\n\r\n\032\032post-prompt\r\n\r\n\032\032pre-commands\r\n >\r\n\032\032commands\r\n$" {
+       pass "start if construct"
+    }
+    -re ".*\032\032commands\r\n" {
+       fail "start if construct"
+    }
+    timeout { fail "start if construct (timeout)" }
+}
+send_gdb "end\n"
+gdb_expect {
+    -re "^end\r\n\r\n\032\032post-commands\r\n$gdb_prompt$" {
+       pass "end if construct"
+    }
+    -re ".*$gdb_prompt$" {
+       fail "end if construct"
+    }
+    timeout { fail "end if construct (timeout)" }
+}
 #
 # info break:
 #
index 1681524dc6c9f2ed811d289dac94a44c62929e55..14a7c56856de16cdcbc46f41de58c8b5e62db2c0 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -751,12 +751,16 @@ gdb_readline_wrapper_line (char *line)
   /* Prevent operate-and-get-next from acting too early.  */
   saved_after_char_processing_hook = after_char_processing_hook;
   after_char_processing_hook = NULL;
+
+  /* Prevent parts of the prompt from being redisplayed if annotations
+     are enabled, and readline's state getting out of sync.  */
+  if (async_command_editing_p)
+    rl_callback_handler_remove ();
 }
 
 struct gdb_readline_wrapper_cleanup
   {
     void (*handler_orig) (char *);
-    char *prompt_orig;
     int already_prompted_orig;
   };
 
@@ -766,7 +770,6 @@ gdb_readline_wrapper_cleanup (void *arg)
   struct gdb_readline_wrapper_cleanup *cleanup = arg;
 
   rl_already_prompted = cleanup->already_prompted_orig;
-  PROMPT (0) = cleanup->prompt_orig;
 
   gdb_assert (input_handler == gdb_readline_wrapper_line);
   input_handler = cleanup->handler_orig;
@@ -790,14 +793,12 @@ gdb_readline_wrapper (char *prompt)
   cleanup->handler_orig = input_handler;
   input_handler = gdb_readline_wrapper_line;
 
-  cleanup->prompt_orig = get_prompt ();
-  PROMPT (0) = prompt;
   cleanup->already_prompted_orig = rl_already_prompted;
 
   back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup);
 
   /* Display our prompt and prevent double prompt display.  */
-  display_gdb_prompt (NULL);
+  display_gdb_prompt (prompt);
   rl_already_prompted = 1;
 
   if (after_char_processing_hook)