public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* GDB requires software breakpoints?
@ 2005-06-24 20:40 Chad Phillips
  2005-06-25  4:32 ` Daniel Jacobowitz
  2005-06-28 14:19 ` Chad Phillips
  0 siblings, 2 replies; 4+ messages in thread
From: Chad Phillips @ 2005-06-24 20:40 UTC (permalink / raw)
  To: gdb

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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GDB requires software breakpoints?
  2005-06-24 20:40 GDB requires software breakpoints? Chad Phillips
@ 2005-06-25  4:32 ` Daniel Jacobowitz
  2005-06-28 14:19 ` Chad Phillips
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-06-25  4:32 UTC (permalink / raw)
  To: Chad Phillips; +Cc: gdb

On Fri, Jun 24, 2005 at 04:38:53PM -0400, Chad Phillips wrote:
> 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?

It doesn't in general.  Main is special, if you don't have a
recognizable dynamic loader.

> 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?

Try just making the software breakpoint request set a hardware
breakpoint.


-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GDB requires software breakpoints?
  2005-06-24 20:40 GDB requires software breakpoints? Chad Phillips
  2005-06-25  4:32 ` Daniel Jacobowitz
@ 2005-06-28 14:19 ` Chad Phillips
  2005-06-28 14:23   ` Daniel Jacobowitz
  1 sibling, 1 reply; 4+ messages in thread
From: Chad Phillips @ 2005-06-28 14:19 UTC (permalink / raw)
  Cc: gdb

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)
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GDB requires software breakpoints?
  2005-06-28 14:19 ` Chad Phillips
@ 2005-06-28 14:23   ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-06-28 14:23 UTC (permalink / raw)
  To: Chad Phillips; +Cc: gdb

On Tue, Jun 28, 2005 at 10:19:18AM -0400, Chad Phillips wrote:
> 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?

Not without more information; if you're going to continue working on a
GDB port, you really need to get used to debugging GDB.  Figure out why
GDB is issuing a continue command instead of another step.  Don't worry
about the breakpoint at main; it's not actually relevant.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-06-28 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-24 20:40 GDB requires software breakpoints? Chad Phillips
2005-06-25  4:32 ` Daniel Jacobowitz
2005-06-28 14:19 ` Chad Phillips
2005-06-28 14:23   ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).