When GDB starts, it reads any arguments other than options as specifying an executable file and core file (or process ID). This is the same as if the arguments were specified by the `-se' and `-c' options respectively. (GDB reads the first argument that does not have an associated option flag as equivalent to the `-se' option followed by that argument; and the second argument that does not have an associated option flag, if any, as equivalent to the `-c' option followed by that argument.)
Many options have both long and short forms; both are shown in the following list. GDB also recognizes the long forms if you truncate them, so long as enough of the option is present to be unambiguous. (If you prefer, you can flag option arguments with `--' rather than `-', though we illustrate the more usual convention.)
-symbols file
-s file
-exec file
-e file
-se file
-core file
-c file
-c number
attach
command
(unless there is a file in core-dump format named number, in which
case `-c' specifies that file as a core dump to read).
-command file
-x file
-directory directory
-d directory
-m
-mapped
mmap
system call, you can use this option
to have GDB write the symbols from your
program into a reusable file in the current directory. If the program you are debugging is
called `/tmp/fred', the mapped symbol file is `./fred.syms'.
Future GDB debugging sessions notice the presence of this file,
and can quickly map in symbol information from it, rather than reading
the symbol table from the executable program.
The `.syms' file is specific to the host machine where GDB
is run. It holds an exact image of the internal GDB symbol
table. It cannot be shared across multiple host platforms.
-r
-readnow
The -mapped
and -readnow
options are typically combined in
order to build a `.syms' file that contains complete symbol
information. (See section Commands to specify files, for information
a `.syms' file for future use is:
gdb -batch -nx -mapped -readnow programname
Go to the first, previous, next, last section, table of contents.