Prism 6.0 User's Guide

Examining the Contents of Memory and Registers

You can issue commands in the command window to display the contents of memory addresses and registers.

Displaying Memory

To display the contents of an address, specify the address on the command line, followed by a slash (/). For example,

0x10000/

If you specify the address as a period, Prism displays the contents of the memory address following the one printed most recently.

Specify a symbolic address by preceding the name with an &. For example,

&x/

prints the contents of memory for variable x. The Prism output, for example, might be

0x000237f8:  0x3f800000

The address you specify can be an expression made up of other addresses and the operators +, -, and indirection (unary *). For example,

0x1000+100/

prints the contents of the location 100 addresses above address 0x1000.

After the slash you can specify how memory is to be displayed. Formats that are supported are listed in Table 4-1.

Table 4-1 Memory Address Formats

Format 

Description 

d

Print a short word in decimal 

D

Print a long word in decimal 

o

Print a short word in octal 

O

Print a long word in octal 

x

Print a short word in hexadecimal 

X

Print a long word in hexadecimal 

b

Print a byte in octal 

c

Print a byte as a character 

s

Print a string of characters terminated by a null byte 

f

Print a single-precision real number 

F

Print a double-precision real number 

i

Print the machine instruction 

The initial format is X. If you omit the format in your command, you get either X (if you haven't previously specified a format) or the format you specified previously.

You can print the contents of multiple addresses by specifying a number after the slash (and before the format). For example,

0x1000/8X

displays the contents of eight memory locations starting at address 0x1000. Contents are displayed as hexadecimal long words.

Displaying the Contents of Registers

You can examine the contents of registers in the same way that you examine the contents of memory. Specify a register by preceding its name with a dollar sign. For example,

$f0/

prints the contents of the X register.

Specify a number after the slash to print the contents of multiple registers. For example,

$f0/3

prints the contents of registers f0, f1, and f2. The order in which the registers are displayed is that shown in Table 4-1.

You can also specify a format, as described above. The format specifier controls the display of the output; it doesn't affect how much of the register contents is displayed. Thus,

$f0/3X

displays three registers; the output is displayed as hexadecimal longwords.

The registers in the UltraSPARC processor are listed in Table 4-2.

Table 4-2 UltraSPARC Registers

Name 

Register 

$g0-$g7

Global registers (64 bits) 

$o0-$o7

Output registers (64 bits) 

$l0-$l7

Local registers 

$i0-$i7

Input registers 

$psr

Processor state register 

$pc

Program counter 

$npc

Next program counter 

$y

Y register 

$wim

Window invalid mask 

$tbr

Trap base register 

$f0-$f31

Floating-point registers 

$fsr

Floating status register (64 bits) 

$f0f1-$f62f63

Floating-point registers 

$xg0-$xg7

Upper 32 bits of $g0-$g7 (SPARC V8 plus only, or higher)

$xo0-$xo7

Upper 32 bits of $o0-$o7 (SPARC V8 plus only, or higher)

$xfsr

Upper 32 bits of $fsr (SPARC V8 plus only, or higher)

$fprs

Floating-point registers state (SPARC V8 plus only, or higher) 

$tstate

Trap state register (SPARC V8 plus only, or higher) 

$fp

Frame pointer (synonym for $i6)

$sp

Stack pointer (synonym for $o6)