From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCHv2 1/6] gdb/tui: convert a window handle `if` into an `assert`
Date: Fri, 10 Jul 2026 10:47:13 +0100 [thread overview]
Message-ID: <06623277fe8eeb0932593f7a43589f3b4ce22294.1783676703.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1783676703.git.aburgess@redhat.com>
It should only be possible to call tui_win_info::refresh_window on a
window with a valid handle member. To do otherwise would suggest
we're trying to draw to the screen a window which GDB doesn't think is
part of the current layout, which is just wrong.
Currently tui_win_info::refresh_window guards its content with an
`if (handle != NULL)`, but this can be changed to an assert.
A similar assert can be added to
tui_source_window_base::refresh_window, there's no `if` in this
function, which only backs up the reasoning in the first paragraph.
There should be no user-visible changes after this commit.
---
gdb/tui/tui-wingeneral.c | 13 ++++++-------
gdb/tui/tui-winsource.c | 2 ++
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 149ca4efc6e..281c56d475e 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -55,13 +55,12 @@ tui_batch_rendering::~tui_batch_rendering ()
void
tui_win_info::refresh_window ()
{
- if (handle != NULL)
- {
- if (suppress_output)
- wnoutrefresh (handle.get ());
- else
- wrefresh (handle.get ());
- }
+ gdb_assert (handle != nullptr);
+
+ if (suppress_output)
+ wnoutrefresh (handle.get ());
+ else
+ wrefresh (handle.get ());
}
/* Draw a border around the window. */
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index e3f64892e27..c7149ff7c80 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -310,6 +310,8 @@ tui_source_window_base::refresh_window ()
{
TUI_SCOPED_DEBUG_START_END ("window `%s`", name ());
+ gdb_assert (handle != nullptr);
+
/* tui_win_info::refresh_window would draw the empty background window to
the screen, potentially creating a flicker. */
wnoutrefresh (handle.get ());
--
2.25.4
next prev parent reply other threads:[~2026-07-10 9:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 14:22 [PATCH 0/6] gdb/tui: fix debuginfod related crash Andrew Burgess
2026-05-01 14:22 ` [PATCH 1/6] gdb/tui: convert a window handle `if` into an `assert` Andrew Burgess
2026-05-01 14:22 ` [PATCH 2/6] gdb/testsuite: fix tuiterm linefeed scrolling new line content Andrew Burgess
2026-05-01 14:22 ` [PATCH 3/6] gdb/tui: prevent TUI activation from a secondary prompt Andrew Burgess
2026-05-01 14:22 ` [PATCH 4/6] gdb/tui: make tui_win_info::rerender public Andrew Burgess
2026-05-01 14:22 ` [PATCH 5/6] gdb/tui: fix for debuginfod prompt while enabling the TUI Andrew Burgess
2026-05-01 14:22 ` [PATCH 6/6] gdb/tui: fix debuginfod prompt using 'C-x C-a' to enter TUI Andrew Burgess
2026-07-10 9:47 ` [PATCHv2 0/6] gdb/tui: fix debuginfod related crash Andrew Burgess
2026-07-10 9:47 ` Andrew Burgess [this message]
2026-07-10 9:47 ` [PATCHv2 2/6] gdb/testsuite: fix tuiterm linefeed scrolling new line content Andrew Burgess
2026-07-10 9:47 ` [PATCHv2 3/6] gdb/tui: prevent TUI activation from a secondary prompt Andrew Burgess
2026-07-10 9:47 ` [PATCHv2 4/6] gdb/tui: make tui_win_info::rerender public Andrew Burgess
2026-07-10 9:47 ` [PATCHv2 5/6] gdb/tui: fix for debuginfod prompt while enabling the TUI Andrew Burgess
2026-07-10 9:47 ` [PATCHv2 6/6] gdb/tui: fix debuginfod prompt using 'C-x C-a' to enter TUI Andrew Burgess
2026-07-27 15:50 ` [PATCHv2 0/6] gdb/tui: fix debuginfod related crash Andrew Burgess
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=06623277fe8eeb0932593f7a43589f3b4ce22294.1783676703.git.aburgess@redhat.com \
--to=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