2 _dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc.
3 _dnl__ This file is part of the source for the GDB manual.
5 @node Symbols, Altering, Data, Top
6 @chapter Examining the Symbol Table
8 The commands described in this section allow you to inquire about the
9 symbols (names of variables, functions and types) defined in your
10 program. This information is inherent in the text of your program and
11 does not change as the program executes. _GDBN__ finds it in your
12 program's symbol table, in the file indicated when you started _GDBN__
13 (@pxref{File Options}), or by one of the file-management commands
17 @item info address @var{symbol}
19 Describe where the data for @var{symbol} is stored. For a register
20 variable, this says which register it is kept in. For a non-register
21 local variable, this prints the stack-frame offset at which the variable
24 Note the contrast with @samp{print &@var{symbol}}, which does not work
25 at all for a register variables, and for a stack local variable prints
26 the exact address of the current instantiation of the variable.
28 @item whatis @var{exp}
30 Print the data type of expression @var{exp}. @var{exp} is not
31 actually evaluated, and any side-effecting operations (such as
32 assignments or function calls) inside it do not take place.
36 Print the data type of @code{$}, the last value in the value history.
38 @item ptype @var{typename}
40 Print a description of data type @var{typename}. @var{typename} may be
41 the name of a type, or for C code it may have the form
42 @samp{struct @var{struct-tag}}, @samp{union @var{union-tag}} or
43 @samp{enum @var{enum-tag}}.@refill
46 Print a description of the type of expression @var{exp}. @code{ptype}
47 differs from @code{whatis} by printing a detailed description, instead of just
48 the name of the type. For example, if your program declares a variable
51 struct complex {double real; double imag;} v;
54 compare the output of the two commands:
59 type = struct complex {
65 @item info types @var{regexp}
68 Print a brief description of all types whose name matches @var{regexp}
69 (or all types in your program, if you supply no argument). Each
70 complete typename is matched as though it were a complete line; thus,
71 @samp{i type value} gives information on all types in your program whose
72 name includes the string @code{value}, but @samp{i type ^value$} gives
73 information only on types whose complete name is @code{value}.
75 This command differs from @code{ptype} in two ways: first, like
76 @code{whatis}, it does not print a detailed description; second, it
77 lists all source files where a type is defined.
81 Show the name of the current source file---that is, the source file for
82 the function containing the current point of execution.
86 Print the names of all source files in the program for which there is
87 debugging information, organized into two lists: those for which symbols
88 have been read in, and those for which symbols will be read in on
90 @c FIXME: above passive AND awkward!
93 @kindex info functions
94 Print the names and data types of all defined functions.
96 @item info functions @var{regexp}
97 Print the names and data types of all defined functions
98 whose names contain a match for regular expression @var{regexp}.
99 Thus, @samp{info fun step} finds all functions whose names
100 include @code{step}; @samp{info fun ^step} finds those whose names
101 start with @code{step}.
104 @kindex info variables
105 Print the names and data types of all variables that are declared
106 outside of functions (i.e., excluding local variables).
108 @item info variables @var{regexp}
109 Print the names and data types of all variables (except for local
110 variables) whose names contain a match for regular expression
115 This was never implemented.
117 @itemx info methods @var{regexp}
119 The @code{info methods} command permits the user to examine all defined
120 methods within C++ program, or (with the @var{regexp} argument) a
121 specific set of methods found in the various C++ classes. Many
122 C++ classes provide a large number of methods. Thus, the output
123 from the @code{ptype} command can be overwhelming and hard to use. The
124 @code{info-methods} command filters the methods, printing only those
125 which match the regular-expression @var{regexp}.
128 @item printsyms @var{filename}
130 Write a complete dump of the debugger's symbol data into the