From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81020 invoked by alias); 4 May 2018 12:47:21 -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 81008 invoked by uid 89); 4 May 2018 12:47:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=reaches, stripped X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 04 May 2018 12:47:19 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A42E8D777; Fri, 4 May 2018 12:47:18 +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 978C31DB27; Fri, 4 May 2018 12:47:17 +0000 (UTC) Subject: Re: [PATCH 3/3] gdb/testsuite: Handle targets with lots of registers To: Andrew Burgess , gdb-patches@sourceware.org References: <4273f7eb-464a-3abc-fc50-b6598ed3b896@redhat.com> <20180504120124.GK3375@embecosm.com> Cc: "Maciej W. Rozycki" From: Pedro Alves Message-ID: <0233be15-ab15-4877-1e49-7355d113afb7@redhat.com> Date: Fri, 04 May 2018 12:47:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180504120124.GK3375@embecosm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-05/txt/msg00085.txt.bz2 On 05/04/2018 01:01 PM, Andrew Burgess wrote: > Thanks for the review feedback. > > I've updated the patch below inline with Pedro's feedback, and > included a header check as requested by Maciej. I tested this on > x86-64 and against RiscV which is the target that was originally > causing me problems. Thanks. > # Test for a regression where this command would internal-error if the > -# program wasn't running. > -gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*" > +# program wasn't running. If there's a lot of registers then this > +# might overflow expect's buffers, so process the output line at a > +# time. > +set saw_registers 0 > +set saw_headers 0 > +set test "maint print registers" > +gdb_test_multiple $test $test { > + -re "\[^\r\n\]+Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\[\r\n\]+" { > + set saw_headers 1 > + exp_continue > + } > + -re "^\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[\r\n\]+" { > + set saw_registers 1 > + exp_continue > + } > + -re "^\\*\[0-9\]+\[^\r\n\]+\[\r\n\]+" { > + exp_continue > + } > + -re "$gdb_prompt $" { > + gdb_assert $saw_registers "$test: saw some registers" > + gdb_assert $saw_headers "$test: saw header line" We try to avoid the potential for different FAIL / PASS names/messages. I.e., if the test times out, or gdb crashes, you'll get "FAIL: $test" only , while if it reaches the prompt, you'll get two tests recorded in gdb.sum. The idea of matching FAIL/PASS is to make it easier for scripts to distinguish regressions/progressions vs new failures/passes. (Text in trailing ()s, like " (timeout)" is considered informational, and can/should be stripped for test-matching purposes). If you want to record that the register and headers were seen, better put it in gdb.log, with send_log or verbose -log, and do: gdb_assert {$saw_registers && $saw_headers} $test OK with that change. Thanks, Pedro Alves