OpenBoot 2.x Command Reference Manual

Breakpoints

The User Interface provides a breakpoint capability to assist in the development and debugging of stand-alone programs. (Programs that run under the operating system generally do not use this feature, but use other debuggers designed to run under the operating system.) The breakpoint feature lets you stop the test program at desired points. After program execution has stopped, registers or memory can be inspected or changed, and new breakpoints can be set or cleared. You can resume program execution with the go command.

Table 6-3 lists the breakpoint commands that control and monitor program execution.

Table 6-3 Breakpoint Commands

Command  

Stack Diagram 

Description 

+bp

( addr -- ) 

Add a breakpoint at the specified address. 

-bp

( addr -- ) 

Remove the breakpoint at the specified address. 

--bp

( -- )  

Remove the most-recently-set breakpoint. 

.bp

( -- ) 

Display all currently set breakpoints. 

.breakpoint

( -- ) 

Perform a specified action when a breakpoint occurs. This word can be altered to perform any desired action. For example, to display registers at every breakpoint, type: ['] .registers is .breakpoint. The default behavior is .instruction. To perform multiple behaviors, create a single definition which calls all desired behaviors, then load that word into .breakpoint.

.instruction

( -- ) 

Display the address, opcode for the last-encountered breakpoint.  

.step

( -- ) 

Perform a specified action when a single step occurs (see .breakpoint).

bpoff

( -- ) 

Remove all breakpoints. 

finish-loop

( -- ) 

Execute until the end of this loop. 

go

( -- ) 

Continue from a breakpoint. This can be used to go to an arbitrary address by setting up the processor's program counter before issuing go.

gos

( n -- ) 

Execute go n times.

hop

( -- ) 

(Like the step command.) Treat a subroutine call as a single instruction.

hops

( n -- ) 

Execute hop n times.

return

( -- ) 

Execute until the end of this subroutine. 

returnL

( -- )  

Execute until the end of this leaf subroutine. 

skip

( -- ) 

Skip (do not execute) the current instruction. 

step

( -- ) 

Single-step one instruction. 

steps

( n -- ) 

Execute step n times.

till

( addr -- ) 

Execute until the given address is encountered. Equivalent to +bp go.

To debug a program using breakpoints, use the following procedure.

  1. Load the test program into memory at location 4000 (hex).

    See Chapter 5, Loading and Executing Programs for more information. Using dload is generally best, since the symbol table for the program is preserved. boot -h also works if the program is not available over Ethernet.

    The values for %pc and all other registers are initialized automatically.

  2. (Optional) Disassemble the downloaded program to verify a properly-loaded file.

  3. Begin single-stepping the test program using the step command.

You can also set a breakpoint, then execute (for example, using the commands 4020 +bp and go) or perform other variations.