aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2023-08-23 17:41:21 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2023-08-25 11:05:18 +0100
commite3b385bed5d27a3c50687526737e8e146c3abddc (patch)
tree28e331d8c7ae25815b95ef70b5ca0dd37747c8de
parent92ef2b2bcd4f8082e1b05af0663ffef422461e6a (diff)
downloadrneovim-e3b385bed5d27a3c50687526737e8e146c3abddc.tar.gz
rneovim-e3b385bed5d27a3c50687526737e8e146c3abddc.tar.bz2
rneovim-e3b385bed5d27a3c50687526737e8e146c3abddc.zip
vim-patch:3d3a9152fa6d
runtime(termdebug): more termdebug fixes and improvements (vim/vim#12892) - Fix and attempt to simplify :Frame/:Up/:Down documentation. - Accept a count instead for :Up/:Down/+/-. - Update the "Last Change" dates. - Fix a missing :let (caused an error if gdb fails to start). - Wipe the prompt buffer when ending prompt mode (if it exists and wasn't wiped by the user first). Avoids issues with stale prompt buffers (such as E95 when starting a new prompt mode session). - Kill the gdb job if the prompt buffer is unloaded (similar to what's done for a terminal buffer). Fixes not being able to start a new termdebug session if the buffer was wiped by the user, for example. https://github.com/vim/vim/commit/3d3a9152fa6de7038fdfd6d6de25230ed825552a
-rw-r--r--runtime/doc/nvim_terminal_emulator.txt29
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim43
2 files changed, 28 insertions, 44 deletions
diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt
index ff3a5791ca..d0d535566d 100644
--- a/runtime/doc/nvim_terminal_emulator.txt
+++ b/runtime/doc/nvim_terminal_emulator.txt
@@ -317,19 +317,16 @@ This is similar to using "print" in the gdb window.
You can usually shorten `:Evaluate` to `:Ev`.
-Navigation in the Stack ~
- *termdebug-variables* *:Frame*
- `:Frame` Select the given frame, using either the frame's
- stack number, address, or function name.
- `:Up` Select the frame that called the current one with an
- optional argument to say how many frames to go up.
- `+` same (see |termdebug_map_plus| to disable)
- `:Down` Select the frame called by the current one with
- an optional argument to say how many frames to go down.
- `-` same (see |termdebug_map_minus| to disable)
-
-This is similar to using "print" in the gdb window.
-You can usually shorten `:Evaluate` to `:Ev`.
+Navigating stack frames ~
+ *termdebug-frames* *:Frame* *:Up* *:Down*
+ `:Frame` [frame] select frame [frame], which is a frame number,
+ address, or function name (default: current frame)
+ `:Up` [count] go up [count] frames (default: 1; the frame that
+ called the current)
+ `+` same (see |termdebug_map_plus| to disable)
+ `:Down` [count] go down [count] frames (default: 1; the frame called
+ by the current)
+ `-` same (see |termdebug_map_minus| to disable)
Other commands ~
@@ -403,17 +400,17 @@ If there is no g:termdebug_config you can use: >vim
let g:termdebug_use_prompt = 1
<
*termdebug_map_K*
-The K key is normally mapped to :Evaluate. If you do not want this use: >vim
+The K key is normally mapped to |:Evaluate|. If you do not want this use: >vim
let g:termdebug_config['map_K'] = 0
If there is no g:termdebug_config you can use: >vim
let g:termdebug_map_K = 0
<
*termdebug_map_minus*
-The - key is normally mapped to :Down. If you do not want this use: >vim
+The - key is normally mapped to |:Down|. If you do not want this use: >vim
let g:termdebug_config['map_minus'] = 0
<
*termdebug_map_plus*
-The + key is normally mapped to :Up. If you do not want this use: >vim
+The + key is normally mapped to |:Up|. If you do not want this use: >vim
let g:termdebug_config['map_plus'] = 0
<
*termdebug_disasm_window*
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 781c34396d..e0f2c84f2d 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: 2023 Jun 24
+" Last Change: 2023 Aug 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
@@ -240,7 +240,7 @@ func s:CloseBuffers()
if s:varbuf > 0 && bufexists(s:varbuf)
exe 'bwipe! ' . s:varbuf
endif
- s:running = 0
+ let s:running = 0
unlet! s:gdbwin
endfunc
@@ -476,6 +476,7 @@ func s:StartDebug_prompt(dict)
call s:CloseBuffers()
return
endif
+ exe $'au BufUnload <buffer={s:promptbuf}> ++once call jobstop(s:gdbjob)'
let s:ptybuf = 0
if has('win32')
@@ -819,12 +820,8 @@ func s:EndPromptDebug(job_id, exit_code, event)
doauto <nomodeline> User TermdebugStopPre
endif
- let curwinid = win_getid()
- call win_gotoid(s:gdbwin)
- set nomodified
- close
- if curwinid != s:gdbwin
- call win_gotoid(curwinid)
+ if bufexists(s:promptbuf)
+ exe 'bwipe! ' . s:promptbuf
endif
call s:EndDebugCommon()
@@ -1006,8 +1003,8 @@ func s:InstallCommands()
endif
command -nargs=* Frame call s:Frame(<q-args>)
- command -nargs=* Up call s:Up(<q-args>)
- command -nargs=* Down call s:Down(<q-args>)
+ command -count=1 Up call s:Up(<count>)
+ command -count=1 Down call s:Down(<count>)
command -range -nargs=* Evaluate call s:Evaluate(<range>, <q-args>)
command Gdb call win_gotoid(s:gdbwin)
@@ -1034,7 +1031,7 @@ func s:InstallCommands()
endif
if map
let s:plus_map_saved = maparg('+', 'n', 0, 1)
- nnoremap + :Up<CR>
+ nnoremap <expr> + $'<Cmd>{v:count1}Up<CR>'
endif
let map = 1
@@ -1043,7 +1040,7 @@ func s:InstallCommands()
endif
if map
let s:minus_map_saved = maparg('-', 'n', 0, 1)
- nnoremap - :Down<CR>
+ nnoremap <expr> - $'<Cmd>{v:count1}Down<CR>'
endif
@@ -1270,26 +1267,16 @@ func s:Frame(arg)
endif
endfunc
-" :Up - go one frame in the stack "higher"
-func s:Up(arg)
- if a:arg != ''
- let s:cmd = '"up ' . a:arg . '"'
- else
- let s:cmd = '"up"'
- endif
+" :Up - go a:count frames in the stack "higher"
+func s:Up(count)
" the 'correct' one would be -stack-select-frame N, but we don't know N
- call s:SendCommand('-interpreter-exec console ' . s:cmd)
+ call s:SendCommand($'-interpreter-exec console "up {a:count}"')
endfunc
-" :Down - go one frame in the stack "below"
-func s:Down(arg)
- if a:arg != ''
- let s:cmd = '"down ' . a:arg . '"'
- else
- let s:cmd = '"down"'
- endif
+" :Down - go a:count frames in the stack "below"
+func s:Down(count)
" the 'correct' one would be -stack-select-frame N, but we don't know N
- call s:SendCommand('-interpreter-exec console ' . s:cmd)
+ call s:SendCommand($'-interpreter-exec console "down {a:count}"')
endfunc
func s:SendEval(expr)