summaryrefslogtreecommitdiffstats
path: root/runtime/pack/dist/opt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-14 18:59:50 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-14 18:59:50 +0200
commitb3623a382abc8f8e2bcfba4c1a2aa06b7578eb8d (patch)
tree945be9af9b64231e8cc4a631a01faab41a151c67 /runtime/pack/dist/opt
parent8c041b6b95f49f7383cf00e2036cf009b326fa8d (diff)
patch 8.0.1713: terminal debugger doesn't handle argumentsv8.0.1713
Problem: Terminal debugger doesn't handle arguments. Solution: Use <f-args> and pass all the arguments to gdb, e.g. the core file or process number. (suggested by Christian Brabandt) Disallow starting the debugger twice.
Diffstat (limited to 'runtime/pack/dist/opt')
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim15
1 files changed, 11 insertions, 4 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 256f7ef60c..ded114a2d7 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -25,7 +25,7 @@ endif
" The command that starts debugging, e.g. ":Termdebug vim".
" To end type "quit" in the gdb window.
-command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>)
+command -nargs=* -complete=file Termdebug call s:StartDebug(<f-args>)
" Name of the gdb command, defaults to "gdb".
if !exists('termdebugger')
@@ -43,7 +43,12 @@ else
endif
hi default debugBreakpoint term=reverse ctermbg=red guibg=red
-func s:StartDebug(cmd)
+func s:StartDebug(...)
+ if exists('s:gdbwin')
+ echoerr 'Terminal debugger already running'
+ return
+ endif
+
let s:startwin = win_getid(winnr())
let s:startsigncolumn = &signcolumn
@@ -90,7 +95,7 @@ func s:StartDebug(cmd)
" Open a terminal window to run the debugger.
" Add -quiet to avoid the intro message causing a hit-enter prompt.
- let cmd = [g:termdebugger, '-quiet', '-tty', pty, a:cmd]
+ let cmd = [g:termdebugger, '-quiet', '-tty', pty] + a:000
echomsg 'executing "' . join(cmd) . '"'
let s:gdbbuf = term_start(cmd, {
\ 'exit_cb': function('s:EndDebug'),
@@ -112,7 +117,7 @@ func s:StartDebug(cmd)
let try_count = 0
while 1
let response = ''
- for lnum in range(1,20)
+ for lnum in range(1,200)
if term_getline(s:gdbbuf, lnum) =~ 'new-ui mi '
let response = term_getline(s:gdbbuf, lnum + 1)
if response =~ 'Undefined command'
@@ -182,6 +187,7 @@ endfunc
func s:EndDebug(job, status)
exe 'bwipe! ' . s:ptybuf
exe 'bwipe! ' . s:commbuf
+ unlet s:gdbwin
let curwinid = win_getid(winnr())
@@ -295,6 +301,7 @@ func s:DeleteCommands()
delcommand Evaluate
delcommand Gdb
delcommand Program
+ delcommand Source
delcommand Winbar
nunmap K