aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-console.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>2012-06-28 22:11:23 +0000
committerStan Shebs <shebs@codesourcery.com>2012-06-28 22:11:23 +0000
commit37ce89ebb295e6ed0fc0bf5a4eb2e718ed0fb2ee (patch)
treea9444e8dcde7251482e63cd19e2e1edb9550026e /gdb/mi/mi-console.c
parentfe540416272cd7791a82793a395a4cb65f9fce16 (diff)
downloadgdb-37ce89ebb295e6ed0fc0bf5a4eb2e718ed0fb2ee.zip
gdb-37ce89ebb295e6ed0fc0bf5a4eb2e718ed0fb2ee.tar.gz
gdb-37ce89ebb295e6ed0fc0bf5a4eb2e718ed0fb2ee.tar.bz2
Make logging work for MI.
* NEWS: Mention it. * interps.h (interp_set_logging_ftype): New typedef. (struct interp_procs): New field set_logging_proc. (current_interp_set_logging): Declare. * interps.c (current_interp_set_logging): New function. * cli/cli-logging.c: Include interps.h. (set_logging_redirect): Call current_interp_set_logging. (pop_output_files): Ditto. (handle_redirections): Ditto, plus skip ui-out redirect if MI. * mi/mi-console.h (mi_console_set_raw): Declare. * mi/mi-console.c (mi_console_set_raw): New function. * mi/mi-interp.c (saved_raw_stdout): New global. (mi_set_logging): New function. (_initialize_mi_interp): Add it to interp procs. * gdb.mi/mi-logging.exp: New file.
Diffstat (limited to 'gdb/mi/mi-console.c')
-rw-r--r--gdb/mi/mi-console.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c
index 102b8be..b04e65c 100644
--- a/gdb/mi/mi-console.c
+++ b/gdb/mi/mi-console.c
@@ -135,4 +135,21 @@ mi_console_file_flush (struct ui_file *file)
ui_file_put (mi_console->buffer, mi_console_raw_packet, mi_console);
ui_file_rewind (mi_console->buffer);
+
+}
+
+/* Change the underlying stream of the console directly; this is
+ useful as a minimum-impact way to reflect external changes like
+ logging enable/disable. */
+
+void
+mi_console_set_raw (struct ui_file *file, struct ui_file *raw)
+{
+ struct mi_console_file *mi_console = ui_file_data (file);
+
+ if (mi_console->magic != &mi_console_file_magic)
+ internal_error (__FILE__, __LINE__,
+ _("mi_console_file_set_raw: bad magic number"));
+
+ mi_console->raw = raw;
}