From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40194 invoked by alias); 6 Feb 2019 18:42:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 40186 invoked by uid 89); 6 Feb 2019 18:42:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=user's X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Feb 2019 18:42:30 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5576F806A6; Wed, 6 Feb 2019 18:42:29 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40CCC101962A; Wed, 6 Feb 2019 18:42:27 +0000 (UTC) Subject: Re: [PATCH] Make gdb.base/corefile.exp work on terminals with few rows To: Simon Marchi , gdb-patches@sourceware.org References: <20190206034857.14608-1-simon.marchi@polymtl.ca> Cc: philippe.waroquiers@skynet.be From: Pedro Alves Message-ID: <12fe97cd-e3d9-56dd-fd88-f3c0fd7adae1@redhat.com> Date: Wed, 06 Feb 2019 18:42:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190206034857.14608-1-simon.marchi@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-02/txt/msg00042.txt.bz2 On 02/06/2019 03:48 AM, Simon Marchi wrote: > When creating a pty to spawn a subprocess (such as gdb), Expect > copies the settings of its own controlling terminal, including the > number of rows and columns. If you "make check" on a terminal with just > a few rows (e.g. 4), GDB will paginate before reaching the initial > prompt. In default_gdb_start, used by most tests, this is already > handled: if we see the pagination prompt, we sent \n to continue. > > Philippe reported that gdb.base/corefile.exp didn't work in terminals > with just a few rows. This test spawns GDB by hand, because it needs to > check things before the initial prompt, which it couldn't do if it used > default_gdb_start. > > In this case I think it's not safe to use the same technique as in > default_gdb_start. Even if we could send a \n if we see a pagination > prompt, we match some multiline regexes in there. So if a pagination > slips in there, it might make the regexes not match and fail the test. > > It's also not possible to use -ex "set height 0" or -iex "set height 0", > it is handled after the introduction text is shown. > > The simplest way I found to avoid showing the pagination completely is > to set stty_init (documented in expect's man page) to initialize gdb's > pty with a fixed number of rows. Hmm, good idea. But, if you have a small terminal with just a few columns (as opposed to rows), then the testsuite all breaks, AFAICT. E.g., I just tried running gdb.base/break.exp with a small window and the test hangs starting GDB. But with: --- c/gdb/testsuite/lib/gdb.exp +++ w/gdb/testsuite/lib/gdb.exp @@ -4752,6 +4752,9 @@ proc gdb_init { test_file_name } { # tests. setenv TERM "dumb" + global stty_init + set stty_init "rows 25 cols 80" + # Some tests (for example gdb.base/maint.exp) shell out from gdb to use # grep. Clear GREP_OPTIONS to make the behavior predictable, # especially having color output turned on can cause tests to fail. ... it passes. And so does gdb.base/corefile.exp. Is there any reason we'd ever want GDB's terminal size to match whatever the user's term size was? I'd think that sanitizing / forcing the same sizes everywhere would just lead to more stable testing, and thus be a good thing. Thanks, Pedro Alves