From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17506 invoked by alias); 27 Aug 2014 00:36:17 -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 17492 invoked by uid 89); 27 Aug 2014 00:36:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Aug 2014 00:36:14 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1XMRDf-0007YE-72 from Yao_Qi@mentor.com ; Tue, 26 Aug 2014 17:36:11 -0700 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 26 Aug 2014 17:36:11 -0700 Received: from GreenOnly (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Tue, 26 Aug 2014 17:36:10 -0700 From: Yao Qi To: Peng Fan 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> Date: Wed, 27 Aug 2014 00:36:00 -0000 In-Reply-To: <53FC2FC1.9080600@gmail.com> (Peng Fan's message of "Tue, 26 Aug 2014 14:57:05 +0800") Message-ID: <87mwaqixh2.fsf@codesourcery.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00125.txt.bz2 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. 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:=20 > 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:=20 > 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:=20 > Sending packet: $c#63...Ack Resume the inferior and keep waiting. > > 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:=20 > 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:=20 > Packet vCont (verbose-resume) is NOT supported > Sending packet: $Hc0#db...Ack > Packet received:=20 > 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. --=20 Yao (=E9=BD=90=E5=B0=A7)