manpagez: man pages & more
info gdb
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.1 Expressions

print and many other No value for GDBN 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 No value for GDBN. This includes conditional expressions, function calls, casts, and string constants. It also includes preprocessor macros, if you compiled your program to include this information; see Compiling for Debugging.

No value for GDBN supports array constants in expressions input by the user. The syntax is {element, element…}. For example, you can use the command print {1, 2, 3} to build up an array in memory that is malloced in the target program.

Because C is so widespread, most of the expressions shown in examples in this manual are in C. See section Using No value for GDBN with Different Languages, for information on how to use expressions in other languages.

In this section, we discuss operators that you can use in No value for GDBN expressions regardless of your programming language.

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.

No value for GDBN supports these operators, in addition to those common to programming languages:

@

@’ is a binary operator for treating parts of memory as arrays. See section Artificial Arrays, for more information.

::

::’ allows you to specify a variable in terms of the file or function where it is defined. See section Program Variables.

{type} addr

Refers to an object of type type stored at address addr in memory. addr may be any expression whose value is an integer or pointer (but parentheses are required around binary operators, just as in a cast). This construct is allowed regardless of what kind of data is normally supposed to reside at addr.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.