Hi Bram and List.
This patch add a error handling when the debugger did not run
properly.
I noticed when testing that, Vim seem to leak a lot of file descriptor.
You can try be setting 'termdebugger' to /bin/false.
Regards.
Damien
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index df89abd7ad6f..2f546933cb1d 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -181,7 +181,6 @@ func s:StartDebug_term(dict)
let cmd = [g:termdebugger, '-quiet', '-tty', pty] + gdb_args
call ch_log('executing "' . join(cmd) . '"')
let s:gdbbuf = term_start(cmd, {
- \ 'exit_cb': function('s:EndTermDebug'),
\ 'term_finish': 'close',
\ })
if s:gdbbuf == 0
@@ -204,6 +203,14 @@ func s:StartDebug_term(dict)
" why the debugger doesn't work.
let try_count = 0
while 1
+ let gdbproc = term_getjob(s:gdbbuf)
+ if gdbproc == v:null || job_status(gdbproc) !=# 'run'
+ echoerr string(g:termdebugger) . ' exited unexpectedly'
+ exe 'bwipe! ' . s:ptybuf
+ exe 'bwipe! ' . s:commbuf
+ unlet s:gdbwin
+ return
+ endif
let response = ''
for lnum in range(1,200)
if term_getline(s:gdbbuf, lnum) =~ 'new-ui mi '
@@ -213,6 +220,7 @@ func s:StartDebug_term(dict)
echoerr 'Sorry, your gdb is too old, gdb 7.12 is required'
exe 'bwipe! ' . s:ptybuf
exe 'bwipe! ' . s:commbuf
+ unlet s:gdbwin
return
endif
if response =~ 'New UI allocated'
@@ -243,6 +251,7 @@ func s:StartDebug_term(dict)
" "Type <return> to continue" prompt.
call s:SendCommand('set pagination off')
+ call job_setoptions(gdbproc, {'exit_cb': function('s:EndTermDebug')})
call s:StartDebugCommon(a:dict)
endfunc