Chapter 8. Getting In and Out of the Debugger

Table of Contents
8.1. Invoking the Debugger
8.2. Quitting the Debugger
8.3. Shell Commands

This chapter discusses how to start the debugger and how to get out of it. The essentials are:

8.1. Invoking the Debugger

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.

Type

$ 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.

8.1.1. Choosing Files

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.)

-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.

-se file

Read symbol table from file file and use it as the executable file.

-command file, -x file

Execute debug commands from file file. See Section 21.3.

-directory directory, -d directory

Add directory to the path to search for source 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.

8.1.2. Choosing Modes

You can run the debugger in various alternative modes — for example, in batch mode or quiet mode.

-nx, -n

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.

-quiet, -q

Do not print the introductory and copyright messages. These messages are also suppressed in batch mode.

-batch

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.

-cd directory

Run the debugger using directory as its working directory, instead of the current directory.

-fullname, -f

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.

-b bps

Set the line speed (baud rate or bits per second) of any serial interface used by the debugger for remote debugging.

-tty device

Run using device for your program's standard input and output.