summaryrefslogtreecommitdiffstats
path: root/runtime/pack
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-04-18 15:36:40 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-18 15:36:40 +0100
commit75ab590f8504a8912ca0b8c58f6b897bb7a34f07 (patch)
tree075bd9c71cdc8ed677ae82f9594668cf3a220109 /runtime/pack
parenta929c922b1cb7c84ad1b5d1d0fc9a4f7c68ab8e0 (diff)
Update runtime files
Diffstat (limited to 'runtime/pack')
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim75
1 files changed, 48 insertions, 27 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 00a9ca97b3..63d25db529 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -2,7 +2,7 @@
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
-" Last Change: 2022 Jan 17
+" Last Change: 2022 Apr 16
"
" WORK IN PROGRESS - The basics works stable, more to come
" Note: In general you need at least GDB 7.12 because this provides the
@@ -445,7 +445,7 @@ endfunc
func s:StartDebugCommon(dict)
" Sign used to highlight the line where the program has stopped.
" There can be only one.
- sign define debugPC linehl=debugPC
+ call sign_define('debugPC', #{linehl: 'debugPC'})
" Install debugger commands in the text window.
call win_gotoid(s:sourcewin)
@@ -668,7 +668,9 @@ func s:EndDebugCommon()
endif
endif
endfor
- exe was_buf .. "buf"
+ if bufexists(was_buf)
+ exe was_buf .. "buf"
+ endif
call s:DeleteCommands()
@@ -740,8 +742,8 @@ func s:HandleDisasmMsg(msg)
let lnum = search('^' . s:asm_addr)
if lnum != 0
- exe 'sign unplace ' . s:asm_id
- exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
+ call sign_unplace('TermDebug', #{id: s:asm_id})
+ call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
call win_gotoid(curwinid)
@@ -830,6 +832,7 @@ func s:InstallCommands()
command Clear call s:ClearBreakpoint()
command Step call s:SendResumingCommand('-exec-step')
command Over call s:SendResumingCommand('-exec-next')
+ command -nargs=? Until call s:Until(<q-args>)
command Finish call s:SendResumingCommand('-exec-finish')
command -nargs=* Run call s:Run(<q-args>)
command -nargs=* Arguments call s:SendResumingCommand('-exec-arguments ' . <q-args>)
@@ -866,7 +869,8 @@ func s:InstallCommands()
an 1.200 PopUp.-SEP3- <Nop>
an 1.210 PopUp.Set\ breakpoint :Break<CR>
an 1.220 PopUp.Clear\ breakpoint :Clear<CR>
- an 1.230 PopUp.Evaluate :Evaluate<CR>
+ an 1.230 PopUp.Run\ until :Until<CR>
+ an 1.240 PopUp.Evaluate :Evaluate<CR>
endif
endif
@@ -894,6 +898,7 @@ func s:DeleteCommands()
delcommand Clear
delcommand Step
delcommand Over
+ delcommand Until
delcommand Finish
delcommand Run
delcommand Arguments
@@ -937,26 +942,35 @@ func s:DeleteCommands()
aunmenu PopUp.-SEP3-
aunmenu PopUp.Set\ breakpoint
aunmenu PopUp.Clear\ breakpoint
+ aunmenu PopUp.Run\ until
aunmenu PopUp.Evaluate
endif
endif
- exe 'sign unplace ' . s:pc_id
- for [id, entries] in items(s:breakpoints)
- for subid in keys(entries)
- exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
- endfor
- endfor
+ call sign_unplace('TermDebug')
unlet s:breakpoints
unlet s:breakpoint_locations
- sign undefine debugPC
- for val in s:BreakpointSigns
- exe "sign undefine debugBreakpoint" . val
- endfor
+ call sign_undefine('debugPC')
+ call sign_undefine(s:BreakpointSigns->map("'debugBreakpoint' .. v:val"))
let s:BreakpointSigns = []
endfunc
+" :Until - Execute until past a specified position or current line
+func s:Until(at)
+ if s:stopped
+ " reset s:stopped here, it may take a bit of time before we get a response
+ let s:stopped = 0
+ call ch_log('assume that program is running after this command')
+ " Use the fname:lnum format
+ let at = empty(a:at) ?
+ \ fnameescape(expand('%:p')) . ':' . line('.') : a:at
+ call s:SendCommand('-exec-until ' . at)
+ else
+ call ch_log('dropping command, program is running: exec-until')
+ endif
+endfunc
+
" :Break - Set a breakpoint at the cursor position.
func s:SetBreakpoint(at)
" Setting a breakpoint may not work while the program is running.
@@ -990,7 +1004,8 @@ func s:ClearBreakpoint()
" Assume this always works, the reply is simply "^done".
call s:SendCommand('-break-delete ' . id)
for subid in keys(s:breakpoints[id])
- exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
+ call sign_unplace('TermDebug',
+ \ #{id: s:Breakpoint2SignNumber(id, subid)})
endfor
unlet s:breakpoints[id]
unlet s:breakpoint_locations[bploc][idx]
@@ -1205,8 +1220,8 @@ func s:GotoAsmwinOrCreateIt()
call s:SendCommand('disassemble $pc')
endif
else
- exe 'sign unplace ' . s:asm_id
- exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
+ call sign_unplace('TermDebug', #{id: s:asm_id})
+ call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
endif
endfunc
@@ -1241,8 +1256,8 @@ func s:HandleCursor(msg)
if lnum == 0
call s:SendCommand('disassemble $pc')
else
- exe 'sign unplace ' . s:asm_id
- exe 'sign place ' . s:asm_id . ' line=' . lnum . ' name=debugPC'
+ call sign_unplace('TermDebug', #{id: s:asm_id})
+ call sign_place(s:asm_id, 'TermDebug', 'debugPC', '%', #{lnum: lnum})
endif
call win_gotoid(curwinid)
@@ -1279,8 +1294,9 @@ echomsg 'different fname: "' .. expand('%:p') .. '" vs "' .. fnamemodify(fname,
endif
exe lnum
normal! zv
- exe 'sign unplace ' . s:pc_id
- exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC priority=110 file=' . fname
+ call sign_unplace('TermDebug', #{id: s:pc_id})
+ call sign_place(s:pc_id, 'TermDebug', 'debugPC', fname,
+ \ #{lnum: lnum, priority: 110})
if !exists('b:save_signcolumn')
let b:save_signcolumn = &signcolumn
call add(s:signcolumn_buflist, bufnr())
@@ -1288,7 +1304,7 @@ echomsg 'different fname: "' .. expand('%:p') .. '" vs "' .. fnamemodify(fname,
setlocal signcolumn=yes
endif
elseif !s:stopped || fname != ''
- exe 'sign unplace ' . s:pc_id
+ call sign_unplace('TermDebug', #{id: s:pc_id})
endif
call win_gotoid(wid)
@@ -1305,7 +1321,9 @@ func s:CreateBreakpoint(id, subid, enabled)
else
let hiName = "debugBreakpoint"
endif
- exe "sign define debugBreakpoint" . nr . " text=" . substitute(nr, '\..*', '', '') . " texthl=" . hiName
+ call sign_define('debugBreakpoint' .. nr,
+ \ #{text: substitute(nr, '\..*', '', ''),
+ \ texthl: hiName})
endif
endfunc
@@ -1383,7 +1401,9 @@ endfunc
func s:PlaceSign(id, subid, entry)
let nr = printf('%d.%d', a:id, a:subid)
- exe 'sign place ' . s:Breakpoint2SignNumber(a:id, a:subid) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint' . nr . ' priority=110 file=' . a:entry['fname']
+ call sign_place(s:Breakpoint2SignNumber(a:id, a:subid), 'TermDebug',
+ \ 'debugBreakpoint' .. nr, a:entry['fname'],
+ \ #{lnum: a:entry['lnum'], priority: 110})
let a:entry['placed'] = 1
endfunc
@@ -1397,7 +1417,8 @@ func s:HandleBreakpointDelete(msg)
if has_key(s:breakpoints, id)
for [subid, entry] in items(s:breakpoints[id])
if has_key(entry, 'placed')
- exe 'sign unplace ' . s:Breakpoint2SignNumber(id, subid)
+ call sign_unplace('TermDebug',
+ \ #{id: s:Breakpoint2SignNumber(id, subid)})
unlet entry['placed']
endif
endfor