GNU Info

Info Node: (gdb.info)File Options

(gdb.info)File Options


Next: Mode Options Up: Invoking GDB
Enter node , (file) or (file)node

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' (or
`-p' 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'/`-p'
option followed by that argument.)  If the second argument begins with
a decimal digit, GDB will first attempt to attach to it as a process,
and if that fails, attempt to open it as a corefile.  If you have a
corefile whose name begins with a digit, you can prevent GDB from
treating it as a pid by prefixing it with `./', eg. `./12345'.

   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'

`-pid NUMBER'
`-p NUMBER'
     Connect to process ID NUMBER, as with the `attach' command.  If
     there is no such process, GDB will attempt to open a core file
     named NUMBER.

`-command FILE'
`-x FILE'
     Execute GDB commands from file FILE.  Note: Command files.


`-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 you are debugging is called
     `/tmp/fred', the mapped symbol file is `/tmp/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'
     Read each symbol file's entire symbol table immediately, rather
     than the default, which is to read it incrementally as it is
     needed.  This makes startup slower, but makes future operations
     faster.

   You typically combine the `-mapped' and `-readnow' options in order
to build a `.syms' file that contains complete symbol information.
(Note: Commands to specify files, for information on `.syms'
files.)  A simple GDB invocation to do nothing but build a `.syms' file
for future use is:

     gdb -batch -nx -mapped -readnow programname


automatically generated by info2www version 1.2.2.9