aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-11-13 06:35:42 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-11-13 06:46:17 +0800
commit04d951685bcdfeb219e7fdc2fac8e6baf198e847 (patch)
tree0e7b941b056d0f52d9b15ae2641ca7c15a9c28a3
parent5ce3b89ff354e3e43d323b49f92dbce3bdd191c8 (diff)
downloadrneovim-04d951685bcdfeb219e7fdc2fac8e6baf198e847.tar.gz
rneovim-04d951685bcdfeb219e7fdc2fac8e6baf198e847.tar.bz2
rneovim-04d951685bcdfeb219e7fdc2fac8e6baf198e847.zip
vim-patch:8.2.2996: Vim9: when debugging cannot inspect local variables
Problem: Vim9: when debugging cannot inspect local variables. Solution: Make local variables available when debugging. https://github.com/vim/vim/commit/b69c6fb7b423ddc4578b093cb19257cad459dfae Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--src/nvim/debugger.c2
-rw-r--r--test/old/testdir/test_debugger.vim15
2 files changed, 10 insertions, 7 deletions
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index 31aad11d60..9bd2238c25 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -230,7 +230,7 @@ void do_debug(char *cmd)
}
if (last_cmd != 0) {
- // Execute debug command: decided where to break next and return.
+ // Execute debug command: decide where to break next and return.
switch (last_cmd) {
case CMD_CONT:
debug_break_level = -1;
diff --git a/test/old/testdir/test_debugger.vim b/test/old/testdir/test_debugger.vim
index 6b9fc9033b..3da4c66f32 100644
--- a/test/old/testdir/test_debugger.vim
+++ b/test/old/testdir/test_debugger.vim
@@ -892,6 +892,7 @@ func Test_Backtrace_DefFunction()
enddef
def g:GlobalFunction()
+ var some = "some var"
CallAFunction()
enddef
@@ -923,19 +924,21 @@ func Test_Backtrace_DefFunction()
\ ':debug call GlobalFunction()',
\ ['cmd: call GlobalFunction()'])
- call RunDbgCmd(buf, 'step', ['line 1: CallAFunction()'])
+ call RunDbgCmd(buf, 'step', ['line 1: var some = "some var"'])
+ call RunDbgCmd(buf, 'step', ['line 2: CallAFunction()'])
+ call RunDbgCmd(buf, 'echo some', ['some var'])
- " FIXME: not quite right
call RunDbgCmd(buf, 'backtrace', [
\ '\V>backtrace',
\ '\V->0 function GlobalFunction',
- \ '\Vline 1: CallAFunction()',
+ \ '\Vline 2: CallAFunction()',
\ ],
\ #{match: 'pattern'})
call RunDbgCmd(buf, 'step', ['line 1: SourceAnotherFile()'])
call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
- " FIXME: repeated line
+ " Repeated line, because we fist are in the compiled function before the
+ " EXEC and then in do_cmdline() before the :source command.
call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
call RunDbgCmd(buf, 'step', ['line 1: vim9script'])
call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number'])
@@ -945,7 +948,7 @@ func Test_Backtrace_DefFunction()
call RunDbgCmd(buf, 'step', ['line 14: File2Function()'])
call RunDbgCmd(buf, 'backtrace', [
\ '\V>backtrace',
- \ '\V 3 function GlobalFunction[1]',
+ \ '\V 3 function GlobalFunction[2]',
\ '\V 2 <SNR>\.\*_CallAFunction[1]',
\ '\V 1 <SNR>\.\*_SourceAnotherFile[1]',
\ '\V->0 script ' .. getcwd() .. '/Xtest2.vim',
@@ -956,7 +959,7 @@ func Test_Backtrace_DefFunction()
call RunDbgCmd(buf, 'next', ['line 15: End of sourced file'])
call RunDbgCmd(buf, 'backtrace', [
\ '\V>backtrace',
- \ '\V 3 function GlobalFunction[1]',
+ \ '\V 3 function GlobalFunction[2]',
\ '\V 2 <SNR>\.\*_CallAFunction[1]',
\ '\V 1 <SNR>\.\*_SourceAnotherFile[1]',
\ '\V->0 script ' .. getcwd() .. '/Xtest2.vim',