From: Tom Tromey <tom@tromey.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/4] [gdb] Add logging_file::fd
Date: Wed, 21 Oct 2026 10:54:18 -0600 [thread overview]
Message-ID: <878q3ryoxx.fsf@tromey.com> (raw)
In-Reply-To: <20261021080120.349861-2-tdevries@suse.de> (Tom de Vries's message of "Wed, 21 Oct 2026 10:01:17 +0200")
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Logging_file is derived from ui_file, which defines a virtual fd member
Tom> function:
Tom> ...
Tom> /* If this object has an underlying file descriptor, then return it.
Tom> Otherwise, return -1. */
Tom> virtual int fd () const
Tom> { return -1; }
Tom> ...
Tom> Logging_file doesn't define its own fd, so it defaults to -1.
That test in bt-utils.c (and the other one in event-top.c) look weird to
me. It does this:
if (gdb_stderr == nullptr || gdb_stderr->fd () == -1)
std::ignore = ::write (2, msg, strlen (msg));
else
gdb_stderr->write_async_safe (msg, strlen (msg));
But why is that -1 check there?
Is it because the default ui_file::write_async_safe aborts?
Since if so then maybe that's the real issue: the API is kind of
incoherent here.
I wonder whether we could simply remove the fd() method entirely and
instead make the default write_async_safe do something sensible; or make
it pure virtual and require the subclasses to DTRT.
Tom
next prev parent reply other threads:[~2026-10-21 16:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 8:01 [PATCH 0/4] [gdb/tui] Fix hang in tui_disable in handle_fatal_signal Tom de Vries
2026-10-21 8:01 ` [PATCH 1/4] [gdb] Add logging_file::fd Tom de Vries
2026-10-21 16:54 ` Tom Tromey [this message]
2026-10-23 8:02 ` Tom de Vries
2026-10-23 17:41 ` Tom Tromey
2026-10-23 18:25 ` Tom de Vries
2026-10-21 8:01 ` [PATCH 2/4] [gdb/testsuite] Check internal-error in gdb.tui/new-ui.exp Tom de Vries
2026-10-21 8:01 ` [PATCH 3/4] [gdb/tui] Switch to main UI before disabling TUI Tom de Vries
2026-10-21 8:01 ` [PATCH 4/4] [gdb/tui] Fix hang in tui_disable in handle_fatal_signal Tom de Vries
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=878q3ryoxx.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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