From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81658 invoked by alias); 7 Jul 2018 14:05:23 -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 81315 invoked by uid 89); 7 Jul 2018 14:05:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 07 Jul 2018 14:05:21 +0000 Received: by simark.ca (Postfix, from userid 112) id 22ED31E52F; Sat, 7 Jul 2018 10:05:20 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1530972320; bh=t9YMIDEafxdHfCopkVg9sYQMORQZLUYB5FqCsX5i3/Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fYw4XRRwbu46rkEnjajLVRtzi6+hyH5eRn31OsYFXjFzjNC0yo2wxpcM5boN/3CKy IWhUuEDr7SB2cERual/lK5LWSJdvcrfObVa8Bz3G6ixzlnYe6ywDJ8AbhEtAGUIlFl bx6MBxS+p24wWFUvmu5ZEOErwePPMvO0imW+pTsU= Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id EF7491E08D; Sat, 7 Jul 2018 10:05:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1530972317; bh=t9YMIDEafxdHfCopkVg9sYQMORQZLUYB5FqCsX5i3/Q=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=h8xXI1Gf/DSMSmkXKeXVP+wp/7jFnmx9JnR+8+WfKuy3lhdXdEyENS+xSCUYnTZ9N 1yEpuRlVfOGV7eYEbvpWavEwYZoUO8OSzRAhRkp0TcoRqjViHDQun6M1Uqc2IKDBP2 fk4OGaU3AKqHuJrBFkE8oSZ2HERehRF9TwU0G5ds= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 07 Jul 2018 14:05:00 -0000 From: Simon Marchi To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb/testsuite: Allow for failure to read some memory addresses In-Reply-To: <20180707103256.GS2675@embecosm.com> References: <20180704181302.5364-1-andrew.burgess@embecosm.com> <2cd1d95a-b6fb-3a4d-d07c-5cd9762725e2@simark.ca> <20180707103256.GS2675@embecosm.com> Message-ID: <8b0bda54ba8746523f4474c91b652e89@simark.ca> X-Sender: simark@simark.ca User-Agent: Roundcube Webmail/1.3.6 X-SW-Source: 2018-07/txt/msg00167.txt.bz2 On 2018-07-07 06:32, Andrew Burgess wrote: > * Simon Marchi [2018-07-06 22:14:59 -0400]: > >> On 2018-07-04 02:13 PM, Andrew Burgess wrote: >> > In the gdb.base/examine-backward.exp test script, we check to see if >> > address zero is readable, and then read memory first forward from >> > address zero, and then backward from address zero. >> > >> > The problem is, being able to read address zero does not guarantee >> > that you'll be able to read from the other end of the address space, >> > and the test probably shouldn't assume that is the case. >> > >> > This patch extends the success conditions so that, even if GDB fails >> > to read memory, so long as the error message indicates that GDB was >> > trying to access the correct location, then we consider this a pass. >> > The test is, I think, trying to show that GDB can compute the correct >> > address when going backward from zero, being able to access the memory >> > at that address is secondary. >> > >> > One further change is that, when we examined the memory at address >> > zero, the regexp used to match the address expected that the zero >> > address would have two '0' digits as the least significant digits. As >> > GDB strips leading zeros from addresses this was causing the test to >> > fail. I've reduced the zero address to a single 0 digit. >> >> Hi Andrew, >> >> This probably means that we could run the test even if address 0 is >> not readable? >> On x86_64, I get: >> >> (gdb) x/3b 0 >> 0x0: Cannot access memory at address 0x0 >> (gdb) x/-6b >> 0xfffffffffffffffb: Cannot access memory at address 0xfffffffffffffffb >> >> It's not the exact same result as if address 0 is readable (since we >> didn't >> get to read all three bytes in the first command), but it still >> reaches >> the goal of the test. >> >> > + set test "examine 6 bytes backward" >> > + gdb_test_multiple "x/-6x" "$test" { >> > + -re "0x\[0-9a-f\]+fd.*:${byte}${byte}${byte}${byte}${byte}${byte}.*\[\r\n\]*$gdb_prompt $" { >> > + pass $test >> > + } >> > + -re "0x\[0-9a-f\]+fd.*:\tCannot access memory at address 0x\[0-9a-f\]+fd.*\[\r\n\]*$gdb_prompt $" { >> > + # We test that we can read zero, but that's no >> > + # guarantee that we can read from the other end of the >> > + # address space. If we get an error about trying to >> > + # read from the expected address then we count that as >> > + # a pass, GDB did try to read the correct location. >> > + pass $test >> > + } >> > + -re "$gdb_prompt $" { >> > + fail $test >> > + } >> >> Is the last stanza necessary? From what I remember, if it doesn't >> match >> any other one, it will already fail the test. > > Thanks for the feedback. > > I've updated the test so it now runs more of the tests even when > address 0x0 is not readable. > > I've removed the extra fail conditions, because, as you point out they > are covered by gdb_test_multiple anyway. > > Thanks, > Andrew Looks good, thanks! Simon