Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3705)

Unified Diff: gdb/cli/cli-script.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/cli/cli-logging.c ('k') | gdb/cli/cli-setshow.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/cli/cli-script.c
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index c8da8c83e14cb4d5bff571cccf8388d70252b4bf..4b6c416914584c45af803a6b489502029a37f2e7 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 ())
{
@@ -1614,11 +1633,9 @@ script_from_file (FILE *stream, const char *file)
if (stream == NULL)
internal_error (__FILE__, __LINE__, _("called with NULL file pointer!"));
- old_cleanups = make_cleanup_fclose (stream);
-
old_lines.old_line = source_line_number;
old_lines.old_file = source_file_name;
- make_cleanup (source_cleanup_lines, &old_lines);
+ old_cleanups = make_cleanup (source_cleanup_lines, &old_lines);
source_line_number = 0;
source_file_name = file;
/* This will get set every time we read a line. So it won't stay ""
« no previous file with comments | « gdb/cli/cli-logging.c ('k') | gdb/cli/cli-setshow.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698