annotate runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @ 12254:8d76a56861ec

Update runtime files commit https://github.com/vim/vim/commit/c572da5f67aa5cdbbc127fc6f1d0a42e38468325 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 27 16:52:01 2017 +0200 Update runtime files
author Christian Brabandt <cb@256bit.org>
date Sun, 27 Aug 2017 17:00:05 +0200
parents
children 39e1087e7094
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12254
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Debugger commands.
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 "
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " WORK IN PROGRESS - much doesn't work yet
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 "
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " Open two terminal windows:
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " 1. run a pty, as with ":term NONE"
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 " 2. run gdb, passing the pty
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 " The current window is used to edit source code and follows gdb.
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 "
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " Author: Bram Moolenaar
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " Copyright: Vim license applies
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>)
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 if !exists('debugger')
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 let debugger = 'gdb'
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 endif
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 func s:StartDebug(cmd)
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 " Open a terminal window without a job, to run the debugged program
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 let s:ptybuf = term_start('NONE', {})
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 let pty = job_info(term_getjob(s:ptybuf))['tty']
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " Open a terminal window to run the debugger.
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 let cmd = [g:debugger, '-tty', pty, a:cmd]
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 echomsg 'executing "' . join(cmd) . '"'
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 let gdbbuf = term_start(cmd, {
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 \ 'exit_cb': function('s:EndDebug'),
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 \ 'term_finish': 'close'
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 \ })
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 endfunc
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 func s:EndDebug(job, status)
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 exe 'bwipe! ' . s:ptybuf
8d76a56861ec Update runtime files
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 endfunc