1" Debugger commands. 2" 3" WORK IN PROGRESS - much doesn't work yet 4" 5" Open two terminal windows: 6" 1. run a pty, as with ":term NONE" 7" 2. run gdb, passing the pty 8" The current window is used to edit source code and follows gdb. 9" 10" Author: Bram Moolenaar 11" Copyright: Vim license applies 12 13command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>) 14 15if !exists('debugger') 16 let debugger = 'gdb' 17endif 18 19func s:StartDebug(cmd) 20 " Open a terminal window without a job, to run the debugged program 21 let s:ptybuf = term_start('NONE', {}) 22 let pty = job_info(term_getjob(s:ptybuf))['tty'] 23 24 " Open a terminal window to run the debugger. 25 let cmd = [g:debugger, '-tty', pty, a:cmd] 26 echomsg 'executing "' . join(cmd) . '"' 27 let gdbbuf = term_start(cmd, { 28 \ 'exit_cb': function('s:EndDebug'), 29 \ 'term_finish': 'close' 30 \ }) 31endfunc 32 33func s:EndDebug(job, status) 34 exe 'bwipe! ' . s:ptybuf 35endfunc 36