Next: GUD Customization, Previous: Debugger Operation, Up: Debuggers
GUD provides commands for setting and clearing breakpoints, selecting stack frames, and stepping through the program.
C-x C-a C-b (gud-break
), when called in a source
buffer, sets a debugger breakpoint on the current source line. This
command is available only after starting GUD. If you call it in a
buffer that is not associated with any debugger subprocess, it signals
a error.
The following commands are available both in the GUD interaction buffer and globally, but with different key bindings. The keys starting with C-c are available only in the GUD interaction buffer, while those starting with C-x C-a are available globally. Some of these commands are also available via the tool bar; some are not supported by certain debuggers.
gud-refresh
).
gud-step
). If the line
contains a function call, execution stops after entering the called
function.
gud-next
).
gud-stepi
).
gud-print
). If Emacs
does not print the exact expression that you want, mark it as a region
first.
gud-cont
).
gud-remove
). If you use this command in the GUD interaction
buffer, it applies to the line where the program last stopped.
gud-tbreak
). If you use this command in the GUD interaction
buffer, it applies to the line where the program last stopped.
gud-up
). This is
equivalent to the GDB command ‘up’.
gud-down
). This is
equivalent to the GDB command ‘down’.
gud-until
). The
program will run until it hits a breakpoint, terminates, gets a signal
that the debugger is checking for, or reaches the line on which the
cursor currently sits.
gud-finish
).
If you are using GDB, these additional key bindings are available:
gud-jump
transfers the
program's execution point to the current line. In other words, the
next line that the program executes will be the one where you gave the
command. If the new execution line is in a different function from
the previously one, GDB prompts for confirmation since the results may
be bizarre. See the GDB manual entry regarding jump
for
details.
gud-gdb-complete-command
).
This key is available only in the GUD interaction buffer.
These commands interpret a numeric argument as a repeat count, when that makes sense.
Because <TAB> serves as a completion command, you can't use it to enter a tab as input to the program you are debugging with GDB. Instead, type C-q <TAB> to enter a tab.