From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 920A33845178; Wed, 22 Nov 2023 18:05:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 920A33845178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1700676355; bh=ZhUltIfLTkE6NB9x8rS3gEzONKH22Lgs6fAFuU4Z/Zo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jldwd283ZTWVdsL0Gvx08a7k5dWm0ezdvLi6pN5xM0nIvesWsb26keUlCeRk1UIwf ymhOh2oo3uOdthdMX8xTTyeYGQkycvwQW6LPHAHW9FOgdRvt5308/Sry5VnITCxuoH dUwxrCwFx+gMVxXFXOu1KJ5l9nl2wYTjOATZdptA= From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tui/31044] [gdb/tui] segfault when enabling TUI in window with two lines Date: Wed, 22 Nov 2023 18:05:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tui X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31044 --- Comment #5 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Tom de Vries : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D6697fa28bb6e= e610323ea10cb815bac85c6d8184 commit 6697fa28bb6ee610323ea10cb815bac85c6d8184 Author: Tom de Vries Date: Wed Nov 22 19:07:47 2023 +0100 [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 !=3D 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 wi= th: ... (gdb) p height $1 =3D 3 (gdb) p width $2 =3D 66 (gdb) p y $3 =3D -1 (gdb) p x $4 =3D 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 comm= and window to 1. However, that would also change behaviour for the case th= at 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. Approved-By: Tom Tromey PR tui/31044 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31044 --=20 You are receiving this mail because: You are on the CC list for the bug.=