From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id 917763858D37 for ; Thu, 27 Apr 2023 20:49:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 917763858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4Q6nt64v3hz3ytQ; Thu, 27 Apr 2023 20:49:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q6nt646Nzz4Ls5; Thu, 27 Apr 2023 20:49:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682628590; h=from:from:reply-to:subject:subject: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=HTkMcw9pt0JcmsIl7yr8Mn6DyTmTXpLTHTD/ucTL34I=; b=pnnJ4DpkC30anejiLCYgQMI8EwKqRmihSYruXXTC/jLMX0Mkd132rVRFdkQQGb/AUZZskr OfA5oxZ0fjkOga7cg0B7Tz9Xpt6hw4MYttumNkw8vcjhCdZ6qT+zrLR9GrJf3AaBi5LYZW C/SQROaM2JBlmV7hiGp5Cpd+G/g+4afsyBmOjVjBSFS0WvVq91LdHq+Rlx7YPelyY/FmVV vTWQRf48KZvBYBf/Ctmuyr5RmwbCVAPAZQgtwTzitsraTFhmeiJq59B4N4iJfS2QBU3N7e Qr9PXqc5GmwLfpJeuQ2Yv0m6sOoSSsHUg+UFbfDNdIhB/WOi0fL4SCIQck7egQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682628590; h=from:from:reply-to:subject:subject: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=HTkMcw9pt0JcmsIl7yr8Mn6DyTmTXpLTHTD/ucTL34I=; b=pFaAIJzLH93HT9ylUO6aRAH/dwFXZ1JWeMg6zCDxvG9GAhueBvomzKYtp1/wvhw/0J0b0M 32k92qVQElw0+ssPi5PmOE9NguxFNn7JJMi9Ys4vNwALYQp7CVhQFyS2K2XeoqhckG4k3z SRUPv/fc6bpQn2BbCDKjGkPcvfFF7u0u8xAL2oI7elPH7BLKBtsu1GPsKNKuZMiEsn79OG XKDVI69qUHBVH2RyJNhEjNOohJCK4SLM6zytcMrzu7Ex0zTeDPth7g5i7gZi9cx0jOTWih EXaVAvcd4I/lpQ/Mr0afKskvIVpjW8uUFxVMLGLA6xZvsLpYB654YGzQj253CA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682628590; a=rsa-sha256; cv=none; b=qo7p0woeUaqmXsCMYxRPv7yUy8NEJ3m2GKN/y3ZVqOJgf8QjcPHFm4laCYtN7f110cdtvV ntahMgXeAleD6PZUlkN7yxwuCxm1WSxs0PbGNSH281s+4o6/AZwlz43fTVQlHGJdkUJb46 KB7eZ4XlKgVAw1W6o+nZ/Zz7RN9Hdek7qONzSe1OFNcn/omUOnOvDBRZlzPXdN0nHX1weZ TjFk4YUPkGy/G8VcNL2a4gYUfVrM0YBBHAWdc7I7b8nrnE7b4N3DvMpZF7rDltfMOG8LaW tct6CU9SQLnm62bIcKUQCE+uZzpdfBQBmLxNlFyqwVvED1+cWE3JqRjPjwNp8w== Received: from [IPV6:2601:648:8680:16b0:24f5:8737:ed3b:1175] (unknown [IPv6:2601:648:8680:16b0:24f5:8737:ed3b:1175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Q6nt61G2lz1Dc2; Thu, 27 Apr 2023 20:49:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Thu, 27 Apr 2023 13:49:48 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] [gdb/cli] Add maint info screen Content-Language: en-US To: Tom de Vries , gdb-patches@sourceware.org References: <20230417140906.25341-1-tdevries@suse.de> From: John Baldwin In-Reply-To: <20230417140906.25341-1-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,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/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: CXX utils.o /git/gdb/gdb/utils.c: In function ‘void maintenance_info_screen(const char*, int)’: /git/gdb/gdb/utils.c:1310:14: error: ‘COLS’ was not declared in this scope 1310 | COLS); | ^~~~ /git/gdb/gdb/utils.c:1331:15: error: ‘LINES’ was not declared in this scope; did you mean ‘LONGEST’? 1331 | LINES); | ^~~~~ | LONGEST make[2]: *** [Makefile:1920: utils.o] Error 1 -- John Baldwin