diff options
Diffstat (limited to 'gdb/mi/mi-interp.c')
-rw-r--r-- | gdb/mi/mi-interp.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 4568d39..6a19bf0 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -1286,18 +1286,27 @@ mi_interp::set_logging (ui_file_up logfile, bool logging_redirect) if (logfile != NULL) { mi->saved_raw_stdout = mi->raw_stdout; - mi->raw_stdout = make_logging_output (mi->raw_stdout, - std::move (logfile), - logging_redirect); + /* If something is being redirected, then grab logfile. */ + ui_file *logfile_p = nullptr; + if (logging_redirect) + logfile_p = logfile.release (); + + /* If something is not being redirected, then a tee containing both the + logfile and stdout. */ + ui_file *tee = nullptr; + if (!logging_redirect) + tee = new tee_file (mi->raw_stdout, std::move (logfile)); + + mi->raw_stdout = logging_redirect ? logfile_p : tee; } else { delete mi->raw_stdout; mi->raw_stdout = mi->saved_raw_stdout; - mi->saved_raw_stdout = NULL; + mi->saved_raw_stdout = nullptr; } - + mi->out->set_raw (mi->raw_stdout); mi->err->set_raw (mi->raw_stdout); mi->log->set_raw (mi->raw_stdout); |