From: Guinevere Larsen <guinevere@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb] Add selftest for tui_setup_io
Date: Fri, 10 Apr 2026 10:31:56 -0300 [thread overview]
Message-ID: <e4affd8b-7c8c-43ab-86b1-ffc23d695e5b@redhat.com> (raw)
In-Reply-To: <20260403113156.2890482-1-tdevries@suse.de>
On 4/3/26 8:31 AM, Tom de Vries wrote:
> Add a selftest for the problem described in commit b171f68e945 ("[gdb/tui]
> Make tui_setup_io more robust").
Hi Tom!
I looked over this patch and it makes sense, and I verified that it does
trigger a crash before the listed commit, so it is properly testing it.
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
--
Cheers,
Guinevere Larsen
It/she
> ---
> gdb/tui/tui-io.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
> index 4b4bc818430..642b88ead0c 100644
> --- a/gdb/tui/tui-io.c
> +++ b/gdb/tui/tui-io.c
> @@ -46,6 +46,7 @@
> #include "pager.h"
> #include "gdbsupport/gdb-checked-static-cast.h"
> #include "logging-file.h"
> +#include "gdbsupport/selftest.h"
>
> /* This redefines CTRL if it is not already defined, so it must come
> after terminal state related include files like <term.h> and
> @@ -1328,3 +1329,36 @@ tui_getc (FILE *fp)
> return 0;
> }
> }
> +
> +#if GDB_SELF_TEST
> +namespace selftests {
> +namespace tui {
> +namespace io {
> +
> +static void
> +run_tests ()
> +{
> + if (!tui_active)
> + {
> + /* Calling tui_setup_io (0) when tui is disabled should have no effect. */
> + tui_setup_io (0);
> +
> + /* If the output streams are reduced to nullptrs, then the self-test
> + infrastructure will crash when trying to report these failures. */
> + SELF_CHECK (*redirectable_stdout () != nullptr);
> + SELF_CHECK (*redirectable_stderr () != nullptr);
> + SELF_CHECK (*redirectable_stdlog () != nullptr);
> + }
> +}
> +
> +} /* namespace io */
> +} /* namespace tui */
> +} /* namespace selftests */
> +#endif /* GDB_SELF_TEST */
> +
> +INIT_GDB_FILE (tui_io)
> +{
> +#if GDB_SELF_TEST
> + selftests::register_test ("tui-io", selftests::tui::io::run_tests);
> +#endif
> +}
>
> base-commit: db4f00be62d3396374df989b5f938c3ebec6833e
next prev parent reply other threads:[~2026-04-10 13:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 11:31 Tom de Vries
2026-04-10 13:31 ` Guinevere Larsen [this message]
2026-04-10 13:51 ` 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=e4affd8b-7c8c-43ab-86b1-ffc23d695e5b@redhat.com \
--to=guinevere@redhat.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