From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8953 invoked by alias); 27 Aug 2014 07:50:12 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 8944 invoked by uid 89); 27 Aug 2014 07:50:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f171.google.com Received: from mail-pd0-f171.google.com (HELO mail-pd0-f171.google.com) (209.85.192.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 27 Aug 2014 07:50:11 +0000 Received: by mail-pd0-f171.google.com with SMTP id z10so24148390pdj.2 for ; Wed, 27 Aug 2014 00:50:09 -0700 (PDT) X-Received: by 10.70.7.1 with SMTP id f1mr31129056pda.22.1409125808848; Wed, 27 Aug 2014 00:50:08 -0700 (PDT) Received: from linux-jyl1.site ([123.151.195.1]) by mx.google.com with ESMTPSA id s8sm8512539pdj.54.2014.08.27.00.50.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Aug 2014 00:50:07 -0700 (PDT) Message-ID: <53FD8D31.9010507@gmail.com> Date: Wed, 27 Aug 2014 07:50:00 -0000 From: Peng Fan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Yao Qi CC: "gdb@sourceware.org" Subject: Re: GDB Remote debug: Why several "$Z0,address,length" msg when only set one breakpoint? References: <53FC2FC1.9080600@gmail.com> <87mwaqixh2.fsf@codesourcery.com> In-Reply-To: <87mwaqixh2.fsf@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00128.txt.bz2 On 08/27/2014 08:32 AM, Yao Qi wrote: > Peng Fan writes: > > It is a typical step-over-breakpoint process in GDB, > >> Sending packet: $m87809580,4#7a...Ack >> Packet received: f0452de9 >> Sending packet: $m87809580,4#7a...Ack >> Packet received: f0452de9 > > Looks like the program hits the breakpoint on 0x87809580, and 'c' > command is being executed. Before GDB resume the inferior, it will > execute the instruction in a single-step fashion on the address > where the breakpoint is set, because it isn't executed yet. Yeah. the program hits the breakpoint at 0x87809580. then 'c'. > > GDB read the instruction on address 0x87809580, decode it and know what > is the address of next instruction, > >> Sending packet: $Z0,87809584,4#c7...Ack >> Packet received: OK > > and insert the breakpoint on next instruction for software single step, > >> Sending packet: $Hc0#db...Ack >> Packet received: >> Sending packet: $c#63...Ack >> Packet received: T050f:84958087;0d:a41355bf; >> Sending packet: $z0,87809584,4#e7...Ack >> Packet received: OK >> Sending packet: $qTStatus#49...Ack > > resume the program, and it hits the breakpoint on 0x87809584. Then, > instruction on 0x8780950 is executed. > >> Packet received: >> Sending packet: $Z0,87800000,4#ad...Ack >> Packet received: OK >> Sending packet: $Z0,87809580,4#c3...Ack >> Packet received: OK > > Restore the breakpoint on 0x87809580. > >> Sending packet: $Hc0#db...Ack >> Packet received: >> Sending packet: $c#63...Ack > > Resume the inferior and keep waiting. Yeah. Detailed. Got it. Thanks. > >> >> Actually the breakpoint is at 0x87809580, but why first set breakpoint >> at 0x87809584 then remove it then set breakpoint at 0x87809580? >> > > My comments above answer your question. > >> Also the first time set a breakpoint then continue. >> (gdb) c >> Continuing. >> Sending packet: $qTStatus#49...Ack >> Packet received: >> Sending packet: $Z0,87800000,4#ad...Ack >> Packet received: OK >> Packet Z0 (software-breakpoint) is supported >> Sending packet: $Z0,87809580,4#c3...Ack >> Packet received: OK >> Sending packet: $vCont?#49...Ack >> Packet received: >> Packet vCont (verbose-resume) is NOT supported >> Sending packet: $Hc0#db...Ack >> Packet received: >> Sending packet: $c#63...Ack >> >> why two Z0 here? I only set break at 0x87809580, but gdb send a break >> set at 0x87800000 which is the beginning of the elf entry. > > What is the symbol on 0x87800000? GDB inserts some internal breakpoints > for some purpose, collecting interesting events, for example. > Actually, there is a pair of "$z0,87800000,4" and "$Z0,87800000,4" of each 'c' except the first time to executing 'c'. The first time 'c', there is only "$Z0,87800000,4" to set a breakpoint. 0x87800000 is the entry symbol address of u-boot elf of my platform. 1 2 u-boot: file format elf32-littlearm 3 4 5 Disassembly of section .text: 6 7 87800000 <__image_copy_start>: 8 87800000: 11 00 00 ea 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 9 87800010: 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 Regards, Peng.