Catch up Cygnus-logo version of GDB refcard with last few changes to
[deliverable/binutils-gdb.git] / gdb / doc / gdb.files-m4
CommitLineData
9bcc06ef
RP
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.
16e58d91 4@c M4 FRAGMENT: $Id$
9bcc06ef
RP
5@node _GDBN__ Files, Targets, Altering, Top
6@chapter _GDBN__'s Files
7
8@menu
9* Files:: Commands to Specify Files
10* Symbol Errors:: Errors Reading Symbol Files
11@end menu
12
13@node Files, Symbol Errors, _GDBN__ Files, _GDBN__ Files
14@section Commands to Specify Files
15@cindex core dump file
16@cindex symbol table
17_GDBN__ needs to know the file name of the program to be debugged, both in
18order to read its symbol table and in order to start the program. To
19debug a core dump of a previous run, _GDBN__ must be told the file name of
20the core dump.
21
22The usual way to specify the executable and core dump file names is with
23the command arguments given when you start _GDBN__, as discussed in
24@pxref{Invocation}.
25
26Occasionally it is necessary to change to a different file during a
27_GDBN__ session. Or you may run _GDBN__ and forget to specify the files you
28want to use. In these situations the _GDBN__ commands to specify new files
29are useful.
30
31@table @code
32@item file @var{filename}
33@cindex executable file
34@kindex file
35Use @var{filename} as the program to be debugged. It is read for its
36symbols and for the contents of pure memory. It is also the program
37executed when you use the @code{run} command. If you do not specify a
38directory and the file is not found in _GDBN__'s working directory,
39
40_GDBN__ uses the environment variable @code{PATH} as a list of
41directories to search, just as the shell does when looking for a program
42to run. You can change the value of this variable, for both _GDBN__ and
43your program, using the @code{path} command.
44
45@code{file} with no argument makes _GDBN__ discard any information it
46has on both executable file and the symbol table.
47
48@item exec-file @var{filename}
49@kindex exec-file
50Specify that the program to be run (but not the symbol table) is found
51in @var{filename}. _GDBN__ will search the environment variable @code{PATH}
52if necessary to locate the program.
53
54@item symbol-file @var{filename}
55@kindex symbol-file
56Read symbol table information from file @var{filename}. @code{PATH} is
57searched when necessary. Use the @code{file} command to get both symbol
58table and program to run from the same file.
59
60@code{symbol-file} with no argument clears out _GDBN__'s information on your
61program's symbol table.
62
63The @code{symbol-file} command causes _GDBN__ to forget the contents of its
64convenience variables, the value history, and all breakpoints and
65auto-display expressions. This is because they may contain pointers to
66the internal data recording symbols and data types, which are part of
67the old symbol table data being discarded inside _GDBN__.
68
69@code{symbol-file} will not repeat if you press @key{RET} again after
70executing it once.
71
72On some kinds of object files, the @code{symbol-file} command does not
73actually read the symbol table in full right away. Instead, it scans
74the symbol table quickly to find which source files and which symbols
75are present. The details are read later, one source file at a time,
76when they are needed.
77
78The purpose of this two-stage reading strategy is to make _GDBN__ start up
79faster. For the most part, it is invisible except for occasional pauses
80while the symbol table details for a particular source file are being
81read. (The @code{set verbose} command can turn these pauses into
82messages if desired. @xref{Messages/Warnings}).
83
84When the symbol table is stored in COFF format, @code{symbol-file} does
85read the symbol table data in full right away. We haven't implemented
86the two-stage strategy for COFF yet.
87
88When _GDBN__ is configured for a particular environment, it will
89understand debugging information in whatever format is the standard
90generated for that environment; you may use either a GNU compiler, or
91other compilers that adhere to the local conventions. Best results are
92usually obtained from GNU compilers; for example, using @code{_GCC__}
93you can generate debugging information for optimized code.
94
95@item core-file @var{filename}
96@itemx core @var{filename}
97@kindex core
98@kindex core-file
99Specify the whereabouts of a core dump file to be used as the ``contents
100of memory''. Traditionally, core files contain only some parts of the
101address space of the process that generated them; _GDBN__ can access the
102executable file itself for other parts.
103
104@code{core-file} with no argument specifies that no core file is
105to be used.
106
107Note that the core file is ignored when your program is actually running
108under _GDBN__. So, if you have been running the program and you wish to
109debug a core file instead, you must kill the subprocess in which the
110program is running. To do this, use the @code{kill} command
111(@pxref{Kill Process}).
112
113@item load @var{filename}
114@kindex load
115_if__(_GENERIC__)
116Depending on what remote debugging facilities are configured into
117_GDBN__, the @code{load} command may be available. Where it exists, it
118is meant to make @var{filename} (an executable) available for debugging
119on the remote system---by downloading, or dynamic linking, for example.
120@code{load} also records @var{filename}'s symbol table in _GDBN__, like
121the @code{add-symbol-file} command.
122
123If @code{load} is not available on your _GDBN__, attempting to execute
124it gets the error message ``@code{You can't do that when your target is
125@dots{}}''
126_fi__(_GENERIC__)
127
128_if__(_VXWORKS__)
129On VxWorks, @code{load} will dynamically link @var{filename} on the
130current target system as well as adding its symbols in _GDBN__.
131_fi__(_VXWORKS__)
132
133_if__(_I960__)
134@cindex download to Nindy-960
135With the Nindy interface to an Intel 960 board, @code{load} will
136download @var{filename} to the 960 as well as adding its symbols in
137_GDBN__.
138_fi__(_I960__)
139
140@code{load} will not repeat if you press @key{RET} again after using it.
141
142@item add-symbol-file @var{filename} @var{address}
143@kindex add-symbol-file
144@cindex dynamic linking
145The @code{add-symbol-file} command reads additional symbol table information
146from the file @var{filename}. You would use this command when that file
147has been dynamically loaded (by some other means) into the program that
148is running. @var{address} should be the memory address at which the
149file has been loaded; _GDBN__ cannot figure this out for itself.
150
151The symbol table of the file @var{filename} is added to the symbol table
152originally read with the @code{symbol-file} command. You can use the
153@code{add-symbol-file} command any number of times; the new symbol data thus
154read keeps adding to the old. To discard all old symbol data instead,
155use the @code{symbol-file} command.
156
157@code{add-symbol-file} will not repeat if you press @key{RET} after using it.
158
159@item info files
160@itemx info target
161@kindex info files
162@kindex info target
163@code{info files} and @code{info target} are synonymous; both print the
164current targets (@pxref{Targets}), including the names of the executable
165and core dump files currently in use by _GDBN__, and the files from
166which symbols were loaded. The command @code{help targets} lists all
167possible targets rather than current ones.
168
169@end table
170
171All file-specifying commands allow both absolute and relative file names
172as arguments. _GDBN__ always converts the file name to an absolute path
173name and remembers it that way.
174
175@kindex sharedlibrary
176@kindex share
177@cindex shared libraries
178
179_GDBN__ supports the SunOS shared library format. Symbols from a shared
180library cannot be referenced before the shared library has been linked
181with the program. (That is to say, until after you type @code{run} and
182the function @code{main} has been entered; or when examining core
183files.) Once the shared library has been linked in, you can use the
184following commands:
185
186@table @code
187@item sharedlibrary @var{regex}
188@itemx share @var{regex}
189Load shared object library symbols for files matching a UNIX regular
190expression.
191
192@item share
193@itemx sharedlibrary
194Load symbols for all shared libraries.
195
196@item info share
197@itemx info sharedlibrary
198@kindex info sharedlibrary
199@kindex info share
200Print the names of the shared libraries which you have loaded with the
201@code{sharedlibrary} command.
202@end table
203
204@code{sharedlibrary} does not repeat automatically when you press
205@key{RET} after using it once.
206
207@node Symbol Errors, , Files, _GDBN__ Files
208@section Errors Reading Symbol Files
209While a symbol file is being read, _GDBN__ will occasionally encounter
210problems, such as symbol types it does not recognize, or known bugs in
211compiler output. By default, it prints one message about each such
212type of problem, no matter how many times the problem occurs. You can
213ask it to print more messages, to see how many times the problems occur,
214or can shut the messages off entirely, with the @code{set
215complaints} command (@xref{Messages/Warnings}).
216
217The messages currently printed, and their meanings, are:
218
219@table @code
220@item inner block not inside outer block in @var{symbol}
221
222The symbol information shows where symbol scopes begin and end
223(such as at the start of a function or a block of statements). This
224error indicates that an inner scope block is not fully contained
225in its outer scope blocks.
226
227_GDBN__ circumvents the problem by treating the inner block as if it had
228the same scope as the outer block. In the error message, @var{symbol}
229may be shown as ``@code{(don't know)}'' if the outer block is not a
230function.
231
232@item block at @var{address} out of order
233
234The symbol information for symbol scope blocks should occur in
235order of increasing addresses. This error indicates that it does not
236do so.
237
238_GDBN__ does not circumvent this problem, and will have trouble locating
239symbols in the source file whose symbols being read. (You can often
240determine what source file is affected by specifying @code{set verbose
241on}. @xref{Messages/Warnings}.)
242
243@item bad block start address patched
244
245The symbol information for a symbol scope block has a start address
246smaller than the address of the preceding source line. This is known
247to occur in the SunOS 4.1.1 (and earlier) C compiler.
248
249_GDBN__ circumvents the problem by treating the symbol scope block as
250starting on the previous source line.
251
252@c @item{encountered DBX-style class variable debugging information.
253@c You seem to have compiled your program with "g++ -g0" instead of "g++ -g".
254@c Therefore _GDBN__ will not know about your class variables}
255@c
256@c This error indicates that the symbol information produced for a C++
257@c program includes zero-size fields, which indicated static fields in
258@c a previous release of the G++ compiler. This message is probably
259@c obsolete.
260@c
261@item bad string table offset in symbol @var{n}
262
263@cindex foo
264Symbol number @var{n} contains a pointer into the string table which is
265larger than the size of the string table.
266
267_GDBN__ circumvents the problem by considering the symbol to have the
268name @code{foo}, which may cause other problems if many symbols end up
269with this name.
270
271@item unknown symbol type @code{0x@var{nn}}
272
273The symbol information contains new data types that _GDBN__ does not yet
274know how to read. @code{0x@var{nn}} is the symbol type of the misunderstood
275information, in hexadecimal.
276
277_GDBN__ circumvents the error by ignoring this symbol information. This
278will usually allow the program to be debugged, though certain symbols
279will not be accessible. If you encounter such a problem and feel like
280debugging it, you can debug @code{_GDBP__} with itself, breakpoint on
281@code{complain}, then go up to the function @code{read_dbx_symtab} and
282examine @code{*bufp} to see the symbol.
283
284@item stub type has NULL name
285_GDBN__ could not find the full definition for a struct or class.
286
287@ignore
288@c this is #if 0'd in dbxread.c as of (at least!) 17 may 1991
289@item const/volatile indicator missing, got '@var{X}'
290
291The symbol information for a C++ member function is missing some
292information that the compiler should have output for it.
293@end ignore
294
295@item C++ type mismatch between compiler and debugger
296
297The debugger could not parse a type specification output by the compiler
298for some C++ object.
299
300@end table
This page took 0.087097 seconds and 4 git commands to generate.