From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19555 invoked by alias); 28 Jun 2005 14:19:39 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 19486 invoked by uid 22791); 28 Jun 2005 14:19:26 -0000 Received: from smtp108.mail.sc5.yahoo.com (HELO smtp108.mail.sc5.yahoo.com) (66.163.170.6) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Tue, 28 Jun 2005 14:19:26 +0000 Received: (qmail 45453 invoked from network); 28 Jun 2005 14:19:24 -0000 Received: from unknown (HELO ?192.168.3.100?) (jcphillips@216.54.38.110 with plain) by smtp108.mail.sc5.yahoo.com with SMTP; 28 Jun 2005 14:19:24 -0000 Message-ID: <42C15C66.6070600@yahoo.com> Date: Tue, 28 Jun 2005 14:19:00 -0000 From: Chad Phillips User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 CC: gdb@sources.redhat.com Subject: Re: GDB requires software breakpoints? References: <42BC6F5D.1080506@yahoo.com> In-Reply-To: <42BC6F5D.1080506@yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-06/txt/msg00295.txt.bz2 I took the advice of having the software breakpoint requests actually set hardware breakpoints. However, the problem of gdb insisting on setting a software breakpoint at main has now been compounded by gdb issueing a continue command after the software breakpoint is successfully set. It is as if gdb thinks it must break at main before it can go on to do anything else. In the following session, the target has been stopped in main before gdb starts. Then gdb attaches to the target. A step command is then issued to gdb. The step occurs correctly, but at the end of the step, gdb sets a breakpoint at main and then issues a continue command. Any suggestions for getting around this? Thanks, Chad --------------- gdb remote transcript ------------------- (gdb) target remote localhost:1000 Remote debugging using localhost:1000 Sending packet: $Hc-1#09...Ack Packet received: Sending packet: $qC#b4...Ack Packet received: Sending packet: $qOffsets#4b...Ack Packet received: Sending packet: $?#3f...Ack Packet received: S05 Sending packet: $Hg0#df...Ack Packet received: Sending packet: $p40#d4...Ack Packet received: 00004396 Sending packet: $p0#a0...Ack Packet received: 00801D8C 0x00004396 in main () at main.c:160 160 asm("doze"); (gdb) s //step command Sending packet: $p1#a1...Ack Packet received: 00C70000 Sending packet: $vCont?#49...Ack Packet received: Packet vCont (verbose-resume) is NOT supported Sending packet: $Hc0#db...Ack Packet received: Sending packet: $s#73...Ack Packet received: S05 Sending packet: $p40#d4...Ack Packet received: 0000438C Sending packet: $p0#a0...Ack Packet received: 00801D8C Sending packet: $p1#a1...Ack Packet received: 00C70000 Sending packet: $pf#d6...Ack Packet received: 0000438C Sending packet: $Z0,4188,2#e9...Ack //break at main? Packet received: OK Packet Z0 (software-breakpoint) is supported Sending packet: $c#63...Ack //and continue? Packet received: S05 Sending packet: $p40#d4...Ack Packet received: 00004396 //I caused a debug trap on the target here Program received signal SIGTRAP, Trace/breakpoint trap. Sending packet: $z0,4188,2#09...Ack Packet received: OK Sending packet: $p0#a0...Ack Packet received: 00801D8C 0x00004396 in main () at main.c:160 160 asm("doze"); (gdb) --------------- end gdb remote transcript ------------------- Chad Phillips wrote: > Context: > I'm rewriting MCORE support. > My remote MCORE target executes code from flash. > I've written a stub that resides on the same computer as GDB, talks to > GDB using the remote protocol, and manipulates the target using the > target's JTAG interface. As a result, only hardware breakpoints (2 of > them) are supported. > > A log is included below (created using 'set debug remote 1') with my > comments along the right side. > > Problem 1: > After attaching to the target which is stopped in main, I issue the step > command. The target correctly steps to the next source line. At the > end of the stepping process, GDB tries to set a breakpoint at main. > Using 'info break' replies "No breakpoints or watchpoints." > > First: How can I prevent it from trying to do this? > > Second: It attempt to set a software breakpoint, which is not supported > by the stub. Then it tries to write a software breakpoint (instruction > 0x0000) to memory at the start of main, which fails since the stub > cannot write to flash. Why is it doing this if the stub has already > indicated that software breakpoints are not supported? > > Problem 2: > After two more commanded steps, the target jumps into a function. > Issueing a 'finish' command tries to set another software breakpoint at > the correct return location. However, that fails because the return > location is in flash. How can I get GDB to use available hardware > breakpoints for this functionality and to stop trying to write to flash? > > Thanks, > Chad > > --------------------------------------------------------- > (gdb) s //Commanded step > Sending packet: $p1#a1...Ack > Packet received: 00C70000 > Sending packet: $vCont?#49...Ack > Packet received: > Packet vCont (verbose-resume) is NOT supported > Sending packet: $Hc0#db...Ack > Packet received: > Sending packet: $s#73...Ack //automatic steps... > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 0000439A > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 0000439C > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 0000439E > Sending packet: $p0#a0...Ack //finished stepping > Packet received: 00801D8C > Sending packet: $p1#a1...Ack > Packet received: 00C70000 > Sending packet: $pf#d6...Ack > Packet received: 0000438C > Sending packet: $Z0,4188,2#e9...Ack //break at main !?! > Packet received: > Packet Z0 (software-breakpoint) is NOT supported > Sending packet: $m4188,2#a0...Ack > Packet received: 6007 > Sending packet: $X4188,0:#c3...Ack > Packet received: > binary downloading NOT suppported by target > Sending packet: $M4188,2:0000#7a...Ack //break at main !?! > Packet received: E00 > Warning: > Cannot insert breakpoint 0. > Error accessing memory address 0x4188: Input/Output error. > > (gdb) s > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043A0 > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043A2 > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043A4 > Sending packet: $p0#a0...Ack > Packet received: 00801D8C > Sending packet: $p1#a1...Ack > Packet received: 00C70000 > Sending packet: $pf#d6...Ack > Packet received: 0000438C > Sending packet: $m4188,2#a0...Ack //still breaking main? > Packet received: 6007 > Sending packet: $M4188,2:0000#7a...Ack > Packet received: E00 > Warning: > Cannot insert breakpoint 0. > Error accessing memory address 0x4188: Input/Output error. > > (gdb) s > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043A6 > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043A8 > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043AA > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043AC > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043AE > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043B0 > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043B2 > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043B4 > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 000043B6 > Sending packet: $s#73...Ack > Packet received: S05 > Sending packet: $p40#d4...Ack > Packet received: 00008CCC > Sending packet: $p0#a0...Ack //did not break main !?! > Packet received: 00801D8C > Sending packet: $p1#a1...Ack > Packet received: 00C70000 > Sending packet: $pf#d6...Ack > Packet received: 000043B8 > mQueueReadString () at mQueue.s:385 > 385 mQueue.s: No such file or directory. > in mQueue.s > Current language: auto; currently asm > > //now finish command tries to set break instruction at return addr > > (gdb) finish > Run till exit from #0 mQueueReadString () at mQueue.s:385 > Sending packet: $m43b8,2#cc...Ack > Packet received: 1227 > Sending packet: $M43b8,2:0000#a6...Ack > Packet received: E00 > Warning: > Cannot insert breakpoint 0. > Error accessing memory address 0x43b8: Input/Output error. > > (gdb) >