HP (Hewlett-Packard) 5992-4701 Computer Hardware User Manual


 
10 Examining the Symbol Table
The commands described in this chapter 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. GDB finds
it in your program's symbol table, in the file indicated when you started GDB (see
“Choosing files” (page 26)), or by one of the file-management commands (see
“Commands to specify files” (page 125)).
Occasionally, you may need to refer to symbols that contain unusual characters, which
GDB ordinarily treats as word delimiters. The most frequent case is in referring to static
variables in other source files (see “Program variables” (page 84)). File names are
recorded in object files as debugging symbols, but GDB would ordinarily parse a typical
file name, like 'foo.c', as the three words 'foo' '.' 'c'. To allow GDB 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 Describe where the data for symbol is stored.
For a register variable, this says which register
it is kept in. For a non-register local variable, this
prints the stack-frame offset at which the variable
is always stored.
Note the contrast with 'print &symbol', which
does not work at all for a register variable, and
for a stack local variable prints the exact address
of the current instantiation of the variable.
whatis expr Print the data type of expression expr. expr is
not actually evaluated, and any side-effecting
operations (such as assignments or function calls)
inside it do not take place. See “Expressions”
(page 83).
whatis Print the data type of $, the last value in the value
history.
ptype typename Print a description of data type typename.
typename may be the name of a type, or for C
code it may have the form 'class class-name',
'struct struct-tag', 'union union-tag'
or 'enum enum-tag'.
ptype expr, ptype
Print a description of the type of expression
expr. ptype differs from whatis by printing a
115