Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:bmwiedemann:reproducible:distribution:ring1
gdb
gdb-tui-allow-command-window-of-1-or-2-lines.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gdb-tui-allow-command-window-of-1-or-2-lines.patch of Package gdb
From 02616ce7c5571e5b2680cad52f8c58b27f77b2a5 Mon Sep 17 00:00:00 2001 From: Tom de Vries <tdevries@suse.de> Date: Thu, 9 Nov 2023 09:04:39 +0100 Subject: [PATCH 4/6] [gdb/tui] Allow command window of 1 or 2 lines When starting TUI in a terminal with 2 lines (likewise with 1 line): ... $ echo $LINES 2 $ gdb -q -tui ... we run into this assert in tui_apply_current_layout: ... /* This should always be made visible by a layout. */ gdb_assert (TUI_CMD_WIN != nullptr); ... The problem is that for the command window: - the minimum height is 3 (the default), but - the maximum height is only 2 because there are only 2 lines. This discrepancy eventually leads to a call to newwin in make_window with: ... (gdb) p height $1 = 3 (gdb) p width $2 = 66 (gdb) p y $3 = -1 (gdb) p x $4 = 0 (gdb) ... which results in a nullptr, which eventually triggers the assert. The easiest way to fix this is to change the minimum height of the command window to 1. However, that would also change behaviour for the case that the screen size is 3 lines or more. For instance, in gdb.tui/winheight.exp the number of lines in the terminal is 24, and the test-case checks that the user cannot increase the source window height to the point that the command window height would be less than 3. Fix this by calculating the minimum height of the command window as follows: - the default (3) if max_height () allows it, and - max_height () otherwise. Tested on x86_64-linux. PR tui/31044 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31044 --- gdb/tui/tui-command.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h index f6842880bb2..e8c96ecee30 100644 --- a/gdb/tui/tui-command.h +++ b/gdb/tui/tui-command.h @@ -57,6 +57,18 @@ struct tui_cmd_window : public tui_win_info /* The command window can't be made invisible. */ } + /* Compute the minimum height of this window. */ + virtual int min_height () const override + { + int preferred_min = tui_win_info::min_height (); + int max = max_height (); + /* If there is enough space to accommodate the preferred minimum height, + use it. Otherwise, use as much as possible. */ + return (preferred_min <= max + ? preferred_min + : max); + } + int start_line = 0; protected: -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor