Neovim for Beginners — Terminal Debugger
This article is part of the Neovim for Beginners series.
The Neovim configuration files can be found in this repository.
The terminal debugging plugin (
:h terminal-debug) can be used to debug a program with
gdb and view the source code in a Vim window. This is completely contained inside Vim and also works remotely over an ssh connection.
This plugin needs to be loaded explicitly using the following command.
Alternatively, we can load the plugin when we start Neovim.
Depending on the operating system, the GNU debugger can be installed easily.
For macOS, if you encounter the following error, refer to this link to give
gdb permission to control other processes.
Starting program: /x/y/foo
Unable to find Mach task port for process-id 28885: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
Additionally, to prevent
gdb from using a shell to start the program to be debugged, we can use the following command for this inside
set startup-with-shell off
We can also put this command in a file called .gdbinit in the home directory, in which case it will be applied automatically every time we start
rust-gdb is a wrapper that loads external Python pretty-printing scripts into
gdb. It is a prebuilt binary that comes with the Rust installation.