Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
symbol-file [ filename ] 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.
symbol-file with no argument clears out GDB
information on the symbol table of your program.
The symbol-file command causes GDB to forget
the contents of its convenience variables, the value
history, and all breakpoints and auto-display
expressions. This is because they may contain
pointers to the internal data recording symbols
and data types, which are part of the old symbol
table data being discarded inside GDB.
symbol-file does not repeat if you press RET again
after executing it once. 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.
For most kinds of object files, the symbol-file
command does not normally read the symbol table
in full right away. Instead, it scans the symbol
table quickly to find which source files and which
symbols are present. The details are read later,
one source file at a time, as they are needed.
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 set verbose command
can turn these pauses into messages if desired.
See “Optional warnings and messages
(page 286).)
symbol-file filename [
-readnow ] [ -mapped ], file
You can override the GDB two-stage strategy for
reading symbol tables by using the `-readnow'
option with any of the commands that load symbol
filename [ -readnow ] [
-mapped ]
table information, if you want to be sure GDB has
the entire symbol table available.
If memory-mapped files are available on your
system through the mmap system call, you can use
12.1 Commands to specify files 119