f78
Commands to specify files
Occasionally it is necessary to change to a different file during a GDB
session. Or you may run GDB and forget to specify a file you want to use. In these
situations the GDB commands to specify new files are useful.
On systems with memory-mapped files, an auxiliary file,
When GDB is configured for a particular environment, it understands debugging
information in whatever format is the standard generated for that environment;
you may use either a GNU compiler, or other compilers that adhere to the local conventions. Best
results are usually obtained from GNU compilers; for example, using
On some kinds of object files, the
The purpose of this two-stage reading strategy is to make GDB start up faster.
For the most part, it is invisible except for occasional pauses while the
symbol table details for a particular source file are being read. (The
We have not implemented the two-stage strategy for COFF yet. When the symbol
table is stored in COFF format,
file filename[-readnow][-mapped]
If memory-mapped files are available on your system through the mmap system
call, you can use another option, ‘
Using the ‘
You can use both options together, to make sure the auxiliary symbol file has
all the symbol information for your program. The auxiliary symbol file for a
program called
The ‘
Note:
If your GDB does not have a
The file is loaded at whatever address is specified in the executable. For
some object file formats, you can specify the load address when you link the
program; for other formats, like a.out, the object file format speci
ffb
fies a fixed
address.
On VxWorks,
With the Nindy interface to an Intel 960 board,
When you select remote debugging to a Hitachi SH, H8/300, or H8/500 board (see
The symbol table of the file,
You can use the ‘
All file-specifying commands allow both absolute and relative file names as
arguments. GDB always converts the file name to an absolute file name and
remembers it that way.
GDB supports SunOS, SVr4, Irix 5, and IBM RS/6000 shared libraries. GDB
automatically loads symbol definitions from shared libraries when you use the
info sharedlibrary
Use filename as the program to be debugged. It is read for its symbols and for the
contents of pure memory. It is also the program executed when you use the run command. If you do not specify a directory and the file is not found in the
GDB working directory, GDB uses the environment variable, PATH, as a list of directories to search, just as the shell does when looking for
a program to run. You can change the value of this variable, for both GDB and
your program, using the path command.
file with no argument makes GDB discard any information it has on both executable
file and the symbol table.
Specify that the program to be run (but not the symbol table) is found in filename. GDB searches the environment variable, PATH, if necessary to locate your program. Omitting filen
ffb
ame means to discard information on the executable file.
Read symbol table information from file, filename. PATH is searched when necessary. Use the file command to get both symbol table and program to run from the same file.
Specify the whereabouts of a core dump file to be used as the “contents of
memory”. Traditionally, core files contain only some parts of the address space of
the process that generated them; GDB can access the executable file itself for
other parts.
The core file is ignored when your program is actually running under GDB. So,
if you have been running your program and you wish to debug a core file
instead, you must kill the subprocess in which the program is running. To do this, use
the kill command (see
Depending on what remote debugging facilities are configured into GDB, the load command may be available. Where it exists, it is meant to make filename (an executable) available for debugging on the remote system—by downloading,
or dynamic linking, for example. load also records the filename symbol table in GDB, like the add-symbol-file command.
The add-symbol-file command reads additional symbol table information from the file, filename. You would use this command when filename has been dynamically loaded (by some other means) into the program that is
running. address should be the memory address at which the file has been loaded; GDB cannot
figure this out for itself. You can specify address as an expression.
The add-shared-symbol-file command can be used only under Harris’ CXUX operating system for the Motorola
88k. GDB automatically looks for shared libraries, however if GDB does not
find yours, you can run add-shared-symbol-file. It takes no arguments.
The section command changes the base address of section, SECTION, of the exec file to ADDR. This can be used if the exec file does not contain section addresses (such
as in the a.out format), or when the addresses specified in the file itself are wrong. Each
section must be changed separately. The info files command lists all the sections and their addresses.
info files and info target are synonymous; both print the current target (see Specifying a Debugging Target), including the names of the executable and core dump files currently in use
by GDB, and the files from which symbols were loaded. The help target command lists all possible targets rather than current ones.
Print the names of the shared libraries which are currently loaded.
Load shared object library symbols for files matching a Unix regular
expression. As with files loaded automatically, it only loads shared libraries required
by your program for a core file or after using run
f6
FONT>. If regex is omitted, all shared libraries required by your program are loaded.