From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 661FA3858D37 for ; Thu, 27 Apr 2023 21:06:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 661FA3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4CF4321B91; Thu, 27 Apr 2023 21:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682629575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YJnEi27dpVUvFKP+ucJYOuLDHNibcyZ8C4EmLJa4rpM=; b=PlRSjrKgaqlp3bm9EeNlwr+hmsm8Z4SAYWG5bb3+z7Y7wfRp74GaA2WjOAGQbN1dtxw3EN eiF7broq/y9XQeYOvxkut78hG13cr3XSRMO4uwaksSQE67Cx55H4qUvSIl2nFEDV3Iahkr GD5VqbB4ybMBshLkZ87O8n//Ntcda44= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682629575; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YJnEi27dpVUvFKP+ucJYOuLDHNibcyZ8C4EmLJa4rpM=; b=ewypOrp6iwxx8/jOyfyki/c0aaGnC4SofHgkApw4uIPAdmzIu8UWLH/2orIycBGgD3FtuK ++G909E0hN7K/kBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3761F138F9; Thu, 27 Apr 2023 21:06:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hy06DMfjSmSjVgAAMHmgww (envelope-from ); Thu, 27 Apr 2023 21:06:15 +0000 Message-ID: <8cbba796-f112-09f8-e3c2-3e9c76cddf6e@suse.de> Date: Thu, 27 Apr 2023 23:06:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH] [gdb/cli] Add maint info screen To: John Baldwin , gdb-patches@sourceware.org References: <20230417140906.25341-1-tdevries@suse.de> Content-Language: en-US From: Tom de Vries In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 4/27/23 22:49, John Baldwin wrote: > On 4/17/23 7:09 AM, Tom de Vries via Gdb-patches wrote: >> While working on PRs tui/30337 and cli/30346 I came across various >> notions of >> width in gdb, as reported by gdb, readline, curses and the environment >> variables. >> >> As for gdb, readline and the environment variables, the way things work >> is: >> - Gdb asks readline to detect screen size, >> - readline sets the actual screen size in the environment variables >>    COLUMNS and LINES, >> - readline reports back a screen size to gdb, which may have one column >>    less than the actual screen size, to deal with lack of auto-wrap. >>    This becomes gdb's notion of screen size (in other words the point >> where >>    we can expect the gdb command line to wrap), >> - Gdb then explicitly sets readline's screen size, which readline >> itself may >>    adjust to deal with lack of auto-wrap.  This becomes readlines notion >>    of screen size (well, internally the unadjusted one, but it'll >> report back >>    the adjusted one). >> >> Add a command "maint info screen" that prints these notions, both for >> width >> and height. >> >> For TERM=xterm we have: >> ... >> $ TERM=xterm gdb -ex "maint info screen" >> Number of characters gdb thinks are in a line is 118. >> Number of characters readline reports are in a line is 118. >> Number of characters curses thinks are in a line is 118. >> Number of characters environment thinks are in a line is 118 (COLUMNS). >> Number of lines gdb thinks are in a page is 27. >> Number of lines readline reports are in a page is 27. >> Number of lines curses thinks are in a page is 27. >> Number of lines environment thinks are in a page is 27 (LINES). >> ... >> >> And for TERM=ansi: >> ... >> $ TERM=ansi gdb -ex "maint info screen" >> Number of characters gdb thinks are in a line is 117. >> Number of characters readline reports are in a line is 116. >> Number of characters curses thinks are in a line is 118. >> Number of characters environment thinks are in a line is 118 (COLUMNS). >> Number of lines gdb thinks are in a page is 27. >> Number of lines readline reports are in a page is 27. >> Number of lines curses thinks are in a page is 27. >> Number of lines environment thinks are in a page is 27 (LINES). >> ... >> >> [ The fact that we have "characters readline reports are in a line is >> 116" is >> is due to gdb making readline adjust twice for the lack of auto-wrap, >> this is >> PR cli/30346. >> >> Likewise we can detect tui/30337 by doing a resize in TUI mode and doing >> "maint info screen": >> ... >> Number of characters characters curses thinks are in a line is 110. >> Number of characters environment thinks are in a line is 111 (COLUMNS). ] >> >> And for TERM=ansi, with width and heigth set to 0: >> ... >> Number of characters gdb thinks are in a line is 4294967295 (unlimited). >> Number of characters readline reports are in a line is 32766 >> (unlimited - 1). >> Number of characters curses thinks are in a line is 118. >> Number of characters environment thinks are in a line is 118 (COLUMNS). >> Number of lines gdb thinks are in a page is 4294967295 (unlimited). >> Number of lines readline reports are in a page is 32767 (unlimited). >> Number of lines curses thinks are in a page is 27. >> Number of lines environment thinks are in a page is 27 (LINES). >> ... >> >> [ Note that when doing a resize by say maximizing or de-maximizing a >> terminal, >> all reported values are updated, except for curses when not in TUI mode. >> >> Maybe that means there's a bug.  If not, then maybe we should not print >> the curses lines unless in TUI mode, or annotate those lines such that >> it's >> clear that the values may be not up-to-date. ] >> >> I'd like to use this command in the regression test for PR cli/30346. >> >> Tested on x86_64-linux. > > I was building GDB in a Linux x86-64 VM that didn't have curses-dev > installed and > this change causes GDB to no longer build: Hi, this was already reported before ( https://sourceware.org/bugzilla/show_bug.cgi?id=30391 ), but using your report I can now also reproduce it after doing "sudo zypper remove ncurses-devel", thanks. - Tom