From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id PD6jJayvfGl6rx0AWB0awg (envelope-from ) for ; Fri, 30 Jan 2026 08:18:36 -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=w1pqYGts; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8877C1E08D; Fri, 30 Jan 2026 08:18:36 -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 AE5D71E08D for ; Fri, 30 Jan 2026 08:18:35 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 0DC594BA23E3 for ; Fri, 30 Jan 2026 13:18:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DC594BA23E3 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=w1pqYGts Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 10B004BA2E32 for ; Fri, 30 Jan 2026 13:17:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10B004BA2E32 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 10B004BA2E32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769779042; cv=none; b=QCshAGnn+7MPSPjGKiv2lCZUUlPAERgzxYG3aVUMX1GlaSbORp6Ka/EGX9kmSCEripz8fyacnFsxut5XqPrf2Qm8hanBdLpQn3FwtSZSMEbThp+MQUKmzdDCIXP9H9RKKgssvfcihsRYFqBSSMe4x7jkIqBEZB+UjXdSCfHiL2c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769779042; c=relaxed/simple; bh=jqrGXqphNFUr0N3w4teqW0kBIBsDb1eeguRiTDpO+d4=; h=DKIM-Signature:From:Subject:Date:Message-Id:MIME-Version:To; b=jwrWhxaUJEC2eFnZc0m43k48CcN5ZT2V9k+wcloi4NoN73hc5lqx4/nATxx6p3hTOer7qyCofxpfQfTV9TgEESq8BibRvE1aQP+sxNH4E4A52dBzvcxvyaXRlaYqO+QJpTqVclKe84F3uYBOFUNAfj7aehtHi/dvRNBJnjj5+4E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 10B004BA2E32 Received: from eig-obgw-6004b.ext.cloudfilter.net ([10.0.30.210]) by cmsmtp with ESMTPS id lazbv8eJtKXDJloNFvJduF; Fri, 30 Jan 2026 13:17:21 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id loNEvFYdFK8vzloNFvgo5d; Fri, 30 Jan 2026 13:17:21 +0000 X-Authority-Analysis: v=2.4 cv=cJDgskeN c=1 sm=1 tr=0 ts=697caf61 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=ItBw4LHWJt0A:10 a=CCpqsmhAAAAA:8 a=zstS-IiYAAAA:8 a=3z05BGzZtNdD_CEO2kwA:9 a=QEXdDO2ut3YA:10 a=ul9cdbp4aOFLsgKbc677:22 a=4G6NA9xxw8l3yy4pmD5M: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:Content-Transfer-Encoding:Content-Type:MIME-Version: Message-Id:Date:Subject:From:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=1Pj+UAG/KiK0rKkzEXT6gUBk4TSbNcMPHuYI0TusO3c=; b=w1pqYGtsWEc0oFj9Cd6cbetBwD 7r7jYjsK2eZq4KtpA/IRa6Mv9t9duakj9ac9ZjKTKmVFlQJWtUNrVWfOU8ZgggvF+eSBZ4Ds6BeGO EYs6K7IX/nDFTRqLGrBj0dVYa; 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 1vloNE-00000001JjQ-2dXU; Fri, 30 Jan 2026 06:17:20 -0700 From: Tom Tromey Subject: [PATCH v3 00/21] Rework gdb logging and output redirection Date: Fri, 30 Jan 2026 06:17:14 -0700 Message-Id: <20260130-pr-28948-logging-5-v3-0-3eec47ef3cba@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAFqvfGkC/32OQQqDMBBFryJZd9okahK76j1KFxpHDVQjE5GKe PdGoYtC6fLBvPdnZQHJYWDXZGWEswvODxHSU8JsVw4tgqsjM8llLqSQMBJIU2QGnr5t3dBCDlq nudJamNwqFsWRsHGvI3p/RK7KgFBROdhuT3lyUbz0ZZiQ9vvOhcnTcvwwi936OzcL4IDKqKwuk Iuqvk3ke1zO1vds35vlp6G4EPpnQ8aG1Wh51ihVpOarsW3bGzGxurMZAQAA X-Change-ID: 20251212-pr-28948-logging-5-7735677185c6 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: 1vloNE-00000001JjQ-2dXU 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: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDiP8zjbNXqT8PHTavxtH0VgEpNf8NdXTI6xvul7CA7w344W73bTsYzuW3tcq9teugSn15dxJa2Oaxm2+OeKwM3XBO2k/5zgMIjp8xTX+ot00s3ut1rr AYa+buLGpGx4mjdA8FRvceWeqHgH1xqzO52Vfe+FnmakGONCg2ayIAScB4PGtCm2T5iI7zkbDfWpwgFCBj/QJwcyQ/u4kdTZYAI= 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 series reworks gdb's logging and output redirection. Most of the patches here are cleanups of various kinds, either before or after the big changes. The ones to pay particular attention to are patch 13 ("Remove m_applied_style from ui_file") and patch 15 ("Rewrite output redirection and logging"). This series tries to rationalize and document the way gdb output works. There's some new comments in patch 15 that try to explain the approach. I've also tacked on a fix for the other logging bug I found in bugzilla, some fixes for memory leaks, and a documentation patch describing how logging affects gdb.execute. Regression tested on x86-64 Fedora 40. Signed-off-by: Tom Tromey --- Changes in v3: - New documentation patch for decision on logging - Link to v2: https://inbox.sourceware.org/gdb-patches/20260117-pr-28948-logging-5-v2-0-c7ec04f66938@tromey.com Changes in v2: - Addressed review comments - Use ui_file_up in some places, including a new patch for this - Fix some memory leaks, including a new patch for this - New patch to add styles to cli-logging.c - New patch to remove gdb_stdtargin - Link to v1: https://inbox.sourceware.org/gdb-patches/20251212-pr-28948-logging-5-v1-0-e6864d9e01bd@tromey.com --- Tom Tromey (21): Remove unnecessary override of write_async_safe Move stdtarg to ui Turn wrapped_file into a template Small rewrite of get_unbuffered Move buffered stream to new files Remove TYPE_FN_FIELD_STUB and associated code Change how stdin is handled in the UI Remove gdb_stdtargin Improve fputs_highlighted by using ui_file::write Add stream to buffer_group::output_unit constructor Restore ui_file::can_page Rewrite cli-style.c:do_show Remove m_applied_style from ui_file Add a new logging_file implementation Rewrite output redirection and logging Remove tee_file Warn if log file changed while logging Fix leaks with timestamped_file Use std::make_unique with ui_files Style filenames in cli-logging.c Update gdb.execute documentation gdb/Makefile.in | 2 + gdb/buffered-streams.c | 155 +++++++++++++++++ gdb/buffered-streams.h | 219 +++++++++++++++++++++++++ gdb/c-typeprint.c | 35 ++-- gdb/cli-out.c | 21 ++- gdb/cli-out.h | 7 +- gdb/cli/cli-interp.c | 70 +------- gdb/cli/cli-interp.h | 22 --- gdb/cli/cli-logging.c | 199 +++++++++++++++++----- gdb/cli/cli-style.c | 5 +- gdb/debuginfod-support.c | 1 + gdb/doc/python.texi | 7 + gdb/fork-child.c | 4 +- gdb/gdbtypes.c | 167 ------------------- gdb/gdbtypes.h | 20 +-- gdb/gnu-v3-abi.c | 1 - gdb/guile/scm-ports.c | 14 +- gdb/infrun.c | 1 + gdb/interps.c | 25 +-- gdb/interps.h | 66 +++++--- gdb/linespec.c | 2 - gdb/logging-file.h | 82 +++++++++ gdb/main.c | 10 +- gdb/mi/mi-console.c | 10 -- gdb/mi/mi-console.h | 3 - gdb/mi/mi-interp.c | 64 +------- gdb/mi/mi-interp.h | 18 +- gdb/mi/mi-out.c | 3 +- gdb/mi/mi-out.h | 5 +- gdb/pager.h | 22 +-- gdb/python/py-dap.c | 10 +- gdb/python/py-uiout.h | 5 +- gdb/remote-fileio.c | 2 +- gdb/serial.c | 2 +- gdb/stack.c | 1 + gdb/testsuite/gdb.base/early-logging.exp | 35 ++++ gdb/testsuite/gdb.base/style.exp | 20 +++ gdb/testsuite/gdb.base/ui-redirect.exp | 3 + gdb/testsuite/gdb.python/py-styled-execute.exp | 3 +- gdb/testsuite/gdb.python/python.exp | 16 ++ gdb/thread.c | 1 + gdb/top.c | 99 +++++++++-- gdb/tui/tui-interp.c | 15 -- gdb/tui/tui-io.c | 40 +++-- gdb/ui-file.c | 69 +------- gdb/ui-file.h | 84 ++++------ gdb/ui-out.c | 197 +++++----------------- gdb/ui-out.h | 202 +++-------------------- gdb/ui.c | 17 +- gdb/ui.h | 70 ++++++-- gdb/utils.c | 33 ++-- gdb/utils.h | 64 ++++++-- gdb/valops.c | 6 - 53 files changed, 1169 insertions(+), 1085 deletions(-) --- base-commit: be3c73b4610a7ccf915daca693565bc895f3584e change-id: 20251212-pr-28948-logging-5-7735677185c6 Best regards, -- Tom Tromey