10 Examining Data
The usual way to examine data in your program is with the
p), or its synonym
evaluates and prints the value of an expression of the language your
program is written in (see Using gdb with Different Languages). It may also print the expression using a
Python-based pretty-printer (see Pretty Printing).
print /f expr
- expr is an expression (in the source language). By default the
value of expr is printed in a format appropriate to its data type;
you can choose a different format by specifying /f, where
f is a letter specifying the format; see Output Formats.
- If you omit expr, gdb displays the last value again (from the value history; see Value History). This allows you to conveniently inspect the same value in an alternative format.
A more low-level way of examining data is with the
It examines data in memory at a specified address and prints it in a
specified format. See Examining Memory.
If you are interested in information about types, or about how the
fields of a struct or a class are declared, use the
command rather than