Go to the previous, next section.
The commands described in this section allow you to inquire about the symbols (names of variables, functions and types) defined in your program. This information is inherent in the text of your program and does not change as your program executes. _GDBN__ finds it in your program's symbol table, in the file indicated when you started _GDBN__ (see section Choosing Files), or by one of the file-management commands (see section Commands to Specify Files).
Occasionally, you may need to refer to symbols that contain unusual characters, which _GDBN__ ordinarily treats as word delimiters. The most frequent case is in referring to static variables in other source files (see section Program Variables). File names are recorded in object files as debugging symbols, but _GDBN__ would ordinarily parse a typical file name, like `foo.c', as the three words `foo' `.' `c'. To allow _GDBN__ to recognize `foo.c' as a single symbol, enclose it in single quotes; for example,
p 'foo.c'::x
looks up the value of x
in the scope of the file `foo.c'.
info address symbol
Note the contrast with `print &symbol', which does not work at all for a register variables, and for a stack local variable prints the exact address of the current instantiation of the variable.
whatis exp
whatis
$
, the last value in the value history.
ptype typename
ptype exp
ptype
ptype
differs from whatis
by printing a detailed description, instead
of just the name of the type. For example, if your program declares a
variable as
struct complex {double real; double imag;2 v;
compare the output of the two commands:
(_GDBP__) whatis v type = struct complex (_GDBP__) ptype v type = struct complex { double real; double imag; }
As with whatis
, using ptype
without an argument refers to
the type of $
, the last value in the value history.
info types regexp
info types
value
, but `i type ^value$' gives
information only on types whose complete name is value
.
This command differs from ptype
in two ways: first, like
whatis
, it does not print a detailed description; second, it
lists all source files where a type is defined.
info source
info sources
info functions
info functions regexp
step
; `info fun ^step' finds those whose names
start with step
.
info variables