From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23696 invoked by alias); 15 May 2013 10:23: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 23685 invoked by uid 89); 15 May 2013 10:23:29 -0000 X-Spam-SWARE-Status: No, score=-8.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 15 May 2013 10:23:29 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4FANQ9C018363 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 15 May 2013 06:23:26 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r4FANONH027197; Wed, 15 May 2013 06:23:25 -0400 Message-ID: <5193621C.50603@redhat.com> Date: Wed, 15 May 2013 10:23:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Eli Zaretskii CC: gdb-patches@sourceware.org Subject: Re: [PATCH 3/5] range stepping: gdb References: <20130514191026.13213.39574.stgit@brno.lan> <20130514191047.13213.8476.stgit@brno.lan> <83k3n173ao.fsf@gnu.org> In-Reply-To: <83k3n173ao.fsf@gnu.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-05/txt/msg00509.txt.bz2 On 05/14/2013 08:46 PM, Eli Zaretskii wrote: >> From: Pedro Alves >> Date: Tue, 14 May 2013 20:10:47 +0100 >> >> When user issues the "step" command on the following line of source, >> >> a = b + c + d * e - a; >> >> GDB single-steps every single instruction until the program reaches a >> new different line. > > I always thought that GDB sets a temporary breakpoint at the end, and > then lets the target run freely. Why not? Because we don't know whether there are instructions in the line that jump/branch to a different place. We'd miss the breakpoint and lose control. > >> +@var{end} is the address of the first instruction beyond the step >> +range, and @strong{not} the address of the last instruction within it. >> +(This has the property that @var{start} == @var{end} single-steps >> +once, and only once, even if the instruction at @var{start} jumps to >> +@var{end}.) > > This sentence in parentheses got me completely confused. Before > reading it, I thought I understood what is this about; now I don't. > In particular, if START is equal to END, then how in the world could > the instruction at START jump to END? Sorry, I had that typo in the gdbserver code as well, fixed it there, but missed this one. It should read, even if the instruction at @var{start} jumps to @var{start}. vCont;r first steps, then checks. IOW: vCont ;r ADDR1,ADDR1 is equivalent to (and could be thought to supersede): vCont ;s > And if END is excluded from the > range, then why when START equals END do we step at all? Please > explain. It's just a design decision. I recall at least one target I saw I worked with that supported range stepping, and it didn't even a distinction between range vs no-range step commands. The way to do a single step was to pass both addresses the same. I find it a better design than requiring the target do one current-address check _before_ stepping, and another _after_ single-stepping. -- Pedro Alves