From patchwork Wed Feb 6 03:48:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 31318 Received: (qmail 54941 invoked by alias); 6 Feb 2019 03:49:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 51034 invoked by uid 89); 6 Feb 2019 03:49:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=H*Ad:D*ca, slips, rows, technique X-HELO: barracuda.ebox.ca Received: from barracuda.ebox.ca (HELO barracuda.ebox.ca) (96.127.255.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Feb 2019 03:49:00 +0000 Received: from smtp.ebox.ca (smtp.electronicbox.net [96.127.255.82]) by barracuda.ebox.ca with ESMTP id MaxlTvZJ2AvqaScu (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 05 Feb 2019 22:48:58 -0500 (EST) Received: from simark.lan (unknown [192.222.164.54]) by smtp.ebox.ca (Postfix) with ESMTP id 48736441B21; Tue, 5 Feb 2019 22:48:58 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: philippe.waroquiers@skynet.be, Simon Marchi Subject: [PATCH] Make gdb.base/corefile.exp work on terminals with few rows Date: Tue, 5 Feb 2019 22:48:57 -0500 Message-Id: <20190206034857.14608-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-IsSubscribed: yes 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. gdb/testsuite/ChangeLog: * gdb.base/corefile.exp: Set stty_init. --- gdb/testsuite/gdb.base/corefile.exp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index 0053f0594586..c494a875bd31 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -39,6 +39,10 @@ if {$corefile == ""} { return 0 } +# Initialize GDB's pty with a fixed size, to make sure we avoid pagination +# during startup. See "man expect" for details about stty_init. +set stty_init "rows 25 cols 80" + # Test that we can simply startup with a "-core=$corefile" command line arg # and recognize that the core file is a valid, usable core file. # To do this, we must shutdown the currently running gdb and restart