Examining Data
Motorola
GNU Debugger (GDB)
For More Information On This Product,
Go to: www.freescale.com
D-43
info convenience
Print a list of convenience variables used so far, and their values. Abbreviated ‘i con’.
One of the ways to use a convenience variable is as a counter to be incremented or a
pointer to be advanced. For example:
set $i = 0
print bar[$i++]->contents
...repeat that command by typing RET.
Some convenience variables are created automatically by GDB and given values likely to
be useful. See Table D-21.
D.9.9 Registers
Machine register contents can be referred to in expressions as variables with names
starting with ‘$’. The names of registers are different for each machine; use ‘info registers’
to see the names used on your machine. The names $pc and $sp are used on all machines
for the program counter register and the stack pointer. Often $fp is used for a register that
contains a pointer to the current stack frame, and $ps is used for a register that contains the
processor status. These standard register names may be available on your machine even
though the info registers command displays them with a different name. For example, on
the SPARC, info registers displays the processor status register as $psr but you can also
refer to it as $ps.
GDB always considers the contents of an ordinary register as an integer when the register
is examined in this way. Some machines have special registers which can hold nothing but
floating point; these registers are considered floating point. There is no way to refer to the
contents of an ordinary register as floating point value (although you can print it as a
floating point value with ‘print/f $regname’).
Some registers have distinct “raw” and “virtual” data formats. This means that the data
format in which the register contents are saved by the operating system is not the same one
that your program normally sees. For example, the registers of the 68881 floating point
coprocessor are always saved in “extended” format, but all C programs expect to work
Table D-21. Convenience Variables
Convenience
Variable
Description
$_
The variable $_ is automatically set by the ‘x’ command to the last address examined (see
section Memory). Other commands which provide a default address for ‘x’ to examine also set
$_ to that address; these commands include ‘info line’ and ‘info breakpoint’.
$__
The variable $__ is automatically set by the ‘x’ command to the value found in the last address
examined.
F
Freescale Semiconductor, Inc.
n
.