diff options
author | Tom Tromey <tromey@adacore.com> | 2022-11-28 14:05:05 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-11-30 07:12:38 -0700 |
commit | 016c606c66ce4b98c220130b9046545b04254a4a (patch) | |
tree | 6038b987ae2109c812eb3f1a49097c9e59b83c00 /gdb | |
parent | 35254615ab38c37cf934b28982691f458d4c9948 (diff) | |
download | gdb-016c606c66ce4b98c220130b9046545b04254a4a.zip gdb-016c606c66ce4b98c220130b9046545b04254a4a.tar.gz gdb-016c606c66ce4b98c220130b9046545b04254a4a.tar.bz2 |
Use ui_file_up in mi_interp
This changes mi_interp to use ui_file_up rather than explicit
management.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/mi/mi-interp.c | 10 | ||||
-rw-r--r-- | gdb/mi/mi-interp.h | 4 |
2 files changed, 6 insertions, 8 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 482166e..3cc2462 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -1276,7 +1276,7 @@ mi_interp::set_logging (ui_file_up logfile, bool logging_redirect, mi->saved_raw_stdout = mi->raw_stdout; ui_file *logfile_p = logfile.get (); - mi->saved_raw_file_to_delete = logfile.release (); + mi->logfile_holder = std::move (logfile); /* If something is not being redirected, then a tee containing both the logfile and stdout. */ @@ -1284,19 +1284,17 @@ mi_interp::set_logging (ui_file_up logfile, bool logging_redirect, if (!logging_redirect || !debug_redirect) { tee = new tee_file (mi->raw_stdout, logfile_p); - mi->saved_tee_to_delete = tee; + mi->stdout_holder.reset (tee); } mi->raw_stdout = logging_redirect ? logfile_p : tee; } else { - delete mi->saved_raw_file_to_delete; - delete mi->saved_tee_to_delete; + mi->logfile_holder.reset (); + mi->stdout_holder.reset (); mi->raw_stdout = mi->saved_raw_stdout; mi->saved_raw_stdout = nullptr; - mi->saved_raw_file_to_delete = nullptr; - mi->saved_tee_to_delete = nullptr; } mi->out->set_raw (mi->raw_stdout); diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h index d118ffb..6b6e1f7 100644 --- a/gdb/mi/mi-interp.h +++ b/gdb/mi/mi-interp.h @@ -56,8 +56,8 @@ public: file which we need to delete, so we can restore correctly when done. */ struct ui_file *saved_raw_stdout; - struct ui_file *saved_raw_file_to_delete; - struct ui_file *saved_tee_to_delete; + ui_file_up logfile_holder; + ui_file_up stdout_holder; /* MI's builder. */ struct ui_out *mi_uiout; |