From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id iX+mC+KvfGl6rx0AWB0awg (envelope-from ) for ; Fri, 30 Jan 2026 08:19:30 -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=tKgvePSC; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2BC441E08D; Fri, 30 Jan 2026 08:19:30 -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 964CC1E08D for ; Fri, 30 Jan 2026 08:19:29 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 258744BA23C4 for ; Fri, 30 Jan 2026 13:19:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 258744BA23C4 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=tKgvePSC Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 038B94BA23EB for ; Fri, 30 Jan 2026 13:17:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 038B94BA23EB 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 038B94BA23EB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769779044; cv=none; b=I7Yxi5ZKsEGbVjEQiBRB/wwa/xdl4AnlbGnEz3VQdtX+SVlyM5N2bKs0W65Jcev7Dx7WNwnogw60MjX7MIDtpJ9vT8sVdEbWAw1CLcjLpymRBmhhag0Vh3dzyrtPY+DBzvkW3Wgcf9A6GjnvFFXjZXeH+0AT5AK9cKbdgH5dq5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769779044; c=relaxed/simple; bh=FUS9BwJl+MV8OSdesba9H/5VcY8M0efP3nJbWyz4578=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=jlFaU2819tAcQrRf+qtHrXh3AAPjzlD3nxx8mBfCbPbO0Cmb+hKeyFbPeoMN0hhjZ3qpquEMwAc24mMWAfjCZfuJpz4hviPdyj4OL1IIk1+whTY8COSduGmx3ZbwjwQ7svMwqa1Jms3SIziaRuC4vzgotGvFVsPOm0HYqEHCC00= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 038B94BA23EB Received: from eig-obgw-5001b.ext.cloudfilter.net ([10.0.29.181]) by cmsmtp with ESMTPS id lffuvoUE4VCBNloNGvjRyR; Fri, 30 Jan 2026 13:17:23 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id loNGvfeAHSqlVloNGvPsjg; Fri, 30 Jan 2026 13:17:22 +0000 X-Authority-Analysis: v=2.4 cv=I7FlRMgg c=1 sm=1 tr=0 ts=697caf62 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=ItBw4LHWJt0A:10 a=20KFwNOVAAAA:8 a=rPvbOkSdLdZbhwq_Sp0A:9 a=QEXdDO2ut3YA:10 a=IX-fT7oG24nEkPRVm_sx:22 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=fz7xOPDO2WmkZjOOaU5G2iJ+elD0/xYNCHRRNNJ4ON8=; b=tKgvePSC9XlGKorsc/H4ZSlY0M j7mJCh5eijQ2O9+T9+5lbqUYIVlQr1keyhtW4KJox5WvDKnnx2rDRZa0E2UiJ0sA5qQvVHpZIdkhi BLnHaIGiy3O081CQEhHrRBZjh; 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 1vloNG-00000001JjQ-0TQf; Fri, 30 Jan 2026 06:17:22 -0700 From: Tom Tromey Date: Fri, 30 Jan 2026 06:17:18 -0700 Subject: [PATCH v3 04/21] Small rewrite of get_unbuffered MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260130-pr-28948-logging-5-v3-4-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 , Andrew Burgess 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: 1vloNG-00000001JjQ-0TQf 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: 8 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfBP5osbIIQ+VK3E7QDrPdqVQ97s1+LaelhwTBRuSLffN6QBg2pItQt8nHTczHIjaEfhxbpCJaothlv7V4m00pdPP1TJpZOaB8xoswUwGiwtYHa2rnVJE sBHNZjoa6JPF7gcEdnRTveLnQSnUUbvngchxMZPAsebPHgpe/MB6zmySfCciX4HopDkd7oQaDfW/amrOt/r64biHwCxRC32VJtk= 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 This rewrites get_unbuffered to use iteration rather than recursion. I also noticed a typo in the documentation comment, so that's fixed as well. Approved-By: Andrew Burgess --- gdb/ui-out.c | 11 +++++++---- gdb/ui-out.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 87874e22530..00c2055f492 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -907,12 +907,15 @@ buffer_group::flush_here (ui_file *stream) ui_file * get_unbuffered (ui_file *stream) { - buffering_file *buf = dynamic_cast (stream); + while (true) + { + buffering_file *buf = dynamic_cast (stream); - if (buf == nullptr) - return stream; + if (buf == nullptr) + return stream; - return get_unbuffered (buf->stream ()); + stream = buf->stream (); + } } buffered_streams::buffered_streams (buffer_group *group, ui_out *uiout) diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 9d63b4c2940..ee5e68fa233 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -529,7 +529,7 @@ struct buffer_group std::unique_ptr m_buffered_streams; }; -/* If FILE is a buffering_file, return it's underlying stream. */ +/* If FILE is a buffering_file, return its underlying stream. */ extern ui_file *get_unbuffered (ui_file *file); -- 2.49.0