aboutsummaryrefslogtreecommitdiff
path: root/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-11-07 03:16:52 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-11-07 03:23:37 +0100
commit8c3377ee76e5cc4f5a4228f216bde1d03b496d69 (patch)
treee183185d55b8ff85aad5e305a7895109562159ee /runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
parent1a3e54231ab8b2fc29f5a37931713061ac400faa (diff)
downloadrneovim-8c3377ee76e5cc4f5a4228f216bde1d03b496d69.tar.gz
rneovim-8c3377ee76e5cc4f5a4228f216bde1d03b496d69.tar.bz2
rneovim-8c3377ee76e5cc4f5a4228f216bde1d03b496d69.zip
vim-patch:c572da5f67aa
Update runtime files https://github.com/vim/vim/commit/c572da5f67aa5cdbbc127fc6f1d0a42e38468325
Diffstat (limited to 'runtime/pack/dist/opt/termdebug/plugin/termdebug.vim')
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim35
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