summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-06-13 14:01:26 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-13 14:01:26 +0200
commite99d422bbd3e47620915bf89671673f0711671b4 (patch)
treeda9d46ec8f793ae3f70ddcd229bc4a34122a3170 /src/testdir
parente6174fd58d459722847c76f8c5aa1b08a49c3e0d (diff)
downloadvim-git-e99d422bbd3e47620915bf89671673f0711671b4.tar.gz
patch 8.2.2985: Vim9: a compiled function cannot be debuggedv8.2.2985
Problem: Vim9: a compiled function cannot be debugged. Solution: Add initial debugging support.
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_debugger.vim21
-rw-r--r--src/testdir/test_vim9_disassemble.vim16
2 files changed, 26 insertions, 11 deletions
diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim
index 029b9dbc9..ed4baccf1 100644
--- a/src/testdir/test_debugger.vim
+++ b/src/testdir/test_debugger.vim
@@ -884,19 +884,20 @@ func Test_Backtrace_DefFunction()
\ ':debug call GlobalFunction()',
\ ['cmd: call GlobalFunction()'])
- " FIXME: Vim9 lines are not debugged!
- call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
+ call RunDbgCmd(buf, 'step', ['line 1: CallAFunction()'])
- " But they do appear in the backtrace
+ " FIXME: not quite right
call RunDbgCmd(buf, 'backtrace', [
\ '\V>backtrace',
- \ '\V 2 function GlobalFunction[1]',
- \ '\V 1 <SNR>\.\*_CallAFunction[1]',
- \ '\V->0 <SNR>\.\*_SourceAnotherFile',
- \ '\Vline 1: source Xtest2.vim'],
+ \ '\V->0 function GlobalFunction',
+ \ '\Vline 1: CallAFunction()',
+ \ ],
\ #{match: 'pattern'})
-
+ call RunDbgCmd(buf, 'step', ['line 1: SourceAnotherFile()'])
+ call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
+ " FIXME: repeated line
+ 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'])
call RunDbgCmd(buf, 'step', ['line 9: export def File2Function()'])
@@ -913,7 +914,7 @@ func Test_Backtrace_DefFunction()
\ #{match: 'pattern'})
" Don't step into compiled functions...
- call RunDbgCmd(buf, 'step', ['line 15: End of sourced file'])
+ call RunDbgCmd(buf, 'next', ['line 15: End of sourced file'])
call RunDbgCmd(buf, 'backtrace', [
\ '\V>backtrace',
\ '\V 3 function GlobalFunction[1]',
@@ -923,7 +924,6 @@ func Test_Backtrace_DefFunction()
\ '\Vline 15: End of sourced file'],
\ #{match: 'pattern'})
-
call StopVimInTerminal(buf)
call delete('Xtest1.vim')
call delete('Xtest2.vim')
@@ -1116,6 +1116,7 @@ func Test_debug_backtrace_level()
\ [ 'E121: Undefined variable: s:file1_var' ] )
call RunDbgCmd(buf, 'echo s:file2_var', [ 'file2' ] )
+ call RunDbgCmd(buf, 'cont')
call StopVimInTerminal(buf)
call delete('Xtest1.vim')
call delete('Xtest2.vim')
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index 965399bca..e1ed6754d 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -2153,7 +2153,7 @@ def Test_profiled()
if !has('profile')
MissingFeature 'profile'
endif
- var res = execute('disass! s:Profiled')
+ var res = execute('disass profile s:Profiled')
assert_match('<SNR>\d*_Profiled\_s*' ..
'echo "profiled"\_s*' ..
'\d PROFILE START line 1\_s*' ..
@@ -2168,6 +2168,20 @@ def Test_profiled()
res)
enddef
+def Test_debugged()
+ var res = execute('disass debug s:Profiled')
+ assert_match('<SNR>\d*_Profiled\_s*' ..
+ 'echo "profiled"\_s*' ..
+ '\d DEBUG line 1\_s*' ..
+ '\d PUSHS "profiled"\_s*' ..
+ '\d ECHO 1\_s*' ..
+ 'return "done"\_s*' ..
+ '\d DEBUG line 2\_s*' ..
+ '\d PUSHS "done"\_s*' ..
+ '\d RETURN\_s*',
+ res)
+enddef
+
def s:EchoMessages()
echohl ErrorMsg | echom v:exception | echohl NONE
enddef