aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2002-07-24 17:58:46 +0000
committerTom Tromey <tromey@redhat.com>2002-07-24 17:58:46 +0000
commitb4f5539f0460e420dddade172f3d17c91470d254 (patch)
tree4873d442fa6ae0748ca69879333061337c403a17 /gdb
parent8e1a114b75cd91c110ca78b6eee8ad3df494ddab (diff)
downloadgdb-b4f5539f0460e420dddade172f3d17c91470d254.zip
gdb-b4f5539f0460e420dddade172f3d17c91470d254.tar.gz
gdb-b4f5539f0460e420dddade172f3d17c91470d254.tar.bz2
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/defs.h2
-rw-r--r--gdb/top.c25
-rw-r--r--gdb/tracepoint.c2
-rw-r--r--gdb/utils.c2
5 files changed, 36 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a3bdf19..3b2b94e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/defs.h b/gdb/defs.h
index 94a1ac8..7dea2b7 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -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);
diff --git a/gdb/top.c b/gdb/top.c
index 10afc64..ee3daf0 100644
--- 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);
+}
+
#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
{
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 19f2906..976f925 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -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);
}
diff --git a/gdb/utils.c b/gdb/utils.c
index 4baea62..b2d9eca 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -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");