From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by sourceware.org (Postfix) with ESMTPS id 14184385B19A for ; Mon, 28 Nov 2022 21:28:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14184385B19A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd35.google.com with SMTP id q21so8651376iod.4 for ; Mon, 28 Nov 2022 13:28:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PLHlzt5UMmC3dO+NlCmHvFJ/IZWxfLnK4v0OAIoiB5Q=; b=hnEP0tct0QvKooEvvGPeNwN1vy234eptqv0ncyJyyWJFjD+nlep7hCpatEaTYeUYGx W09IJL+1IhHKQfyN+5L8MY4ZqlxZnsetk2bNMpMsgPLEI2BM1EF+EM1bB4S9IQ9Fv3Fr FOXkvWPKyQCCsP9oKmgo/81hx7rFRhNddFx6Tyi1IASvDp91jY9KLEZeKxNxpJjQN7Kx mrIfuSMyJ0mCjYXlfh/a0gfbYGtzeFrV74XuJuraFIT/02lvTc8PACYhNq7zYfLaFt/A sJtYZAezdHza1oSClyadMq/XnIOmaRrOLy+VUJuQQcrwCnRIssRpvn8/1aGmPzB/fXed V8PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PLHlzt5UMmC3dO+NlCmHvFJ/IZWxfLnK4v0OAIoiB5Q=; b=zVB7YxfnWvZCnqkg4CILTUDEAbH8AUFY33Ik/fs8FWKWKj9WS9jQh3IUskc1NZnIE5 z7LeaW7T28YXMArfCDp8d5ZtqxJWE97FiTSmwbooI/TOFjDIvTkNDhKy63RxIEkEplwy yXMaEeHOWpkEcNJp/pF0RrEQNGJlvmFOqzr56Hz+hyxRuun5V0QDgcCePjRggMIlFq7U BMGQoHvPjDo/qwAZqcI3UR1ydRRZOoqVWmYjb3JhhA//TyJNdhHHJapXtXu7j0gc4wWL ZnL312F18oFU5Y6k8pIgt9bT6RhPQVsOBQVphhFEDSMrq1PqxaZOmi4GOLmN/Qc02fjL 5kbQ== X-Gm-Message-State: ANoB5pkjEv07gWV2fs9heRXKlPVAF4U355WxglDAWScTPNxQ+6Vpi4eq zNwQWAmf/eh9enKFtz/LHqg60xrvJyHCXw== X-Google-Smtp-Source: AA0mqf6ZJZfGWWsI8V6HgFkFkKLS/CgQibbwaB5+RzmOAiwdo+K+bSa1IfDgfoAecuDJtlDZXuHBBw== X-Received: by 2002:a02:c852:0:b0:364:1001:370a with SMTP id r18-20020a02c852000000b003641001370amr16461084jao.132.1669670935332; Mon, 28 Nov 2022 13:28:55 -0800 (PST) Received: from localhost.localdomain (97-122-76-186.hlrn.qwest.net. [97.122.76.186]) by smtp.gmail.com with ESMTPSA id i9-20020a056e021b0900b002f956529892sm3979604ilv.2.2022.11.28.13.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 13:28:54 -0800 (PST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 1/2] Rename fields of cli_interp_base::saved_output_files Date: Mon, 28 Nov 2022 14:28:44 -0700 Message-Id: <20221128212845.2397077-2-tromey@adacore.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20221128212845.2397077-1-tromey@adacore.com> References: <20221128212845.2397077-1-tromey@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. --- gdb/cli/cli-interp.c | 14 +++++++------- gdb/cli/cli-interp.h | 11 +++++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index 3254efc3581..dbe46402c2b 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -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; diff --git a/gdb/cli/cli-interp.h b/gdb/cli/cli-interp.h index 978e7f291e4..ad2167e0e1f 100644 --- a/gdb/cli/cli-interp.h +++ b/gdb/cli/cli-interp.h @@ -36,15 +36,18 @@ class cli_interp_base : public interp 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 -- 2.34.3