[U-Boot-Users] gdb: Cannot insert breakpoint 'n'

Chris Hallinan clh at net1plus.com
Thu Feb 6 17:07:01 CET 2003

I have come across an issue in gdb that prevents me from using gdb
to step through flash-resident code.  gdb 5.0 appears to behave
correctly, but gdb 5.1 and above do not.  The issue is as follows:

I am using BDI-2000 w/ MPC8245 processor.  The bdi is configured to
use hardware breakpoints (required for setting breakpoint in
read-only memory.)  However, the 8245 only contains a single
hardware breakpoint register.

It appears that the later versions of gdb are attempting to set a
breakpoint at program start (reset vector).  The scenario is this:
connect to target, set arbitrary breakpoint in flash, then type
'cont' to begin execution from reset vector.

This results in the error "Cannot insert breakpoint 1" because the
hardware breakpoint resource was consumed when the user set the
breakpoint, and subsequently gdb tries to set it's own breakpoint at
the reset vector.  It fails, predictably, because gdb can't write
into read-only memory.  Here is the trace with remote debugging

Start of gdb session:
(gdb) target remote bdi:2001
(gdb) b bp1
Breakpoint 1 at 0xfff04eac: file
/home/chris/ppcboot-1.2.0/board/pdna/pdna_i2c.S, line 141.
(gdb) c
Sending packet: $Hc0#db...Ack
Packet received: OK
Sending packet: $S11#b5...Ack
Packet received: S05
Sending packet: $g#67...Ack
Packet received: <lots of bytes><snip> deadbeef
Sending packet: $mfffffffc,c#29...Ack
Packet received: ffffffff7ff77e6dfbe76b77
Sending packet: $Z0,fff00100,4#39...Ack
                ^^^^^^^^^^^^^^^^^^  <<<--- Errant breakpoint
Packet received: OK
Packet Z0 (software-breakpoint) is supported
Sending packet: $Z0,fff04eac,4#d5...Ack
                ^^^^^^^^^^^^^  <<<--- Breakpoint I requested
Packet received: E03
warning: Cannot insert breakpoint 1:
Error accessing memory address 0xfff04eac: Unknown error 4294967295.
                       ^^^^^^^^^ Of course, gdb can't write into
Read-only memory!

Can anyone shed any light on this issue?

-Chris Hallinan
DS4.COM, Inc.

More information about the U-Boot mailing list