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 10/21] Add stream to buffer_group::output_unit constructor
Date: Fri, 30 Jan 2026 06:17:24 -0700 [thread overview]
Message-ID: <20260130-pr-28948-logging-5-v3-10-3eec47ef3cba@tromey.com> (raw)
In-Reply-To: <20260130-pr-28948-logging-5-v3-0-3eec47ef3cba@tromey.com>
I noticed that when creating a new output_unit, all the calls looked
like:
m_buffered_output.emplace_back ("", indent).m_stream = stream;
It seems better to simply pass the stream to the constructor.
Approved-By: Andrew Burgess <aburgess@redhat.com>
---
gdb/buffered-streams.c | 6 +++---
gdb/buffered-streams.h | 6 ++++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/gdb/buffered-streams.c b/gdb/buffered-streams.c
index a9d3fcf4f5d..71122c7f237 100644
--- a/gdb/buffered-streams.c
+++ b/gdb/buffered-streams.c
@@ -51,7 +51,7 @@ buffer_group::write (const char *buf, long length_buf, ui_file *stream)
&& m_buffered_output.back ().m_msg.back () != '\n')
m_buffered_output.back ().m_msg.append (msg);
else
- m_buffered_output.emplace_back (msg).m_stream = stream;
+ m_buffered_output.emplace_back (stream, msg);
prev = cur + 1;
}
}
@@ -61,7 +61,7 @@ buffer_group::write (const char *buf, long length_buf, ui_file *stream)
void
buffer_group::wrap_here (int indent, ui_file *stream)
{
- m_buffered_output.emplace_back ("", indent).m_stream = stream;
+ m_buffered_output.emplace_back (stream, "", indent);
}
/* See buffered-streams.h. */
@@ -69,7 +69,7 @@ buffer_group::wrap_here (int indent, ui_file *stream)
void
buffer_group::flush_here (ui_file *stream)
{
- m_buffered_output.emplace_back ("", -1, true).m_stream = stream;
+ m_buffered_output.emplace_back (stream, "", -1, true);
}
/* See buffered-streams.h. */
diff --git a/gdb/buffered-streams.h b/gdb/buffered-streams.h
index 0da2d8a8f43..9da45b08b6b 100644
--- a/gdb/buffered-streams.h
+++ b/gdb/buffered-streams.h
@@ -48,8 +48,10 @@ struct buffer_group
struct output_unit
{
- output_unit (std::string msg, int wrap_hint = -1, bool flush = false)
- : m_msg (msg), m_wrap_hint (wrap_hint), m_flush (flush)
+ output_unit (ui_file *stream, std::string msg, int wrap_hint = -1,
+ bool flush = false)
+ : m_stream (stream), m_msg (msg), m_wrap_hint (wrap_hint),
+ m_flush (flush)
{}
/* Write contents of this output_unit to the underlying stream. */
--
2.49.0
next prev parent reply other threads:[~2026-01-30 13:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 13:17 [PATCH v3 00/21] Rework gdb logging and output redirection Tom Tromey
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 ` Tom Tromey [this message]
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-10-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