Contents|Index|Previous|Next
Expressions

print and many other GDB commands accept an expression and compute its value. Any kind of constant, variable or operator defined by the programming language you are using is valid in an expression in GDB. This includes conditional expressions, function calls, casts and string constants. It unfortunately does not include symbols defined by preprocessor #define commands.

GDB supports array constants in expressions input by the user.

The syntax uses the following example's declaration.

For example, you can now use the command, print {1 2 3} to build up an array in memory that is memory allocated in the target program.

Casts are supported in all languages, not just in C, because it is so useful to cast a number into a pointer in order to examine a structure at that address in memory.

GDB supports the following operators, in addition to those common to programming languages.


Top|Contents|Index|Previous|Next