From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4082 invoked by alias); 20 Oct 2014 17:46:47 -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 4069 invoked by uid 89); 20 Oct 2014 17:46:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 20 Oct 2014 17:46:46 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id 6B.6A.05330.7F2F4445; Mon, 20 Oct 2014 13:33:11 +0200 (CEST) Received: from [142.133.110.254] (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.84) with Microsoft SMTP Server (TLS) id 14.3.174.1; Mon, 20 Oct 2014 13:46:43 -0400 Message-ID: <54454A82.1050502@ericsson.com> Date: Mon, 20 Oct 2014 17:46:00 -0000 From: Simon Marchi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: GDB Patches Subject: Re: [PATCH] testsuite: expect possible pagination when starting gdb References: <1411765276-413-1-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1411765276-413-1-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00515.txt.bz2 On 2014-09-26 05:01 PM, Simon Marchi wrote: > When gdb starts, the lines that appear before the first prompt may get > paginated if the terminal in which the tests are ran is too small (in > terms of rows). These lines include the welcome/license message and > possibly more, such as "Reading symbols from...". Pagination is disabled > right after gdb is started (with "set height 0"), but this output happens > before we are able to set height. > > If these lines get paginated, gdb waits for the user to press enter and > the test harness waits for gdb to print its prompt, resulting in a > deadlock. > > My first idea was to launch gdb with --quiet. However, some lines are > still printed ("Reading symbols from...", some more stuff when attaching > with --pid, etc). > > The proposed solution simply expects that pagination can occur after > starting gdb. If this is the case, it sends a "\n" and loops. > > gdb/testsuite/Changelog: > > * lib/gdb.exp (default_gdb_start): After starting gdb, loop > as long as we get pagination notifications. > --- > gdb/testsuite/lib/gdb.exp | 39 ++++++++++++++++++++++++--------------- > 1 file changed, 24 insertions(+), 15 deletions(-) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 47dc27b..820f87f 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -1451,7 +1451,7 @@ proc default_gdb_spawn { } { > # Default gdb_start procedure. > > proc default_gdb_start { } { > - global gdb_prompt > + global gdb_prompt pagination_prompt > global gdb_spawn_id > > if [info exists gdb_spawn_id] { > @@ -1466,20 +1466,29 @@ proc default_gdb_start { } { > # When running over NFS, particularly if running many simultaneous > # tests on different hosts all using the same server, things can > # get really slow. Give gdb at least 3 minutes to start up. > - gdb_expect 360 { > - -re "\[\r\n\]$gdb_prompt $" { > - verbose "GDB initialized." > - } > - -re "$gdb_prompt $" { > - perror "GDB never initialized." > - unset gdb_spawn_id > - return -1 > - } > - timeout { > - perror "(timeout) GDB never initialized after 10 seconds." > - remote_close host > - unset gdb_spawn_id > - return -1 > + set loop_again 1 > + while { $loop_again } { > + set loop_again 0 > + gdb_expect 360 { > + -re "$pagination_prompt" { > + verbose "Hit pagination during startup. Pressing enter to continue." > + send_gdb "\n" > + set loop_again 1 > + } > + -re "\[\r\n\]$gdb_prompt $" { > + verbose "GDB initialized." > + } > + -re "$gdb_prompt $" { > + perror "GDB never initialized." > + unset gdb_spawn_id > + return -1 > + } > + timeout { > + perror "(timeout) GDB never initialized after 10 seconds." > + remote_close host > + unset gdb_spawn_id > + return -1 > + } > } > } > > Ping.