From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122529 invoked by alias); 11 Aug 2016 12:51:30 -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 122518 invoked by uid 89); 11 Aug 2016 12:51:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=HX-Envelope-From:sk:thomas. X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Aug 2016 12:51:27 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E8AF528; Thu, 11 Aug 2016 05:52:54 -0700 (PDT) Received: from [10.2.206.52] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7F5203F459; Thu, 11 Aug 2016 05:51:25 -0700 (PDT) Subject: Re: [PATCH v5] Add negative repeat count to 'x' command To: Pedro Alves , Toshihito Kikuchi , gdb-patches@sourceware.org References: <1464857355-29883-1-git-send-email-k.toshihito@yahoo.de> <4e8feff5-935e-668e-6c68-87603173a953@foss.arm.com> <69169a01-7a25-1e72-810d-2971337ce002@redhat.com> Cc: Simon Marchi From: Thomas Preudhomme Message-ID: <50dbd13a-52a2-9687-ace0-5aa51e1bc1d1@foss.arm.com> Date: Thu, 11 Aug 2016 12:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <69169a01-7a25-1e72-810d-2971337ce002@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg00131.txt.bz2 On 11/08/16 00:58, Pedro Alves wrote: > On 08/08/2016 03:45 PM, Thomas Preudhomme wrote: >> Sorry for the late reply but I noticed an issue in the tests added by >> this patch for arm-none-eabi: >> >> >> FAIL: gdb.base/examine-backward.exp: address zero boundary: examine 3 >> bytes forward from 0x0 >> NA->FAIL: gdb.base/examine-backward.exp char-width=1, print-max=20 take >> 1 string backward (6/6) >> NA->FAIL: gdb.base/examine-backward.exp char-width=1, print-max=20 take >> 6 strings backward (pattern 1) >> >> >> The first one is a testism: >> >> we match for: 0x\[0-9a-f\]+00.*:${byte}${byte}${byte} >> but we get: 0x0: 0x7f 0x45 0x4c >> >> I'd thus suggest to match 0x\(\[0-9a-f\]+0\)?0 instead, with the right >> amount of escaping (I don't know whether ? needs escaping and why + does >> not need escaping in current pattern). > > We're examining at 0x0. Shouldn't we expect literally "0x0" > instead then? That's what I would have done but I assumed that the test was passing on the machine it was developed and thus that some machine display 0x00000000 or something. > >> >> >> The other two seems like genuine errors. take 6 strings backward >> (pattern 1) gives: >> >> gdb_expect_list pattern: /"ABCDEFGHIJKLMNOPQRST".../ >> x/-6s^M >> 0x9aff <_fini+2>: "\277\370\274\b\274\236FpGABCDEFGHIJK"...^M >> 0x9b13 : "LMNOPQRSTUVWXYZ"^M >> 0x9b23 : ""^M >> 0x9b24 : ""^M >> 0x9b25 : >> "\343\201\273\343\201\222\343\201\273\343\201\222"^M >> 0x9b32 : "01234567890123456789"...^M >> (gdb) FAIL: gdb.base/examine-backward.exp: char-width=1, print-max=20: >> take 6 strings backward (pattern 1) >> >> >> take 1 string backward (6/6) gives: >> >> 0x9aff <_fini+2>: "\277\370\274\b\274\236FpGABCDEFGHIJK"... >> >> >> Please let me know what I can do to help diagnose this error. > > The find-strings-backwards algorithm just looks back for '\0' to > find string boundaries. Looks like it just happens that in your > case, the TestStrings array is immediately preceded by the > tail of _fini, with no gap in between. > > Try this. It's not strictly correct to assume that the linker > places the objects consecutively, but it's probably safe > in practice. The patch works indeed. Thanks for your quick answer. Best regards, Thomas > > diff --git c/gdb/testsuite/gdb.base/examine-backward.c w/gdb/testsuite/gdb.base/examine-backward.c > index b338503..187fad1 100644 > --- c/gdb/testsuite/gdb.base/examine-backward.c > +++ w/gdb/testsuite/gdb.base/examine-backward.c > @@ -32,6 +32,14 @@ literals. The content of each array is the same as followings: > }; > */ > > +/* This is here just to ensure we have a null character before > + TestStrings, to avoid showing garbage when we look for strings > + backwards from TestStrings. */ > + > +const char NullString[] = { > + 0x00 > +}; > + > const char TestStrings[] = { > 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, > 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, > >