0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

Update runtime files

This commit is contained in:
Bram Moolenaar
2021-05-30 20:54:13 +02:00
parent 6ef5ab5904
commit d2ea7cf10a
91 changed files with 323 additions and 226 deletions

View File

@@ -2,7 +2,7 @@
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
" Last Change: 2021 May 16
" Last Change: 2021 May 18
"
" WORK IN PROGRESS - Only the basics work
" Note: On MS-Windows you need a recent version of gdb. The one included with
@@ -176,6 +176,16 @@ func s:CloseBuffers()
unlet! s:gdbwin
endfunc
func s:CheckGdbRunning()
let gdbproc = term_getjob(s:gdbbuf)
if gdbproc == v:null || job_status(gdbproc) !=# 'run'
echoerr string(g:termdebugger) . ' exited unexpectedly'
call s:CloseBuffers()
return ''
endif
return 'ok'
endfunc
func s:StartDebug_term(dict)
" Open a terminal window without a job, to run the debugged program in.
let s:ptybuf = term_start('NONE', {
@@ -216,7 +226,7 @@ func s:StartDebug_term(dict)
let gdb_args = get(a:dict, 'gdb_args', [])
let proc_args = get(a:dict, 'proc_args', [])
let cmd = [g:termdebugger, '-quiet', '-tty', pty] + gdb_args
let cmd = [g:termdebugger, '-quiet', '-tty', pty, '--eval-command', 'echo startupdone\n'] + gdb_args
call ch_log('executing "' . join(cmd) . '"')
let s:gdbbuf = term_start(cmd, {
\ 'term_finish': 'close',
@@ -228,9 +238,28 @@ func s:StartDebug_term(dict)
endif
let s:gdbwin = win_getid(winnr())
" Set arguments to be run. First wait a bit to make detecting gdb a bit
" more reliable.
sleep 200m
" Wait for the "startupdone" message before sending any commands.
let try_count = 0
while 1
if s:CheckGdbRunning() != 'ok'
return
endif
for lnum in range(1, 200)
if term_getline(s:gdbbuf, lnum) =~ 'startupdone'
let try_count = 9999
break
endif
endfor
let try_count += 1
if try_count > 300
" done or give up after five seconds
break
endif
sleep 10m
endwhile
" Set arguments to be run.
if len(proc_args)
call term_sendkeys(s:gdbbuf, 'set args ' . join(proc_args) . "\r")
endif
@@ -242,10 +271,7 @@ 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'
call s:CloseBuffers()
if s:CheckGdbRunning() != 'ok'
return
endif
@@ -292,7 +318,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 job_setoptions(term_getjob(s:gdbbuf), {'exit_cb': function('s:EndTermDebug')})
call s:StartDebugCommon(a:dict)
endfunc