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

Table Of Contents
2.1.1 Choosing files
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.)
If GDB has not been configured to included core file support, such as for most embedded
targets, then it will complain about a second argument and ignore it.
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 Read symbol table from file file.
-exec file
-e file Use file file as the executable file to execute when
appropriate, and for examining pure data in conjunction
with a core dump.
-se file Read symbol table from file file and use it as the
executable file.
-core file
-c file Use file file as a core dump to examine.
-c number Connect to process ID number, as with the 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 Execute GDB commands from file file. See “Command
files” (page 291).
-directory directory
-d directory Add directory to the path to search for source files.
-m, -mapped Warning: this option depends on operating system
facilities that are not supported on all systems.
If memory-mapped files are available on your system
through the 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
24 Getting In and Out of GDB