diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2017-11-07 18:59:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-07 18:59:39 +0100 |
| commit | ae569ea57b1df1b450803b6d23ab8c315dd72e72 (patch) | |
| tree | 89cded2580f6e52dc9bb8b1394184b10c696547f /runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | |
| parent | 06fd32b8ffc437d596a2d82a986220add4315869 (diff) | |
| parent | 8c3377ee76e5cc4f5a4228f216bde1d03b496d69 (diff) | |
| download | rneovim-ae569ea57b1df1b450803b6d23ab8c315dd72e72.tar.gz rneovim-ae569ea57b1df1b450803b6d23ab8c315dd72e72.tar.bz2 rneovim-ae569ea57b1df1b450803b6d23ab8c315dd72e72.zip | |
Merge #7500 'vim-patch: runtime'
Diffstat (limited to 'runtime/pack/dist/opt/termdebug/plugin/termdebug.vim')
| -rw-r--r-- | runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim new file mode 100644 index 0000000000..97fadf695a --- /dev/null +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -0,0 +1,35 @@ +" Debugger commands. +" +" WORK IN PROGRESS - much doesn't work yet +" +" Open two terminal windows: +" 1. run a pty, as with ":term NONE" +" 2. run gdb, passing the pty +" The current window is used to edit source code and follows gdb. +" +" Author: Bram Moolenaar +" Copyright: Vim license applies + +command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>) + +if !exists('debugger') + let debugger = 'gdb' +endif + +func s:StartDebug(cmd) + " Open a terminal window without a job, to run the debugged program + let s:ptybuf = term_start('NONE', {}) + let pty = job_info(term_getjob(s:ptybuf))['tty'] + + " Open a terminal window to run the debugger. + let cmd = [g:debugger, '-tty', pty, a:cmd] + echomsg 'executing "' . join(cmd) . '"' + let gdbbuf = term_start(cmd, { + \ 'exit_cb': function('s:EndDebug'), + \ 'term_finish': 'close' + \ }) +endfunc + +func s:EndDebug(job, status) + exe 'bwipe! ' . s:ptybuf +endfunc |