summaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2012-05-08 18:49:42 +0000
committerEli Zaretskii <eliz@gnu.org>2012-05-08 18:49:42 +0000
commitc41535fdc41896a2e881e1386eb3be9dff6ca6c4 (patch)
tree27748eeb952799924a6f232d7d48398c331fc846 /gdb/cli
parent80f5885c0674e3f865455e9e03ea60e67f1e4ed3 (diff)
downloadbinutils-gdb-c41535fdc41896a2e881e1386eb3be9dff6ca6c4.tar.gz
Display the ">" prompt in interactive mode while reading canned
commands, even when the current interpreter is MI. interps.c (interp_set_temp): New function. interps.h (interp_set_temp): Add prototype. cli/cli-script.c (restore_interp): New cleanup function. (read_command_lines): Temporarily override the current interpreter with CLI and arrange for restoring the original one.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-script.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index cfa1c771c50..4b6c4169145 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1178,6 +1178,12 @@ recurse_read_control_structure (char * (*read_next_line_func) (void),
return ret;
}
+static void
+restore_interp (void *arg)
+{
+ interp_set_temp (interp_name ((struct interp *)arg));
+}
+
/* Read lines from the input stream and accumulate them in a chain of
struct command_line's, which is then returned. For input from a
terminal, the special command "end" is used to mark the end of the
@@ -1210,8 +1216,21 @@ read_command_lines (char *prompt_arg, int from_tty, int parse_commands,
}
}
- head = read_command_lines_1 (read_next_line, parse_commands,
- validator, closure);
+
+ /* Reading commands assumes the CLI behavior, so temporarily
+ override the current interpreter with CLI. */
+ if (current_interp_named_p (INTERP_CONSOLE))
+ head = read_command_lines_1 (read_next_line, parse_commands,
+ validator, closure);
+ else
+ {
+ struct interp *old_interp = interp_set_temp (INTERP_CONSOLE);
+ struct cleanup *old_chain = make_cleanup (restore_interp, old_interp);
+
+ head = read_command_lines_1 (read_next_line, parse_commands,
+ validator, closure);
+ do_cleanups (old_chain);
+ }
if (deprecated_readline_end_hook && from_tty && input_from_terminal_p ())
{