Next: Tags
Up: Compiling, debugging, and tags
Previous: Compilation
The GNU debugger, GDB, is an interactive source-level
debugger for C and several other languages. It can be run under
Emacs, which provides a few rather nifty additional features.
Full on-line documentation of gdb is available using the C-h i
command in Emacs.
The command M-x gdb will prompt for an executable file name, and
then run GDB on that file, displaying the interaction in a
buffer that acts much like a shell buffer described previously.
Within that buffer, however, several commands have a slightly
different meaning.
In addition, whenever GDB displays the current position in the program
(for example, after a step, at a breakpoint, or after an interrupt),
Emacs will try to display the indicated source file and line in
another window, with an arrow (`=>') pointing at the
corresponding line in the source text (this arrow is not actually in
the file being displayed).
The following commands are peculiar to GDB buffers.
- C-c C-n
- performs a GDB `next' command (step to next
line in the source program).
- C-c C-s
- performs a GDB `step' command (step to next line
in the source program to be executed, stopping at the
beginning of any procedure that gets called.)
- C-c C-i
- performs a GDB `stepi' command (step to next
machine-language instruction--not usually used unless you are
programming in assembly language.
- C-c <
- performs a GDB `up' command (go up to procedure
that called current one).
- C-c >
- performs a GDB `down' command (opposite of `up').
- C-c C-r
- performs a GDB `finish' command (continues from
last breakpoint).
- C-c C-b
- set a breakpoint at the current position in the
program (as indicated by the position of the `=>' arrow).
- C-c C-d
- delete a breakpoint (if any) at the current position in
the program (as indicated by the position of the `=>' arrow).
In addition, within any source file buffer, there is the following command.
- C-x SPC
- puts a break point at the point in the program
indicated by the cursor.
Next: Tags
Up: Compiling, debugging, and tags
Previous: Compilation
David Wolfe
1998-12-15