gdb: File Options

 
 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' (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 './', e.g. './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.
 
 '-pid NUMBER'
 '-p NUMBER'
      Connect to process ID NUMBER, as with the 'attach' command.
 
 '-command FILE'
 '-x FILE'
      Execute commands from file FILE.  The contents of this file is
      evaluated exactly as the 'source' command would.  SeeCommand
      files Command Files.
 
 '-eval-command COMMAND'
 '-ex COMMAND'
      Execute a single GDB command.
 
      This option may be used multiple times to call multiple commands.
      It may also be interleaved with '-command' as required.
 
           gdb -ex 'target sim' -ex 'load' \
              -x setbreakpoints -ex 'run' a.out
 
 '-init-command FILE'
 '-ix FILE'
      Execute commands from file FILE before loading the inferior (but
      after loading gdbinit files).  SeeStartup.
 
 '-init-eval-command COMMAND'
 '-iex COMMAND'
      Execute a single GDB command before loading the inferior (but after
      loading gdbinit files).  SeeStartup.
 
 '-directory DIRECTORY'
 '-d DIRECTORY'
      Add DIRECTORY to the path to search for source and script files.
 
 '-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.
 
 '--readnever'
      Do not read each symbol file's symbolic debug information.  This
      makes startup faster but at the expense of not being able to
      perform symbolic debugging.  DWARF unwind information is also not
      read, meaning backtraces may become incomplete or inaccurate.  One
      use of this is when a user simply wants to do the following
      sequence: attach, dump core, detach.  Loading the debugging
      information in this case is an unnecessary cause of delay.