From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wX1BF76vfGl6rx0AWB0awg (envelope-from ) for ; Fri, 30 Jan 2026 08:18:54 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=G90GBQIR; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5B06D1E08D; Fri, 30 Jan 2026 08:18:54 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id CBF6E1E08D for ; Fri, 30 Jan 2026 08:18:53 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 3346B4BA23DA for ; Fri, 30 Jan 2026 13:18:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3346B4BA23DA Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=G90GBQIR Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 9F7124BA23E2 for ; Fri, 30 Jan 2026 13:17:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9F7124BA23E2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9F7124BA23E2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769779045; cv=none; b=k1t9iE+6y8qT83i6w87a5xJOAs/ZEDNptCfo7voS9FRZGM7nnCJB+vuZljNFde7fG4TwCCApDRscaDRChbQEviOa3l0g3SRULu+pvO1Y4vu+uNVqrEO7ZHIesr1DiWVQO+1nZ06gPZy28OQwvOE7qf1j/CGLw3T6+mjPgeMGtNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769779045; c=relaxed/simple; bh=IZuyEzEMGQqvjpDJJ8ZD16PjQ/LC9OJ5tXY6CoenGvY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=evF4d6F9wVNHCq7SPK8EBALhH8HQfWBGTuP521VG4iZLBZ0u3MPxfLLzzEBtwN0RlZwgGW8eOAFRYgKoc2fjo4zvMrLoE7RDZ9DPibuaaqZciYHSx43LMEruntO55jGr0cbkFEQzb4q0X+en1MwM/guglaht7hIBmwtWbgDGKgU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F7124BA23E2 Received: from eig-obgw-6006b.ext.cloudfilter.net ([10.0.30.211]) by cmsmtp with ESMTPS id lhmZvEYy3SkcfloNJvvWXb; Fri, 30 Jan 2026 13:17:25 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id loNIvVb2BvXvHloNIvTyFv; Fri, 30 Jan 2026 13:17:25 +0000 X-Authority-Analysis: v=2.4 cv=e4IGSbp/ c=1 sm=1 tr=0 ts=697caf65 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=ItBw4LHWJt0A:10 a=7E1gycmMaGfRLPZTgaUA:9 a=QEXdDO2ut3YA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nwt/V8M3tfqp1wk7WThJuep863yS0kwwzRhtRq17i8k=; b=G90GBQIRz4thXp/mZICYvzf8Cu P3EDxW5jILXSYX+G4etJWa7y1M15Q2370FIB+x07tqYJcZ8kIMy5nj3e8OFpkWuaK/PiAfdM2vPUo ROByAVFmM8ZQzlc28NT9olNGJ; Received: from 97-122-114-32.hlrn.qwest.net ([97.122.114.32]:33716 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vloNI-00000001JjQ-2RAO; Fri, 30 Jan 2026 06:17:24 -0700 From: Tom Tromey Date: Fri, 30 Jan 2026 06:17:25 -0700 Subject: [PATCH v3 11/21] Restore ui_file::can_page MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260130-pr-28948-logging-5-v3-11-3eec47ef3cba@tromey.com> References: <20260130-pr-28948-logging-5-v3-0-3eec47ef3cba@tromey.com> In-Reply-To: <20260130-pr-28948-logging-5-v3-0-3eec47ef3cba@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.114.32 X-Source-L: No X-Exim-ID: 1vloNI-00000001JjQ-2RAO X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-114-32.hlrn.qwest.net ([192.168.122.1]) [97.122.114.32]:33716 X-Source-Auth: tom+tromey.com X-Email-Count: 19 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfBziamM8x0H27oIi4VSjmesSLPIcXWD6Vuqux39UrX5DXTQE1m6o95ASzQ93SOLmKSXJJIqBeKH+zbiURQ85yKnb65rhZspWtdtY0sJMrcmg6SX7eAY0 uedCgTkZTZYTmSpXe+Th/seGepV/IGKgDE9iDy1Iw3f1AiRX5fn7AflZ/4K1LIqvdEs6VkcIslIHrCW4nk4k0LSYm8xPZBb4+uE= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org A while back, I removed the ui_file::can_page method. It wasn't needed for a while, due to how output redirections were done. With the new approach in this series, it's convenient to have this method again, because the pipeline downstream from the pager won't change when logging -- the logging filter will be enabled or disabled without reconfiguring the pipeline. This method lets the pager adapt correctly. --- gdb/ui-file.h | 18 ++++++++++++++++++ gdb/utils.c | 6 ++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gdb/ui-file.h b/gdb/ui-file.h index 231c32deafc..4aaf4d0e54e 100644 --- a/gdb/ui-file.h +++ b/gdb/ui-file.h @@ -101,6 +101,14 @@ class ui_file virtual int fd () const { return -1; } + /* Return true if this object supports paging, false otherwise. */ + virtual bool can_page () const + { + /* Almost no file supports paging, which is why this is the + default. */ + return false; + } + /* Indicate that if the next sequence of characters overflows the line, a newline should be inserted here rather than when it hits the end. If INDENT is non-zero, it is a number of spaces to be @@ -270,6 +278,11 @@ class stdio_file : public ui_file int fd () const override { return m_fd; } + bool can_page () const override + { + return m_file == stdout; + } + private: /* Sets the internal stream to FILE, and saves the FILE's file descriptor in M_FD. */ @@ -452,6 +465,11 @@ class wrapped_file : public ui_file void write_async_safe (const char *buf, long length_buf) override { return m_stream->write_async_safe (buf, length_buf); } + bool can_page () const override + { + return m_stream->can_page (); + } + protected: explicit wrapped_file (T stream) diff --git a/gdb/utils.c b/gdb/utils.c index f4c9e584628..03a1d9146f2 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1640,7 +1640,8 @@ pager_file::check_for_overfull_line (const unsigned int lines_allowed) this loop, so we must continue to check it here. */ if (pagination_enabled && !pagination_disabled_for_command - && lines_printed >= lines_allowed) + && lines_printed >= lines_allowed + && m_stream->can_page ()) { prompt_for_continue (); did_paginate = true; @@ -1713,7 +1714,8 @@ pager_file::puts (const char *linebuffer) it here. */ if (pagination_enabled && !pagination_disabled_for_command - && lines_printed >= lines_allowed) + && lines_printed >= lines_allowed + && m_stream->can_page ()) prompt_for_continue (); while (*linebuffer != '\0' && *linebuffer != '\n') -- 2.49.0