From patchwork Thu Nov 17 18:29:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 60792 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B36B73852C57 for ; Thu, 17 Nov 2022 18:29:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B36B73852C57 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668709786; bh=gpY27NP9v2xVd47LZAMdKPDZZlZ1+L5+aFpUZM254hA=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=iKLuB6E36nH6EqmbKgLHk7Z0ZZ0Khzva3RdAtPycs8ZC5GnPgBTlZ1yMhv3LMKA+w taJ+YKIcqcNV/cgZvcA9UxpzUDa/2gh3Qa93+LcKWiTC7pX+X4HTFr0/GX4u2nkaHf HnSkWx2bBcd7jaX8dcVbqdrJ9kcpxPTnFzPFzQN4= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id D97C03853D46 for ; Thu, 17 Nov 2022 18:29:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D97C03853D46 Received: by mail-il1-x133.google.com with SMTP id d3so1354126ils.1 for ; Thu, 17 Nov 2022 10:29:16 -0800 (PST) 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=gpY27NP9v2xVd47LZAMdKPDZZlZ1+L5+aFpUZM254hA=; b=wuwli4/kWktUTQ3F+9m1yStO7GG9OXkKLXnWjDvpP/ot9iKQ8WaDCRG4ehIg2Gfxb8 wPhLq0km7YZIF7/V0XdQis9pqqlJFF9UiZo1NEQYP82+peLOZEKuBlnUmu1q84RVDTWG 5OE6qa2JoQ5t8jxbKfnp3Q9XtIcfq6w2orZYW+Wxd4f5goXWIH75k17I5Hq519hdpHGB vJRAEKAyxGitDiBws/fpuBBm6jS2hPxkSerILu/xk5+q5G+gi/eqlnjvJLp17nSELKb6 RegQDKX85Att4uYFXojrcbSOv+uLIarspi6Y5nW3av4yGOFZdk/b6B7KHr2N+HXBPzO4 CGMQ== X-Gm-Message-State: ANoB5plsufg7cpvuVBLewBzkcaOVpaSq50asMEQOPyyMghTGjlijVwHj muEGZ6SqVZDXaZnvNQQiINuP7m50QrJVFQ== X-Google-Smtp-Source: AA0mqf6TaoaC/pQfivIZQQIxbXNhCTqOD74Rqr7zdqCd9DNQnwK/llmRp6O3e6I1PQsREhNIeYMm5w== X-Received: by 2002:a92:d685:0:b0:300:d794:1f00 with SMTP id p5-20020a92d685000000b00300d7941f00mr1872989iln.63.1668709756174; Thu, 17 Nov 2022 10:29:16 -0800 (PST) Received: from localhost.localdomain (97-122-76-186.hlrn.qwest.net. [97.122.76.186]) by smtp.gmail.com with ESMTPSA id g68-20020a025b47000000b00365c1bd9ac7sm469409jab.113.2022.11.17.10.29.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 10:29:15 -0800 (PST) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 3/3] Don't let gdb_stdlog use pager Date: Thu, 17 Nov 2022 11:29:04 -0700 Message-Id: <20221117182904.1291713-4-tromey@adacore.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20221117182904.1291713-1-tromey@adacore.com> References: <20221117182904.1291713-1-tromey@adacore.com> MIME-Version: 1.0 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" When using the "set logging" commands, cli_interp_base::set_logging will send gdb_stdlog output (among others) to the tee it makes for gdb_stdout. However, this has the side effect of also causing logging to use the pager. This is PR gdb/29787. This patch fixes the problem by keeping stderr and stdlog separate from stdout, preserving the rule that only gdb_stdout should page. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29787 --- gdb/cli/cli-interp.c | 24 ++++++++++++++---------- gdb/cli/cli-interp.h | 1 + 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index 2e8f6135405..3254efc3581 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -389,24 +389,28 @@ cli_interp_base::set_logging (ui_file_up logfile, bool logging_redirect, 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 *tee = nullptr; - if (!logging_redirect || !debug_redirect) + /* The new stdout and stderr only depend on whether logging + redirection is being done. */ + ui_file *new_stdout = logfile_p; + ui_file *new_stderr = logfile_p; + if (!logging_redirect) { m_saved_output->tee_to_delete.reset (new tee_file (gdb_stdout, logfile_p)); - tee = m_saved_output->tee_to_delete.get (); + new_stdout = m_saved_output->tee_to_delete.get (); + m_saved_output->stderr_to_delete.reset + (new tee_file (gdb_stderr, logfile_p)); + new_stderr = m_saved_output->stderr_to_delete.get (); } m_saved_output->log_to_delete.reset - (new timestamped_file (debug_redirect ? logfile_p : tee)); + (new timestamped_file (debug_redirect ? logfile_p : new_stderr)); - gdb_stdout = logging_redirect ? logfile_p : tee; + gdb_stdout = new_stdout; gdb_stdlog = m_saved_output->log_to_delete.get (); - gdb_stderr = logging_redirect ? logfile_p : tee; - gdb_stdtarg = logging_redirect ? logfile_p : tee; - gdb_stdtargerr = logging_redirect ? logfile_p : tee; + gdb_stderr = new_stderr; + gdb_stdtarg = new_stderr; + gdb_stdtargerr = new_stderr; } else { diff --git a/gdb/cli/cli-interp.h b/gdb/cli/cli-interp.h index fa007d78621..978e7f291e4 100644 --- a/gdb/cli/cli-interp.h +++ b/gdb/cli/cli-interp.h @@ -42,6 +42,7 @@ class cli_interp_base : public interp 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; };