Debugging with GDB (September 2007)
14 Debugging with GDB
-cd directory
Run GDB using directory as its working directory, instead of the current direc-
tory.
-dbx Support additional dbx commands, including:
• use
• status (in dbx mode, status has a different meaning than in default GDB
mode.)
• whereis
• func
• file
• assign
• call
• stop
-fullname
-f gnu Emacs sets this option when it runs GDB as a subprocess. It tells GDB 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, followe d 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.
-epoch The Epoch Emacs-GDB interface sets this option when it runs GDB as a sub-
process. It tells GDB to modify its print routines so as to allow Epoch to
display values of expressions in a separate window.
-annotate level
This option sets the annotation level inside GDB. Its effect is identical to using
‘set annotate level’ (see Chapter 20 [Annotations], page 257). Annotation
level controls how much information does GDB print together with its prompt,
values of express ions, source lines, and other type s of output. Level 0 is the
normal, level 1 is for use when GDB is run as a subprocess of gnu Emacs, level
2 is the maximum annotation suitable for programs that control GDB.
-async Use the asynchronous event loop for the command-line interface. GDB pro-
cesses all events, such as user keyb oard input, via a special event loop. This
allows GDB to accept and process user commands in parallel with the debugged
process being run
1
, so you don’t need to wait for control to return to GDB be -
fore you type the next command. (Note: as of version 5.0, the target side of
the asynchronous operation is not yet in place, so ‘-async’ does not work fully
yet.)
When the standard input is connected to a terminal device, GDB uses the
asynchronous event loop by default, unless disabled by the ‘-noasync’ option.
1
GDB built with djgpp tools for MS-DOS/MS-Windows supports this mode of operation, but the event
lo op is suspended when the debug target runs.