GNU Emacs Manual. Node: Commands of GUD

PREVDebugger Operation UPDebuggers NEXTGUD Customization

21.5.3: Commands of GUD

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.

The breakpoint commands are usually used in source file buffers, because that is the way to specify where to set or clear the breakpoint. Here's the global command to set a breakpoint:

C-x SPC

Set a breakpoint on the source line that point is on.

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.


C-x C-a C-l
C-x C-a C-s
C-x C-a C-n
C-x C-a C-i
C-x C-a C-r
C-x C-a C-d
C-x C-a C-t
C-c C-l

Display in another window the last line referred to in the GUD buffer (that is, the line indicated in the last location message). This runs the command gud-refresh.

C-c C-s

Execute a single line of code (gud-step). If the line contains a function call, execution stops after entering the called function.

C-c C-n

Execute a single line of code, stepping across entire function calls at full speed (gud-next).

C-c C-i

Execute a single machine instruction (gud-stepi).

C-c C-r

Continue execution without specifying any stopping point. The program will run until it hits a breakpoint, terminates, or gets a signal that the debugger is checking for (gud-cont).

C-c C-d

Delete the breakpoint(s) on the current source line, if any (gud-remove). If you use this command in the GUD interaction buffer, it applies to the line where the program last stopped.

C-c C-t

Set a temporary breakpoint on the current source line, if any. 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:


C-x C-a <
C-x C-a >
C-c <

Select the next enclosing stack frame (gud-up). This is equivalent to the `up' command.

C-c >

Select the next inner stack frame (gud-down). This is equivalent to the `down' command.

If you are using GDB, these additional key bindings are available:


C-x C-a C-f
TAB

With GDB, complete a symbol name (gud-gdb-complete-command). This key is available only in the GUD interaction buffer, and requires GDB versions 4.13 and later.

C-c C-f

Run the program until the selected stack frame returns (or until it stops for some other reason).

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.

PREVDebugger Operation UPDebuggers NEXTGUD Customization