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. finds it in your program's symbol table, in the file indicated when you started (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 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 would ordinarily parse a typical file name, like `foo.c', as the three words `foo' `.' `c'. To allow 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
info symbol addr
() info symbol 0x54320 _initialize_vx + 396 in section .textThis is the opposite of the
info address
command. You can use
it to find out the name of a variable or a function given its address.
whatis expr
whatis
$
, the last value in the value history.
ptype typename
ptype expr
ptype
ptype
differs from whatis
by printing a detailed description, instead
of just the name of the type.
For example, for this variable declaration:
struct complex {double real; double imag;} v;the two commands give this output:
() whatis v type = struct complex () 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 scope addr
() info scope command_line_handler Scope for command_line_handler: Symbol rl is an argument at stack/frame offset 8, length 4. Symbol linebuffer is in static storage at address 0x150a18, length 4. Symbol linelength is in static storage at address 0x150a1c, length 4. Symbol p is a local variable in register $esi, length 4. Symbol p1 is a local variable in register $ebx, length 4. Symbol nline is a local variable in register $edx, length 4. Symbol repeat is a local variable at frame offset -8, length 4.This command is especially useful for determining what data to collect during a trace experiment, see section Tracepoint Action Lists.
info source
info sources
info functions
info functions regexp
step
; `info fun ^step' finds those whose names
start with step
.
info variables
info variables regexp
set symbol-reloading on
set symbol-reloading off
symbol-reloading
off, since otherwise
may discard symbols when linking large programs, that may contain
several modules (from different directories or libraries) with the same
name.
show symbol-reloading
on
or off
setting.
set opaque-type-resolution on
struct
, class
, or
union
---for example, struct MyType *
---that is used in one
source file although the full declaration of struct MyType
is in
another source file. The default is on.
A change in the setting of this subcommand will not take effect until
the next time symbols for a file are loaded.
set opaque-type-resolution off
{<no data fields>}
show opaque-type-resolution
maint print symbols filename
maint print psymbols filename
maint print msymbols filename
info sources
to find out which files these are. If you
use `maint print psymbols' instead, the dump shows information about
symbols that only knows partially--that is, symbols defined in
files that has skimmed, but not yet read completely. Finally,
`maint print msymbols' dumps just the minimal symbol information
required for each object file from which has read some symbols.
See section Commands to specify files, for a discussion of how
reads symbols (in the description of symbol-file
).
Go to the first, previous, next, last section, table of contents.