From 3906b2d4fc617c6b03f7c9a615d18b70d7250e80 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 17 Jan 2022 11:58:36 +0100 Subject: vim-patch:fd31be29b822 (#17114) Update runtime files https://github.com/vim/vim/commit/fd31be29b8220ee1cb0b3460c82f2634ae3cc370 --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index c881133b72..829e41001b 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: 2021 Dec 16 +" Last Change: 2022 Jan 13 " " WORK IN PROGRESS - Only the basics work " Note: On MS-Windows you need a recent version of gdb. The one included with @@ -1344,6 +1344,15 @@ func s:HandleCursor(msg) if lnum =~ '^[0-9]*$' call s:GotoSourcewinOrCreateIt() if expand('%:p') != fnamemodify(fname, ':p') + augroup Termdebug + " Always open a file read-only instead of showing the ATTENTION + " prompt, since we are unlikely to want to edit the file. + " The file may be changed but not saved, warn for that. + au SwapExists * echohl WarningMsg + \ | echo 'Warning: file is being edited elsewhere' + \ | echohl None + \ | let v:swapchoice = 'o' + augroup END if &modified " TODO: find existing window exe 'split ' . fnameescape(fname) @@ -1352,6 +1361,9 @@ func s:HandleCursor(msg) else exe 'edit ' . fnameescape(fname) endif + augroup Termdebug + au! SwapExists + augroup END endif exe lnum normal! zv -- cgit From 4ba7fa1700ead8a53d73fea7fc17a545f9b4588d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 23 Jan 2022 18:38:41 +0100 Subject: vim-patch:6f4754b9f725 (#17179) Update runtime files https://github.com/vim/vim/commit/6f4754b9f7253d7e4ba527064a24aff1acdb1e8f --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 829e41001b..49d9389773 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 13 +" Last Change: 2022 Jan 17 " " WORK IN PROGRESS - Only the basics work " Note: On MS-Windows you need a recent version of gdb. The one included with @@ -1344,6 +1344,7 @@ func s:HandleCursor(msg) if lnum =~ '^[0-9]*$' call s:GotoSourcewinOrCreateIt() if expand('%:p') != fnamemodify(fname, ':p') + echomsg 'different fname: "' .. expand('%:p') .. '" vs "' .. fnamemodify(fname, ':p') .. '"' augroup Termdebug " Always open a file read-only instead of showing the ATTENTION " prompt, since we are unlikely to want to edit the file. -- cgit From 75157d2572248c330858586fa23649e7acf33416 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 20 Mar 2022 10:48:10 +0100 Subject: vim-patch:47c532e2bc55 (#17780) Update runtime files https://github.com/vim/vim/commit/47c532e2bc55e8a48f7f47e1fae1ed30144f2fa1 --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 49d9389773..63aba72f0d 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -4,10 +4,11 @@ " Copyright: Vim license applies, see ":help license" " Last Change: 2022 Jan 17 " -" WORK IN PROGRESS - Only the basics work -" Note: On MS-Windows you need a recent version of gdb. The one included with -" MingW is too old (7.6.1). -" I used version 7.12 from http://www.equation.com/servlet/equation.cmd?fa=gdb +" WORK IN PROGRESS - The basics works stable, more to come +" Note: In general you need at least GDB 7.12 because this provides the +" frame= response in MI thread-selected events we need to sync stack to file. +" The one included with "old" MingW is too old (7.6.1), you may upgrade it or +" use a newer version from http://www.equation.com/servlet/equation.cmd?fa=gdb " " There are two ways to run gdb: " - In a terminal window; used if possible, does not work on MS-Windows @@ -1026,7 +1027,7 @@ func s:Evaluate(range, arg) call s:SendEval(expr) endfunc -" get what is specified / under the cursor +" get what is specified / under the cursor func s:GetEvaluationExpression(range, arg) if a:arg != '' " user supplied evaluation -- cgit From 315858bf67599d39c38628cd2ab8bff1074d7fe4 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 20 Mar 2022 10:10:01 +0000 Subject: fix(termdebug): handle exiting during startup properly (#16790) s:EndTermDebug should only be called when exiting if the debugger started without error, otherwise the plugin breaks. Vim handles this by using job_setoptions to set the on_exit callback to s:EndTermDebug after startup succeeds. However, Nvim does not have such functionality; instead; use s:starting to mimic this behaviour. Also, introduce s:running to fix s:CheckGdbRunning; it did not work correctly due to the "[Process exited X]" message keeping the job's channel alive (though the stream is closed). This means nvim_get_chan_info cannot be used to check if the debugger has exited, as it may still return a non-empty dict. --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 63aba72f0d..71456e788d 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -197,7 +197,7 @@ func s:CloseBuffers() endfunc func s:CheckGdbRunning() - if nvim_get_chan_info(s:gdb_job_id) == {} + if !s:running echoerr string(s:GetCommand()[0]) . ' exited unexpectedly' call s:CloseBuffers() return '' @@ -280,6 +280,8 @@ func s:StartDebug_term(dict) call s:CloseBuffers() return endif + let s:running = v:true + let s:starting = v:true let gdb_job_info = nvim_get_chan_info(s:gdb_job_id) let s:gdbbuf = gdb_job_info['buffer'] let s:gdbwin = win_getid(winnr()) @@ -355,6 +357,8 @@ func s:StartDebug_term(dict) sleep 10m endwhile + let s:starting = v:false + " Set the filetype, this can be used to add mappings. set filetype=termdebug @@ -663,6 +667,11 @@ func s:GetAsmAddr(msg) endfunc function s:EndTermDebug(job_id, exit_code, event) + let s:running = v:false + if s:starting + return + endif + if exists('#User#TermdebugStopPre') doauto User TermdebugStopPre endif -- cgit From 0124a7bfa9e27796e561cb0b3a045b9327bf7077 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 19 Apr 2022 15:14:17 +0200 Subject: vim-patch:75ab590f8504 (#18170) Update runtime files https://github.com/vim/vim/commit/75ab590f8504a8912ca0b8c58f6b897bb7a34f07 omit builtin.txt change to `expand()` (depends on 8.2.4726) --- .../pack/dist/opt/termdebug/plugin/termdebug.vim | 71 ++++++++++++++-------- 1 file changed, 45 insertions(+), 26 deletions(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 71456e788d..8a7dcb0e75 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 @@ -466,7 +466,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) @@ -700,7 +700,9 @@ func s:EndDebugCommon() endif endif endfor - exe was_buf .. "buf" + if bufexists(was_buf) + exe was_buf .. "buf" + endif call s:DeleteCommands() @@ -759,8 +761,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) @@ -846,6 +848,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() command Finish call s:SendResumingCommand('-exec-finish') command -nargs=* Run call s:Run() command -nargs=* Arguments call s:SendResumingCommand('-exec-arguments ' . ) @@ -904,6 +907,7 @@ func s:DeleteCommands() delcommand Clear delcommand Step delcommand Over + delcommand Until delcommand Finish delcommand Run delcommand Arguments @@ -933,22 +937,30 @@ func s:DeleteCommands() unlet s:k_map_saved 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. @@ -982,7 +994,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] @@ -1304,8 +1317,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 @@ -1340,8 +1353,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) @@ -1378,8 +1391,9 @@ func s:HandleCursor(msg) endif exe lnum normal! zv - exe 'sign unplace ' . s:pc_id - exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC 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()) @@ -1387,7 +1401,7 @@ func s:HandleCursor(msg) 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) @@ -1404,7 +1418,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 @@ -1482,7 +1498,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 @@ -1496,7 +1514,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 -- cgit From 0d3f17a6c317b26cdc319b48e25e1574f3a0e9fd Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 8 May 2022 10:15:36 +0100 Subject: vim-patch:partial:d899e5112079 (#18474) Update runtime files https://github.com/vim/vim/commit/d899e51120798d3fb5420abb1f19dddf3f014d05 - Skip vimhelp.vim stuff (syntax/help.vim, syntax.txt; v8.2.4891). - Skip :let heredoc eval stuff (eval.txt; v8.2.4770). - Skip uk.cp1251.po. - Skip `*hl-CurSearch*` change (syntax.txt): - Vim's CurSearch works differently (Nvim's uses current cursor pos). Dunno know how applicable the redrawing comment is to Nvim... - Might be preferred to move it under `*hl-Search*` like Vim? --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 8a7dcb0e75..ab1871fe60 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 Apr 16 +" Last Change: 2022 May 04 " " WORK IN PROGRESS - The basics works stable, more to come " Note: In general you need at least GDB 7.12 because this provides the @@ -924,7 +924,7 @@ func s:DeleteCommands() if empty(s:k_map_saved) nunmap K else - " call mapset('n', 0, s:k_map_saved) + " call mapset(s:k_map_saved) let mode = s:k_map_saved.mode !=# ' ' ? s:k_map_saved.mode : '' call nvim_set_keymap(mode, 'K', s:k_map_saved.rhs, { \ 'expr': s:k_map_saved.expr ? v:true : v:false, -- cgit From e50b1fe60d87cbe7798ce921f08ea38a4750fa99 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 10 May 2022 10:55:33 +0200 Subject: vim-patch:921bde888046 (#18511) Update runtime files, translations https://github.com/vim/vim/commit/921bde88804663a7cb825d7f7e8a5d8ae6b58650 skip: translations skip: builtin.txt (requires 8.2.4861) --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index ab1871fe60..4f2f7b942d 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 May 04 +" Last Change: 2022 May 09 " " WORK IN PROGRESS - The basics works stable, more to come " Note: In general you need at least GDB 7.12 because this provides the @@ -205,8 +205,8 @@ func s:CheckGdbRunning() return 'ok' endfunc +" Open a terminal window without a job, to run the debugged program in. func s:StartDebug_term(dict) - " Open a terminal window without a job, to run the debugged program in. execute s:vertical ? 'vnew' : 'new' let s:pty_job_id = termopen('tail -f /dev/null;#gdb program') if s:pty_job_id == 0 @@ -365,8 +365,8 @@ func s:StartDebug_term(dict) call s:StartDebugCommon(a:dict) endfunc +" Open a window with a prompt buffer to run gdb in. func s:StartDebug_prompt(dict) - " Open a window with a prompt buffer to run gdb in. if s:vertical vertical new else -- cgit From ec48c6f236669e0c4d03db8bb2c1e011f1071f5e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 25 May 2022 09:46:19 +0800 Subject: vim-patch:8.2.5010: the terminal debugger uses various global variables Problem: The terminal debugger uses various global variables. Solution: Add a dictionary to hold the terminal debugger preferences. https://github.com/vim/vim/commit/c9a431c7638ecebb6f2cb3eabd0e1b2b5e269c1e Omit popup menu. --- .../pack/dist/opt/termdebug/plugin/termdebug.vim | 96 +++++++++++++++------- 1 file changed, 66 insertions(+), 30 deletions(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 4f2f7b942d..4cd4a200dd 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 May 09 +" Last Change: 2022 May 23 " " WORK IN PROGRESS - The basics works stable, more to come " Note: In general you need at least GDB 7.12 because this provides the @@ -71,11 +71,6 @@ set cpo&vim command -nargs=* -complete=file -bang Termdebug call s:StartDebug(0, ) command -nargs=+ -complete=file -bang TermdebugCommand call s:StartDebugCommand(0, ) -" Name of the gdb command, defaults to "gdb". -if !exists('g:termdebugger') - let g:termdebugger = 'gdb' -endif - let s:pc_id = 12 let s:asm_id = 13 let s:break_id = 14 " breakpoint number is added to this @@ -105,8 +100,17 @@ call s:Highlight(1, '', &background) hi default debugBreakpoint term=reverse ctermbg=red guibg=red hi default debugBreakpointDisabled term=reverse ctermbg=gray guibg=gray +" Get the command to execute the debugger as a list, defaults to ["gdb"]. func s:GetCommand() - return type(g:termdebugger) == v:t_list ? copy(g:termdebugger) : [g:termdebugger] + if exists('g:termdebug_config') + let cmd = get(g:termdebug_config, 'command', 'gdb') + elseif exists('g:termdebugger') + let cmd = g:termdebugger + else + let cmd = 'gdb' + endif + + return type(cmd) == v:t_list ? copy(cmd) : [cmd] endfunc func s:StartDebug(bang, ...) @@ -177,12 +181,10 @@ func s:StartDebug_internal(dict) call s:StartDebug_term(a:dict) endif - if exists('g:termdebug_disasm_window') - if g:termdebug_disasm_window - let curwinid = win_getid(winnr()) - call s:GotoAsmwinOrCreateIt() - call win_gotoid(curwinid) - endif + if s:GetDisasmWindow() + let curwinid = win_getid(winnr()) + call s:GotoAsmwinOrCreateIt() + call win_gotoid(curwinid) endif if exists('#User#TermdebugStartPost') @@ -252,18 +254,28 @@ func s:StartDebug_term(dict) let proc_args = get(a:dict, 'proc_args', []) let gdb_cmd = s:GetCommand() - " Add -quiet to avoid the intro message causing a hit-enter prompt. - let gdb_cmd += ['-quiet'] - " Disable pagination, it causes everything to stop at the gdb - let gdb_cmd += ['-iex', 'set pagination off'] - " Interpret commands while the target is running. This should usually only - " be exec-interrupt, since many commands don't work properly while the - " target is running (so execute during startup). - let gdb_cmd += ['-iex', 'set mi-async on'] - " Open a terminal window to run the debugger. - let gdb_cmd += ['-tty', pty] - " Command executed _after_ startup is done, provides us with the necessary feedback - let gdb_cmd += ['-ex', 'echo startupdone\n'] + + if exists('g:termdebug_config') && has_key(g:termdebug_config, 'command_add_args') + let gdb_cmd = g:termdebug_config.command_add_args(gdb_cmd, pty) + else + " Add -quiet to avoid the intro message causing a hit-enter prompt. + let gdb_cmd += ['-quiet'] + " Disable pagination, it causes everything to stop at the gdb + let gdb_cmd += ['-iex', 'set pagination off'] + " Interpret commands while the target is running. This should usually only + " be exec-interrupt, since many commands don't work properly while the + " target is running (so execute during startup). + let gdb_cmd += ['-iex', 'set mi-async on'] + " Open a terminal window to run the debugger. + let gdb_cmd += ['-tty', pty] + " Command executed _after_ startup is done, provides us with the necessary + " feedback + let gdb_cmd += ['-ex', 'echo startupdone\n'] + endif + + if exists('g:termdebug_config') && has_key(g:termdebug_config, 'command_filter') + let gdb_cmd = g:termdebug_config.command_filter(gdb_cmd) + endif " Adding arguments requested by the user let gdb_cmd += gdb_args @@ -871,7 +883,13 @@ func s:InstallCommands() command Asm call s:GotoAsmwinOrCreateIt() command Winbar call s:InstallWinbar() - if !exists('g:termdebug_map_K') || g:termdebug_map_K + let map = 1 + if exists('g:termdebug_config') + let map = get(g:termdebug_config, 'map_K', 1) + elseif exists('g:termdebug_map_K') + let map = g:termdebug_map_K + endif + if map " let s:k_map_saved = maparg('K', 'n', 0, 1) let s:k_map_saved = {} for map in nvim_get_keymap('n') @@ -1280,6 +1298,26 @@ func s:GotoSourcewinOrCreateIt() endif endfunc +func s:GetDisasmWindow() + if exists('g:termdebug_config') + return get(g:termdebug_config, 'disasm_window', 0) + endif + if exists('g:termdebug_disasm_window') + return g:termdebug_disasm_window + endif + return 0 +endfunc + +func s:GetDisasmWindowHeight() + if exists('g:termdebug_config') + return get(g:termdebug_config, 'disasm_window_height', 0) + endif + if exists('g:termdebug_disasm_window') && g:termdebug_disasm_window > 1 + return g:termdebug_disasm_window + endif + return 0 +endfunc + func s:GotoAsmwinOrCreateIt() if !win_gotoid(s:asmwin) if win_gotoid(s:sourcewin) @@ -1303,10 +1341,8 @@ func s:GotoAsmwinOrCreateIt() exe 'file Termdebug-asm-listing' endif - if exists('g:termdebug_disasm_window') - if g:termdebug_disasm_window > 1 - exe 'resize ' . g:termdebug_disasm_window - endif + if s:GetDisasmWindowHeight() > 0 + exe 'resize ' .. s:GetDisasmWindowHeight() endif endif -- cgit From c00a3f45d47840e36c97c87e2ddf1dd2bcc2c2f7 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 23 Jun 2022 15:57:51 +0200 Subject: vim-patch:8cc5b559f700 (#19066) Update runtime files https://github.com/vim/vim/commit/8cc5b559f70041361612b8a6a87922503b33baa6 --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 4cd4a200dd..f76bdebe9b 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 May 23 +" Last Change: 2022 Jun 22 " " WORK IN PROGRESS - The basics works stable, more to come " Note: In general you need at least GDB 7.12 because this provides the @@ -1406,7 +1406,7 @@ func s:HandleCursor(msg) echomsg 'different fname: "' .. expand('%:p') .. '" vs "' .. fnamemodify(fname, ':p') .. '"' augroup Termdebug " Always open a file read-only instead of showing the ATTENTION - " prompt, since we are unlikely to want to edit the file. + " prompt, since it is unlikely we want to edit the file. " The file may be changed but not saved, warn for that. au SwapExists * echohl WarningMsg \ | echo 'Warning: file is being edited elsewhere' -- cgit From 42e87743170d33133555252f20a72b4fb7f4fd42 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 25 Jun 2022 21:56:51 +0200 Subject: vim-patch:e1dc76fbf333 (#19092) Update runtime files https://github.com/vim/vim/commit/e1dc76fbf333243ecfdfc3c0a81ea9984913b4f5 --- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index f76bdebe9b..c4e90eb373 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 Jun 22 +" Last Change: 2022 Jun 24 " " WORK IN PROGRESS - The basics works stable, more to come " Note: In general you need at least GDB 7.12 because this provides the @@ -539,6 +539,7 @@ func TermDebugSendCommand(cmd) endif sleep 10m endif + " TODO: should we prepend CTRL-U to clear the command? call chansend(s:gdb_job_id, a:cmd . "\r") if do_continue Continue -- cgit From a4801b803439d0bfa412383462af69f8d7e56835 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 5 Jul 2022 20:57:01 +0800 Subject: vim-patch:8.0.1562: the terminal debugger can't set a breakpoint with the mouse (#19234) Problem: The terminal debugger can't set a breakpoint with the mouse. Solution: Add popup menu entries. https://github.com/vim/vim/commit/71137fed4d77e985d49ca32c79f030512767b8ce This ports missing popup menu code to termdebug plugin. Despite the commit message, the code is copied from latest Vim. WinBar code is commented out and WinBar docs is not ported. --- .../pack/dist/opt/termdebug/plugin/termdebug.vim | 49 +++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'runtime/pack/dist/opt/termdebug/plugin') diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index c4e90eb373..802ebd42b5 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -37,7 +37,7 @@ " " For neovim compatibility, the vim specific calls were replaced with neovim " specific calls: -" term_start -> term_open +" term_start -> termopen " term_sendkeys -> chansend " term_getline -> getbufline " job_info && term_getjob -> using linux command ps to get the tty @@ -902,6 +902,26 @@ func s:InstallCommands() nnoremap K :Evaluate endif + if has('menu') && &mouse != '' + call s:InstallWinbar() + + let popup = 1 + if exists('g:termdebug_config') + let popup = get(g:termdebug_config, 'popup', 1) + elseif exists('g:termdebug_popup') + let popup = g:termdebug_popup + endif + if popup + let s:saved_mousemodel = &mousemodel + let &mousemodel = 'popup_setpos' + an 1.200 PopUp.-SEP3- + an 1.210 PopUp.Set\ breakpoint :Break + an 1.220 PopUp.Clear\ breakpoint :Clear + an 1.230 PopUp.Run\ until :Until + an 1.240 PopUp.Evaluate :Evaluate + endif + endif + let &cpo = save_cpo endfunc @@ -956,6 +976,33 @@ func s:DeleteCommands() unlet s:k_map_saved endif + if has('menu') + " Remove the WinBar entries from all windows where it was added. + " let curwinid = win_getid(winnr()) + " for winid in s:winbar_winids + " if win_gotoid(winid) + " aunmenu WinBar.Step + " aunmenu WinBar.Next + " aunmenu WinBar.Finish + " aunmenu WinBar.Cont + " aunmenu WinBar.Stop + " aunmenu WinBar.Eval + " endif + " endfor + " call win_gotoid(curwinid) + " let s:winbar_winids = [] + + if exists('s:saved_mousemodel') + let &mousemodel = s:saved_mousemodel + unlet s:saved_mousemodel + aunmenu PopUp.-SEP3- + aunmenu PopUp.Set\ breakpoint + aunmenu PopUp.Clear\ breakpoint + aunmenu PopUp.Run\ until + aunmenu PopUp.Evaluate + endif + endif + call sign_unplace('TermDebug') unlet s:breakpoints unlet s:breakpoint_locations -- cgit