Specifying GDB’s Files
Motorola
GNU Debugger (GDB)
For More Information On This Product,
Go to: www.freescale.com
D-11
Table D-1. GDB File Commands
Command
Description
exec-file filename
Specify that the program to be run is found in filename. If you do not specify a
directory and the file is not found in GDB’s working directory, GDB will use the
environment variable PATH as a list of directories to search, just as the shell
does when looking for a program to run.
symbol-file filename
Read symbol table information from file filename. PATH is searched when
necessary. Most of the time you will use both the ‘exec-file’ and ‘symbol-file’
commands on the same file.
‘symbol-file’ with no argument clears out GDB’s symbol table.
The ‘symbol-file’ command does not actually 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,
when 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 messages telling you that
the symbol table details for a particular source file are being read. (The ‘set
verbose’ command controls whether these messages are printed; see section
User Interface).
However, you will sometimes see in backtraces lines for functions in source
files whose data has not been read in; these lines omit some of the information,
such as argument values, which cannot be printed without full details of the
symbol table.
When the symbol table is stored in COFF format, ‘symbol-file’ does read the
symbol table data in full right away. We haven’t bothered to implement the
two-stage strategy for COFF.
core-file filename
Specify the whereabouts of a core dump file to be used as the “contents of
memory”. Note that the core dump contains only the writable parts of memory;
the read-only parts must come from the executable file.
‘core-file’ with no argument specifies that no core file is to be used.
Note that the core file is ignored when your program is actually running under
GDB. So, if you have been running the program and you wish to debug a core
file instead, you must kill the sub-process in which the program is running. To
do this, use the ‘kill’ command (see section Kill Process).
add-file filename address
The ‘a(chǎn)dd-file’ command reads additional symbol table
information from the file filename. You would use this when that file has been
dynamically loaded 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.
The symbol table of the file filename is added to the symbol table originally
read with the ‘symbol-file’ command. You can use the ‘a(chǎn)dd-file’ command any
number of times; the new symbol data thus read keeps adding to the old. The
‘symbol-file’ command forgets all the symbol data GDB has read; that is the
only time symbol data is forgotten in GDB.
F
Freescale Semiconductor, Inc.
n
.