Next: GUD Customization, Previous: Debugger Operation, Up: Debuggers
The GUD interaction buffer uses a variant of Shell mode, so the commands of Shell mode are available (see Shell Mode). GUD mode also provides commands for setting and clearing breakpoints, for selecting stack frames, and for stepping through the program. These commands are available both in the GUD buffer and globally, but with different key bindings. It also has its own tool bar from which you can invoke the more common commands by clicking on the appropriate icon. This is particularly useful for repetitive commands like gud-next and gud-step and allows the user to hide the GUD buffer.
The breakpoint commands are normally used in source file buffers, because that is the easiest way to specify where to set or clear the breakpoint. Here's the global command to set a breakpoint:
Here are the other special commands provided by GUD. The keys starting with C-c are available only in the GUD interaction buffer. The key bindings that start with C-x C-a are available in the GUD interaction buffer and also in source files.
gud-refresh
.
gud-step
). If the line contains
a function call, execution stops after entering the called function.
gud-next
).
gud-stepi
).
gud-cont
).
gud-remove
). If you use this command in the GUD interaction
buffer, it applies to the line where the program last stopped.
The above commands are common to all supported debuggers. If you are using GDB or (some versions of) DBX, these additional commands are available:
gud-up
). This is
equivalent to the ‘up’ command.
gud-down
). This is
equivalent to the ‘down’ command.
If you are using GDB, these additional key bindings are available:
gud-run
).
gud-until
).
gud-gdb-complete-command
).
This key is available only in the GUD interaction buffer, and requires
GDB versions 4.13 and later.
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.
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.