First cut.
[deliverable/binutils-gdb.git] / gdb / doc / gdb.symb-m4
1 _dnl__ -*- Texinfo -*-
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.
4 _dnl__ $Id$
5 @node Symbols, Altering, Data, Top
6 @chapter Examining the Symbol Table
7
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
14 (@pxref{Files}).
15
16 @table @code
17 @item info address @var{symbol}
18 @kindex info address
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
22 is always stored.
23
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.
27
28 @item whatis @var{exp}
29 @kindex whatis
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.
33 @xref{Expressions}.
34
35 @item whatis
36 Print the data type of @code{$}, the last value in the value history.
37
38 @item ptype @var{typename}
39 @kindex ptype
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
44
45 @item ptype @var{exp}
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
49 as
50 @example
51 struct complex {double real; double imag;} v;
52 @end example
53 @noindent
54 compare the output of the two commands:
55 @example
56 (_GDBP__) whatis v
57 type = struct complex
58 (_GDBP__) ptype v
59 type = struct complex {
60 double real;
61 double imag;
62 }
63 @end example
64
65 @item info types @var{regexp}
66 @itemx info types
67 @kindex info types
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}.
74
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.
78
79 @item info source
80 @kindex info source
81 Show the name of the current source file---that is, the source file for
82 the function containing the current point of execution.
83
84 @item info sources
85 @kindex info sources
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
89 demand.
90 @c FIXME: above passive AND awkward!
91
92 @item info functions
93 @kindex info functions
94 Print the names and data types of all defined functions.
95
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}.
102
103 @item info variables
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).
107
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
111 @var{regexp}.
112
113
114 @ignore
115 This was never implemented.
116 @item info methods
117 @itemx info methods @var{regexp}
118 @kindex info methods
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}.
126 @end ignore
127
128 @item printsyms @var{filename}
129 @kindex printsyms
130 Write a complete dump of the debugger's symbol data into the
131 file @var{filename}.
132 @end table
This page took 0.033604 seconds and 4 git commands to generate.