From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120431 invoked by alias); 7 Feb 2017 10:51:43 -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 120421 invoked by uid 89); 7 Feb 2017 10:51:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=readable, H*f:sk:1486462, H*MI:sk:1486462, H*i:sk:1486462 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; Tue, 07 Feb 2017 10:51:32 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6ED6E7E9C8; Tue, 7 Feb 2017 10:51:32 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v17ApVik003858; Tue, 7 Feb 2017 05:51:31 -0500 Subject: Re: [PATCH,v2] Make gdb.arch/i386-biarch-core.exp more robust To: Luis Machado , gdb-patches@sourceware.org References: <1485870927-12623-1-git-send-email-lgustavo@codesourcery.com> <1486462287-14715-1-git-send-email-lgustavo@codesourcery.com> From: Pedro Alves Message-ID: <1700b740-dc19-5d7e-5737-4e0313dba2fb@redhat.com> Date: Tue, 07 Feb 2017 10:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1486462287-14715-1-git-send-email-lgustavo@codesourcery.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-02/txt/msg00146.txt.bz2 On 02/07/2017 10:11 AM, Luis Machado wrote: > This test attempts to load a x86 core file no matter what target > architectures the tested GDB supports. If GDB doesn't know how to handle > a i386 target, it is very likely the core file will not be recognized. > > In this case we should still attempt to load a core file to make sure GDB > doesn't crash or throws an internal error. But we should not proceed to > try to read memory unconditionally. > > This patch makes the test check for proper i386 arch support in GDB and bails > out if i386 is not supported and the core file format is not recognized. > > This addresses the spurious aarch64-elf failures i'm seeing for this test. > > gdb/testsuite/ChangeLog: > > YYYY-MM-DD Luis Machado > > * gdb.arch/i386-biarch-core.exp: Check for i386 arch support and > return if core file is not recognized > --- > gdb/testsuite/gdb.arch/i386-biarch-core.exp | 30 ++++++++++++++++++++++++++++- > 1 file changed, 29 insertions(+), 1 deletion(-) > > diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp > index 4c5f450..a05096c 100644 > --- a/gdb/testsuite/gdb.arch/i386-biarch-core.exp > +++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp > @@ -54,6 +54,18 @@ if {$corestat(size) != 102400} { > return -1 > } > > +# First check if this particular GDB supports i386, otherwise we should not > +# expect the i386 core file to be loaded successfully. > +set supports_arch_i386 1 > +set test "complete set architecture i386" > +gdb_test_multiple $test $test { > + -re ".*\r\nset architecture i386\r\n(.*\r\n)?$gdb_prompt $" { ".*" at the start of a -re is implicit/redundant. > + } > + -re "\r\n$gdb_prompt $" { > + set supports_arch_i386 0 > + } > +} > + > # Wrongly built GDB complains by: > # "..." is not a core dump: File format not recognized > # As the provided test core has 64bit PRSTATUS i386 built GDB cannot parse it. > @@ -62,7 +74,23 @@ if {$corestat(size) != 102400} { > # objcopy as it corrupts the core file beyond all recognition. > # The output therefore does not matter much, just we should not get GDB > # internal error. > -gdb_test "core-file ${corefile}" ".*" "core-file" > +# > +# If this particular GDB does not support i386, it is expected GDB will not > +# recognize the core file. If it does anyway, it should not crash. > +set test "load core file" > +gdb_test_multiple "core-file ${corefile}" $test { > + -re ".* no core file handler recognizes format(.*\r\n)?$gdb_prompt $" { Ditto. Also, why the "(....)?" in "(.*\r\n)?" ? > + if { $supports_arch_i386 } { > + fail $test > + } else { > + untested $test The "load core file" test was a pass, this "else" outcome is expected. What's untested is the next test. Either write something like: pass $test untested ".text is readable (core file unrecognized)" return or here write only: pass $test and put the untested after the gdb_test_multiple, close to the following gdb_test. > + return > + } > + } > + -re "\r\n$gdb_prompt $" { > + pass $test > + } > +} > Thanks, Pedro Alves