NeoDebug - GDB Vim Frontend
Intro
NeoDebug is a gdb frontend plugin for Vim, asynchronously run gdb and pipe communication.
It both works on MS Windows and Linux.
It opens a DebugConsole window in vim that allows user to type gdb command directly, and gdb output is redirected to this windows.
Screenshot:
- Gdb command directly input and show result.
- Vim Style complete.
- BallonShow.
- Breakpoints jump, threads, stack
- info locals, breakpoints, threads, bt, registers
Installation
-
You need install sed (and of course gdb).
-
Use your preferred installation method for Vim plugins.
With vim-plug that would mean to add the following to your vimrc:
Plug 'cpiger/NeoDebug'
=========================================================
My dev environment:
- Windows:
- tdm-gcc-5.1.0-3.exe
- sed (https://raw.githubusercontent.com/mbuilov/sed-windows/master/sed-4.4-x64.exe) (This Sed do not creates un-deleteable files in Windows.)
- Vim 8.0 Included patches: 1-1532 (https://tuxproject.de/projects/vim/)
- Linux:
- Gdb 7.12.1-48.fc25
- Vim vim-X11-8.0.1171-1.fc25.x86_64
=========================================================
Quick usage
In vim or gvim, run :NeoDebug command, e.g. See Screenshot.
:NeoDebug "start gdb and open a gdb console buffer in vim
:DBGOpenConsole "open neodebug console window
:DBGCloseConsole "close neodebug console window
:DBGToggleConsole "toggle neodebug console window
:DBGOpenLocals "open [info locals] window
:DBGOpenRegisters "open [info registers] window
:DBGOpenStacks "open [backtrace] window
:DBGOpenThreads "open [info threads] window
:DBGOpenBreaks "open [info breakpoints] window
:DBGOpenDisas "open [disassemble] window
:DBGOpenExpressions "open [Exressions] window
:DBGOpenWatchs "open [info watchpoints] window
:DBGCloseLocals "close [info locals] window
:DBGCloseRegisters "close [info registers] window
:DBGCloseStacks "close [backtrace] window
:DBGCloseThreads "close [info threads] window
:DBGCloseBreaks "close [info breakpoints] window
:DBGCloseDisas "close [disassemble] window
:DBGCloseExpressions "close [Exressions] window
:DBGCloseWatchs "close [info watchpoints] window
The following shortcuts is applied that is similar to MSVC:
<F5> - run or continue
<S-F5> - stop debugging (kill)
<F6> - toggle console window
<F10> - next
<F11> - step into
<S-F11> - step out (finish)
<C-F10> - run to cursor (tb and c)
<F9> - toggle breakpoint on current line
<C-S-F10> - set next statement (tb and jump)
<C-P> - view variable under the cursor
<TAB> - trigger complete
Options:
let g:neodbg_debugger = 'gdb' " gdb,pdb,lldb
let g:neodbg_gdb_path = '/usr/bin/gdb' " gdb path
let g:neodbg_cmd_prefix = 'DBG' " default command prefix
let g:neodbg_console_height = 15 " gdb console buffer hight, Default: 15
let g:neodbg_openbreaks_default = 1 " Open breakpoints window, Default: 1
let g:neodbg_openstacks_default = 0 " Open stackframes window, Default: 0
let g:neodbg_openthreads_default = 0 " Open threads window, Default: 0
let g:neodbg_openlocals_default = 1 " Open locals window, Default: 1
let g:neodbg_openregisters_default = 0 " Open registers window, Default: 0
Keymaps:
let g:neodbg_keymap_toggle_breakpoint = '<F9>' " toggle breakpoint on current line
let g:neodbg_keymap_next = '<F10>' " next
let g:neodbg_keymap_run_to_cursor = '<C-F10>' " run to cursor (tb and c)
let g:neodbg_keymap_jump = '<C-S-F10>' " set next statement (tb and jump)
let g:neodbg_keymap_step_into = '<F11>' " step into
let g:neodbg_keymap_step_out = '<S-F11>' " setp out
let g:neodbg_keymap_continue = '<F5>' " run or continue
let g:neodbg_keymap_print_variable = '<C-P>' " view variable under the cursor
let g:neodbg_keymap_stop_debugging = '<S-F5>' " stop debugging (kill)
let g:neodbg_keymap_toggle_console_win = '<F6>' " toggle console window
let g:neodbg_keymap_terminate_debugger = '<C-C>' " terminate debugger
FAQ
Q: Where to get my program's Input and Output ?
A: You can use 'tty' command to redirected program's input and output on linux. A similar command under Windows is set new-console, that is default on NeoDebug. (GDB OnLine Docs)
TODO
-
Breakpoints disable/enable
-
vim swap file notification
-
source file changed notification and update breakpoints
-
Options add: info windows group customized.
Thanks
skyshore2001
(https://github.com/skyshore2001/vgdb-vim)
Bram Moolenaar
(vim80\pack\dist\opt\termdebug\plugin\termdebug.vim)