OpenBoot 2.x Command Reference Manual

Displaying Registers

You can enter the User Interface from the middle of an executing program as a result of a program crash, a user abort with Stop-A, or an encountered breakpoint. (Breakpoints are discussed on "Breakpoints".) In all these cases, the User Interface automatically saves all the CPU data register values in a buffer area. You can then inspect or alter these values for debugging purposes.

Table 6-2 lists the SPARC register commands.

Table 6-2 SPARC Register Commands

Command  

Stack Diagram 

Description 

%f0 through %f31

( -- value ) 

Return the value in the specified floating point register. 

%fsr

( -- value ) 

Return the value in the floating point status register. 

%g0 through %g7

( -- value ) 

Return the value in the specified global register. 

%i0 through %i7

( -- value ) 

Return the value in the specified input register. 

%l0 through %l7

( -- value ) 

Return the value in the specified local register. 

%o0 through %o7

( -- value ) 

Return the value in the specified output register. 

%pc %npc %psr %y %wim %tbr

( -- value ) 

Return the value in the specified register. 

.fregisters

( -- ) 

Display the values in %f0 through %f31.

.locals

( -- ) 

Display the values in the i, l and o registers.

.psr

( -- ) 

Formatted display of the program status register. 

.registers

( -- ) 

Display values in %g0 through %g7, plus %pc, %npc, %psr, %y, %wim, %tbr.

.window

( window# -- ) 

Same as w .locals; display the desired window.

ctrace

( -- ) 

Display the return stack showing C subroutines. 

set-pc

( new-value -- ) 

Set %pc to new-value, and set %npc to (new-value+4).

to regname

( new-value -- ) 

Change the value stored in any of the registers above. Use in the form: new-value to regname.

w

( window# -- ) 

Set the current window for displaying %ix, %Lx, or %ox.

After the values have been inspected and/or modified, program execution can be continued with the go command. The saved (and possibly modified) register values are copied back into the CPU, and execution resumes at the location specified by the saved program counter.

If you change %pc with to, you should also change %npc. (It is easier to use set-pc, which changes both registers automatically.)

For the w and .window commands, a window value of 0 usually specifies the current window--that is, the active window for the subroutine where the program was interrupted. A value of 1 specifies the window for the caller of this subroutine, 2 specifies the caller's caller, and so on, up to the number of active stack frames. The default starting value is 0.