This chapter discusses how to start the debugger and how to get out of it. The essentials are:
type the command erc-coff-gdb to start the ERC32 debugger.
type quit or Ctrl-d to exit.
Invoke the debugger by entering the command m1750-coff-gdb or erc-coff-gdb as appropriate. Once started, the debugger reads commands from the terminal until you tell it to exit.
You can also run the debugger with a variety of arguments and options, to specify more of your debugging environment at the outset.
The most usual way to start the debugger is with one argument, specifying an executable program:
$ erc-coff-gdb program
You can run the debugger without printing the front material, which describes warranty, by specifying -silent:
$ m1750-coff-gdb -silent
You can further control how the debugger starts up by using command-line options. The debugger itself can remind you of the options available.
$ m1750-coff-gdb -help
to display all available options and briefly describe their use (m1750-coff-gdb -h is a shorter equivalent).
All options and command line arguments you give are processed in sequential order. The order makes a difference when the -x option is used.
When the debugger starts, it reads any argument other than options as specifying an executable file. This is the same as if the argument was specified by the -se option.
Many options have both long and short forms; both are shown in the following list. The debugger 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.)
Read symbol table from file file.
Use file file as the executable file to execute when appropriate.
Read symbol table from file file and use it as the executable file.
Execute debug commands from file file. See Section 21.3.
Add directory to the path to search for source files.
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 can run the debugger in various alternative modes — for example, in batch mode or quiet mode.
Do not execute commands from any initialization files (normally called .gdbinit). Normally, the commands in these files are executed after all the command options and arguments have been processed. See Section 21.3.
Do not print the introductory and copyright messages. These messages are also suppressed in batch mode.
Run in batch mode. Exit with status 0 after processing all the command files specified with -x (and all commands from initialization files, if not inhibited with -n). Exit with nonzero status if an error occurs in executing the debug commands in the command files.
Batch mode may be useful for running the debugger as a filter, for example to download and run a program on another computer; in order to make this more useful, the message
Program exited normally.
(which is ordinarily issued whenever a program running under the debugger control terminates) is not issued when running in batch mode.
Run the debugger using directory as its working directory, instead of the current directory.
GNU Emacs sets this option when it runs the debugger as a subprocess. It tells the debugger to output the full file name and line number in a standard, recognizable fashion each time a stack frame is displayed (which includes each time your program stops). This recognizable format looks like two \032 characters, followed by the file name, line number and character position separated by colons, and a newline. The Emacs-to-gdb interface program uses the two \032 characters as a signal to display the source code for the frame.
Set the line speed (baud rate or bits per second) of any serial interface used by the debugger for remote debugging.
Run using device for your program's standard input and output.