[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
8. Examining Data
The usual way to examine data in your program is with the print
command (abbreviated p
), or its synonym inspect
. It
evaluates and prints the value of an expression of the language your
program is written in (see section Using No value for GDBN with Different Languages).
-
print expr
-
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.
-
print
-
print /f
-
If you omit expr, No value for GDBN displays the last value again (from the value history; see section 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 x
command.
It examines data in memory at a specified address and prints it in a
specified format. See section 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 ptype exp
command rather than print
. See section Examining the Symbol Table.
8.1 Expressions | ||
8.2 Program Variables | Program variables | |
8.3 Artificial Arrays | Artificial arrays | |
8.4 Output Formats | Output formats | |
8.5 Examining Memory | Examining memory | |
8.6 Automatic Display | Automatic display | |
8.7 Print Settings | Print settings | |
8.8 Value History | Value history | |
8.9 Convenience Variables | Convenience variables | |
8.10 Registers | ||
8.11 Floating Point Hardware | Floating point hardware | |
8.12 Vector Unit | ||
8.13 Operating System Auxiliary Information | Auxiliary data provided by operating system | |
8.14 Memory Region Attributes | Memory region attributes | |
8.15 Copy Between Memory and a File | Copy between memory and a file | |
8.16 How to Produce a Core File from Your Program | Cause a program dump its core | |
8.17 Character Sets | Debugging programs that use a different character set than GDB does | |
8.18 Caching Data of Remote Targets | Data caching for remote targets |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |