Rename fields of cli_interp_base::saved_output_files
authorTom Tromey <tromey@adacore.com>
Mon, 28 Nov 2022 21:01:35 +0000 (14:01 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 30 Nov 2022 14:12:32 +0000 (07:12 -0700)
This renames the fields of cli_interp_base::saved_output_files, as
requested by Simon.  I tried to choose names that more obviously
reflect what the field is used for.  I also added a couple of
comments.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/cli/cli-interp.c
gdb/cli/cli-interp.h

index 3254efc358159c4de039c7e20578781bad375dc3..dbe46402c2bbbb3770fb3a54017df8b174c4cc22 100644 (file)
@@ -387,7 +387,7 @@ cli_interp_base::set_logging (ui_file_up logfile, bool logging_redirect,
       m_saved_output->targerr = gdb_stdtargerr;
 
       ui_file *logfile_p = logfile.get ();
-      m_saved_output->file_to_delete = std::move (logfile);
+      m_saved_output->logfile_holder = std::move (logfile);
 
       /* The new stdout and stderr only depend on whether logging
         redirection is being done.  */
@@ -395,19 +395,19 @@ cli_interp_base::set_logging (ui_file_up logfile, bool logging_redirect,
       ui_file *new_stderr = logfile_p;
       if (!logging_redirect)
        {
-         m_saved_output->tee_to_delete.reset
+         m_saved_output->stdout_holder.reset
            (new tee_file (gdb_stdout, logfile_p));
-         new_stdout = m_saved_output->tee_to_delete.get ();
-         m_saved_output->stderr_to_delete.reset
+         new_stdout = m_saved_output->stdout_holder.get ();
+         m_saved_output->stderr_holder.reset
            (new tee_file (gdb_stderr, logfile_p));
-         new_stderr = m_saved_output->stderr_to_delete.get ();
+         new_stderr = m_saved_output->stderr_holder.get ();
        }
 
-      m_saved_output->log_to_delete.reset
+      m_saved_output->stdlog_holder.reset
        (new timestamped_file (debug_redirect ? logfile_p : new_stderr));
 
       gdb_stdout = new_stdout;
-      gdb_stdlog = m_saved_output->log_to_delete.get ();
+      gdb_stdlog = m_saved_output->stdlog_holder.get ();
       gdb_stderr = new_stderr;
       gdb_stdtarg = new_stderr;
       gdb_stdtargerr = new_stderr;
index 978e7f291e4064f05828cd3d5d0823df6336e154..ad2167e0e1f40ca7a85a03c95613f9a5ff7abc97 100644 (file)
@@ -36,15 +36,18 @@ public:
 private:
   struct saved_output_files
   {
+    /* Saved gdb_stdout, gdb_stderr, etc.  */
     ui_file *out;
     ui_file *err;
     ui_file *log;
     ui_file *targ;
     ui_file *targerr;
-    ui_file_up tee_to_delete;
-    ui_file_up stderr_to_delete;
-    ui_file_up file_to_delete;
-    ui_file_up log_to_delete;
+    /* When redirecting, some or all of these may be non-null
+       depending on the logging mode.  */
+    ui_file_up stdout_holder;
+    ui_file_up stderr_holder;
+    ui_file_up stdlog_holder;
+    ui_file_up logfile_holder;
   };
 
   /* These hold the pushed copies of the gdb output files.  If NULL