Home Explore Blog CI



neovim

6th chunk of `runtime/doc/terminal.txt`
4067171d687bbecd97334603ef798f0c65ce5bc79a4eecc60000000100000fa0
 *:Break*	set a breakpoint at the cursor position
 :Break {position}
		set a breakpoint at the specified position
 *:Tbreak*	set a temporary breakpoint at the cursor position
 :Tbreak {position}
		set a temporary breakpoint at the specified position
 *:Clear*	delete the breakpoint at the cursor position

 *:Step*	execute the gdb "step" command
 *:Over*	execute the gdb "next" command (`:Next` is a Vim command)
 *:Until*	execute the gdb "until" command
 *:Finish*	execute the gdb "finish" command
 *:Continue*	execute the gdb "continue" command
 *:Stop*	interrupt the program

If gdb stops at a source line and there is no window currently showing the
source code, a new window will be created for the source code.  This also
happens if the buffer in the source code window has been modified and can't be
abandoned.

Gdb gives each breakpoint a number.  In Vim the number shows up in the sign
column, with a red background.  You can use these gdb commands:
- info break	list breakpoints
- delete N	delete breakpoint N
You can also use the `:Clear` command if the cursor is in the line with the
breakpoint, or use the "Clear breakpoint" right-click menu entry.


Inspecting variables ~
					*termdebug-variables* *:Evaluate*
 `:Evaluate`	    evaluate the expression under the cursor
 `K`		    same (see |termdebug_map_K| to disable)
 `:Evaluate` {expr}   evaluate {expr}
 `:'<,'>Evaluate`     evaluate the Visually selected text

This is similar to using "print" in the gdb window.
You can usually shorten `:Evaluate` to `:Ev`.
The result is displayed in a floating window.
You can move the cursor to this window by running `:Evaluate` (or `K`) again.


Navigating stack frames ~
				*termdebug-frames* *:Frame* *:Up* *:Down*
 `:Frame` [frame]	select frame [frame], which is a frame number,
			address, or function name (default: current frame)
 `:Up` [count]		go up [count] frames (default: 1; the frame that
			called the current)
 `+`			same (see |termdebug_map_plus| to disable)
 `:Down` [count]	go down [count] frames (default: 1; the frame called
			by the current)
 `-`			same (see |termdebug_map_minus| to disable)


Other commands ~
							*termdebug-commands*
 *:Gdb*	     jump to the gdb window
 *:Program*    jump to the window with the running program
 *:Source*     jump to the window with the source code, create it if there
	     isn't one
 *:Asm*	     jump to the window with the disassembly, create it if there
	     isn't one
 *:Var*	     jump to the window with the local and argument variables,
	     create it if there isn't one. This window updates whenever the
	     program is stopped

Events ~
							*termdebug-events*
Four autocommands can be used: >vim
	au User TermdebugStartPre  echomsg 'debugging starting'
	au User TermdebugStartPost echomsg 'debugging started'
	au User TermdebugStopPre   echomsg 'debugging stopping'
	au User TermdebugStopPost  echomsg 'debugging stopped'
<
						*TermdebugStartPre*
TermdebugStartPre		Before starting debugging.
				Not triggered if the debugger is already
				running or the debugger command cannot be
				executed.
						*TermdebugStartPost*
TermdebugStartPost		After debugging has initialized.
				If a "!" bang is passed to `:Termdebug` or
				`:TermdebugCommand` the event is triggered
				before running the provided command in gdb.
						*TermdebugStopPre*
TermdebugStopPre		Before debugging ends, when gdb is terminated,
				most likely after issuing a "quit" command in
				the gdb window.
						*TermdebugStopPost*
TermdebugStopPost		After debugging has ended, gdb-related windows
				are closed, debug buffers wiped out and
				the state before the debugging was restored.


Customizing ~
				*termdebug-customizing* *g:termdebug_config*
In the past several global variables were used for configuration.  These are
deprecated and using the g:termdebug_config dictionary is preferred.  When
g:termdebug_config exists the other global variables will NOT be used.
The recommended way is to start with an empty dictionary:

Title: Termdebug Commands, Variable Inspection, Stack Navigation, and Customization
Summary
This section details several Termdebug commands for setting breakpoints, stepping through code, and controlling program execution. It also covers inspecting variables using `:Evaluate` and navigating stack frames with `:Frame`, `:Up`, and `:Down`. Additionally, it lists commands for jumping to different windows like `:Gdb`, `:Program`, `:Source`, `:Asm`, and `:Var`. It explains the Termdebug autocommands and the preferred method for customizing Termdebug using the `g:termdebug_config` dictionary, deprecating older global variables.