aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-interp.c11
-rw-r--r--gdb/cli/cli-interp.h1
2 files changed, 7 insertions, 5 deletions
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 8c2fb20..2e8f613 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -386,17 +386,18 @@ cli_interp_base::set_logging (ui_file_up logfile, bool logging_redirect,
m_saved_output->targ = gdb_stdtarg;
m_saved_output->targerr = gdb_stdtargerr;
+ ui_file *logfile_p = logfile.get ();
+ m_saved_output->file_to_delete = std::move (logfile);
+
/* If something is not being redirected, then a tee containing both the
logfile and stdout. */
- ui_file *logfile_p = logfile.get ();
ui_file *tee = nullptr;
if (!logging_redirect || !debug_redirect)
{
- tee = new tee_file (gdb_stdout, std::move (logfile));
- m_saved_output->file_to_delete.reset (tee);
+ m_saved_output->tee_to_delete.reset
+ (new tee_file (gdb_stdout, logfile_p));
+ tee = m_saved_output->tee_to_delete.get ();
}
- else
- m_saved_output->file_to_delete = std::move (logfile);
m_saved_output->log_to_delete.reset
(new timestamped_file (debug_redirect ? logfile_p : tee));
diff --git a/gdb/cli/cli-interp.h b/gdb/cli/cli-interp.h
index 3c233c0..fa007d7 100644
--- a/gdb/cli/cli-interp.h
+++ b/gdb/cli/cli-interp.h
@@ -41,6 +41,7 @@ private:
ui_file *log;
ui_file *targ;
ui_file *targerr;
+ ui_file_up tee_to_delete;
ui_file_up file_to_delete;
ui_file_up log_to_delete;
};