* defs.h (gdb_readline_wrapper): Declare.
authorTom Tromey <tromey@redhat.com>
Wed, 24 Jul 2002 17:58:46 +0000 (17:58 +0000)
committerTom Tromey <tromey@redhat.com>
Wed, 24 Jul 2002 17:58:46 +0000 (17:58 +0000)
* utils.c (prompt_for_continue): Use gdb_readline_wrapper.
* tracepoint.c (read_actions): Use gdb_readline_wrapper.
* top.c (gdb_readline_wrapper): New function.
(command_line_input): Use it.

gdb/ChangeLog
gdb/defs.h
gdb/top.c
gdb/tracepoint.c
gdb/utils.c

index a3bdf19627f23f931447ff16c47b57935c370f59..3b2b94e944f50c45bdff168896252f3e35e0d63a 100644 (file)
@@ -1,3 +1,11 @@
+2002-07-24  Tom Tromey  <tromey@redhat.com>
+
+       * defs.h (gdb_readline_wrapper): Declare.
+       * utils.c (prompt_for_continue): Use gdb_readline_wrapper.
+       * tracepoint.c (read_actions): Use gdb_readline_wrapper.
+       * top.c (gdb_readline_wrapper): New function.
+       (command_line_input): Use it.
+
 2002-07-24  Andrew Cagney  <cagney@redhat.com>
 
        * regcache.h (regcache_raw_read, regcache_raw_write): Replace
index 94a1ac804238726afa225defd0fbd77ba1376fc3..7dea2b73397a5f9025e0be373a9a086520d9c589 100644 (file)
@@ -535,6 +535,8 @@ extern char *skip_quoted (char *);
 
 extern char *gdb_readline (char *);
 
+extern char *gdb_readline_wrapper (char *);
+
 extern char *command_line_input (char *, int, char *);
 
 extern void print_prompt (void);
index 10afc64037f5c14572c2dd47c266584d8260d502..ee3daf067844ac8fcda8dfcc8a1bc31c4260b9ed 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -947,6 +947,29 @@ static int write_history_p;
 static int history_size;
 static char *history_filename;
 
+/* This is like readline(), but it has some gdb-specific behavior.
+   gdb can use readline in both the synchronous and async modes during
+   a single gdb invocation.  At the ordinary top-level prompt we might
+   be using the async readline.  That means we can't use
+   rl_pre_input_hook, since it doesn't work properly in async mode.
+   However, for a secondary prompt (" >", such as occurs during a
+   `define'), gdb just calls readline() directly, running it in
+   synchronous mode.  So for operate-and-get-next to work in this
+   situation, we have to switch the hooks around.  That is what
+   gdb_readline_wrapper is for.  */
+char *
+gdb_readline_wrapper (char *prompt)
+{
+  /* Set the hook that works in this case.  */
+  if (event_loop_p && after_char_processing_hook)
+    {
+      rl_pre_input_hook = (Function *) after_char_processing_hook;
+      after_char_processing_hook = NULL;
+    }
+
+  return readline (prompt);
+}
+
 \f
 #ifdef STOP_SIGNAL
 static void
@@ -1174,7 +1197,7 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
        }
       else if (command_editing_p && instream == stdin && ISATTY (instream))
        {
-         rl = readline (local_prompt);
+         rl = gdb_readline_wrapper (local_prompt);
        }
       else
        {
index 19f290656e2d56088bdce95032a5bba65d0fc22b..976f9259cddfaf0959b91229138aaac55abf358b 100644 (file)
@@ -854,7 +854,7 @@ read_actions (struct tracepoint *t)
        line = (*readline_hook) (prompt);
       else if (instream == stdin && ISATTY (instream))
        {
-         line = readline (prompt);
+         line = gdb_readline_wrapper (prompt);
          if (line && *line)    /* add it to command history */
            add_history (line);
        }
index 4baea62426456e966a844c02fa76d327eb1f46c0..b2d9ecafdb3a2135c53522ac8cf8d757720fb640 100644 (file)
@@ -1603,7 +1603,7 @@ prompt_for_continue (void)
   /* Call readline, not gdb_readline, because GO32 readline handles control-C
      whereas control-C to gdb_readline will cause the user to get dumped
      out to DOS.  */
-  ignore = readline (cont_prompt);
+  ignore = gdb_readline_wrapper (cont_prompt);
 
   if (annotation_level > 1)
     printf_unfiltered ("\n\032\032post-prompt-for-continue\n");
This page took 0.044965 seconds and 4 git commands to generate.