diff options
author | Tom de Vries <tdevries@suse.de> | 2025-02-04 22:11:13 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2025-02-04 22:11:13 +0100 |
commit | a2ead10b2f3bdcf616388c879dd346a5a72bb591 (patch) | |
tree | bde9a8bb13cbf1d0f60f690ff23e42341dd92fc7 | |
parent | f784fcab5a74d0dff754ae9deb263006c0a19fcf (diff) | |
download | binutils-a2ead10b2f3bdcf616388c879dd346a5a72bb591.zip binutils-a2ead10b2f3bdcf616388c879dd346a5a72bb591.tar.gz binutils-a2ead10b2f3bdcf616388c879dd346a5a72bb591.tar.bz2 |
[gdb/tui] Clean up asserts in tui_source_window_base::refresh_window
Commit 1c525b0e037 ("[gdb/tui] Fix assert in
tui_source_window_base::refresh_window") added an early return in
tui_source_window_base::refresh_window.
Assert after the early return that "m_pad != nullptr", and clean up the
following asserts that allow for m_pad == nullptr.
Tested on x86_64-linux.
Reported-By: Andrew Burgess <aburgess@redhat.com>
Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
-rw-r--r-- | gdb/tui/tui-winsource.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index a5d0c59..83d9fc0 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -316,6 +316,7 @@ tui_source_window_base::refresh_window () if (m_content.empty ()) return; + gdb_assert (m_pad != nullptr); int pad_width = getmaxx (m_pad.get ()); int left_margin = this->left_margin (); @@ -339,8 +340,8 @@ tui_source_window_base::refresh_window () should only occur during the initial startup. In this case the first condition in the following asserts will not be true, but the nullptr check will. */ - gdb_assert (pad_width > 0 || m_pad.get () == nullptr); - gdb_assert (pad_x + view_width <= pad_width || m_pad.get () == nullptr); + gdb_assert (pad_width > 0); + gdb_assert (pad_x + view_width <= pad_width); int sminrow = y + box_width (); int smincol = x + box_width () + left_margin; |