
Examining Data
Motorola
GNU Debugger (GDB)
For More Information On This Product,
Go to: www.freescale.com
D-39
If either the manner of printing or the size of unit fails to be specified, the default is to use
the same one that was used last. If you don’t want to use any letters after the slash, you can
omit the slash as well.
You can also omit the address to examine. Then the address used is just after the last unit
examined. This is why string and instruction formats actually compute a unit size based on
the data: so that the next string or instruction examined will start in the right place. The
‘print’ command sometimes sets the default address for the ‘x’ command; when the value
printed resides in memory, the default is set to examine the same location. ‘info line’ also
sets the default for ‘x’, to the address of the start of the machine code for the specified line
and ‘info breakpoints’ sets it to the address of the last breakpoint listed.
When you use RET to repeat an ‘x’ command, it does not repeat exactly the same: the
address specified previously (if any) is ignored, so that the repeated command examines
the successive locations in memory rather than the same ones.
You can examine several consecutive units of memory with one command by writing a
repeat-count after the slash (before the format letters, if any). The repeat count must be a
decimal integer. It has the same effect as repeating the ‘x’ command that many times
except that the output may be more compact with several units per line. For example,
x/10i $pc
prints ten instructions starting with the one to be executed next in the selected frame. After
doing this, you could print another ten following instructions with
x/10
in which the format and address are allowed to default.
‘a(chǎn)’
Print as an address, both absolute in hex and then relative to a symbol defined as an address
below it.
‘c’
Print as character constants.
‘f’
Print as floating point. This works only with sizes ‘w’ and ‘g’.
‘s’
Print a null-terminated string of characters. The specified unit size is ignored; instead, the unit is
however many bytes it takes to reach a null character (including the null character).
‘i’
Print a machine instruction in assembler syntax (or nearly). The specified unit size is ignored;
the number of bytes in an instruction varies depending on the type of machine, the opcode and
the addressing modes used.
Table D-18. Print Output Format Letters (Continued)
Format Letter
Description
F
Freescale Semiconductor, Inc.
n
.