From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>, Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH v3 00/21] Rework gdb logging and output redirection
Date: Fri, 30 Jan 2026 06:17:14 -0700 [thread overview]
Message-ID: <20260130-pr-28948-logging-5-v3-0-3eec47ef3cba@tromey.com> (raw)
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 <tom@tromey.com>
---
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 <tom@tromey.com>
next reply other threads:[~2026-01-30 13:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 13:17 Tom Tromey [this message]
2026-01-30 13:17 ` [PATCH v3 01/21] Remove unnecessary override of write_async_safe Tom Tromey
2026-01-30 13:17 ` [PATCH v3 02/21] Move stdtarg to ui Tom Tromey
2026-01-30 13:17 ` [PATCH v3 03/21] Turn wrapped_file into a template Tom Tromey
2026-01-30 13:17 ` [PATCH v3 04/21] Small rewrite of get_unbuffered Tom Tromey
2026-01-30 13:17 ` [PATCH v3 05/21] Move buffered stream to new files Tom Tromey
2026-01-30 13:17 ` [PATCH v3 06/21] Remove TYPE_FN_FIELD_STUB and associated code Tom Tromey
2026-01-30 13:17 ` [PATCH v3 07/21] Change how stdin is handled in the UI Tom Tromey
2026-01-30 13:17 ` [PATCH v3 08/21] Remove gdb_stdtargin Tom Tromey
2026-01-30 13:17 ` [PATCH v3 09/21] Improve fputs_highlighted by using ui_file::write Tom Tromey
2026-01-30 13:17 ` [PATCH v3 10/21] Add stream to buffer_group::output_unit constructor Tom Tromey
2026-01-30 13:17 ` [PATCH v3 11/21] Restore ui_file::can_page Tom Tromey
2026-01-30 13:17 ` [PATCH v3 12/21] Rewrite cli-style.c:do_show Tom Tromey
2026-01-30 13:17 ` [PATCH v3 13/21] Remove m_applied_style from ui_file Tom Tromey
2026-01-30 13:17 ` [PATCH v3 14/21] Add a new logging_file implementation Tom Tromey
2026-01-30 13:17 ` [PATCH v3 15/21] Rewrite output redirection and logging Tom Tromey
2026-01-30 13:17 ` [PATCH v3 16/21] Remove tee_file Tom Tromey
2026-01-30 13:17 ` [PATCH v3 17/21] Warn if log file changed while logging Tom Tromey
2026-01-30 13:17 ` [PATCH v3 18/21] Fix leaks with timestamped_file Tom Tromey
2026-01-30 13:17 ` [PATCH v3 19/21] Use std::make_unique with ui_files Tom Tromey
2026-01-30 13:17 ` [PATCH v3 20/21] Style filenames in cli-logging.c Tom Tromey
2026-01-30 13:17 ` [PATCH v3 21/21] Update gdb.execute documentation Tom Tromey
2026-01-30 13:35 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260130-pr-28948-logging-5-v3-0-3eec47ef3cba@tromey.com \
--to=tom@tromey.com \
--cc=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox