comparison src/testdir/test_debugger.vim @ 24895:e61a2085c89b v8.2.2985

patch 8.2.2985: Vim9: a compiled function cannot be debugged Commit: https://github.com/vim/vim/commit/e99d422bbd3e47620915bf89671673f0711671b4 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 13 14:01:26 2021 +0200 patch 8.2.2985: Vim9: a compiled function cannot be debugged Problem: Vim9: a compiled function cannot be debugged. Solution: Add initial debugging support.
author Bram Moolenaar <Bram@vim.org>
date Sun, 13 Jun 2021 14:15:04 +0200
parents b545334ae654
children f11779c1d123
comparison
equal deleted inserted replaced
24894:6270bfeab91f 24895:e61a2085c89b
882 882
883 call RunDbgCmd(buf, 883 call RunDbgCmd(buf,
884 \ ':debug call GlobalFunction()', 884 \ ':debug call GlobalFunction()',
885 \ ['cmd: call GlobalFunction()']) 885 \ ['cmd: call GlobalFunction()'])
886 886
887 " FIXME: Vim9 lines are not debugged! 887 call RunDbgCmd(buf, 'step', ['line 1: CallAFunction()'])
888
889 " FIXME: not quite right
890 call RunDbgCmd(buf, 'backtrace', [
891 \ '\V>backtrace',
892 \ '\V->0 function GlobalFunction',
893 \ '\Vline 1: CallAFunction()',
894 \ ],
895 \ #{match: 'pattern'})
896
897 call RunDbgCmd(buf, 'step', ['line 1: SourceAnotherFile()'])
898 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
899 " FIXME: repeated line
888 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim']) 900 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
889
890 " But they do appear in the backtrace
891 call RunDbgCmd(buf, 'backtrace', [
892 \ '\V>backtrace',
893 \ '\V 2 function GlobalFunction[1]',
894 \ '\V 1 <SNR>\.\*_CallAFunction[1]',
895 \ '\V->0 <SNR>\.\*_SourceAnotherFile',
896 \ '\Vline 1: source Xtest2.vim'],
897 \ #{match: 'pattern'})
898
899
900 call RunDbgCmd(buf, 'step', ['line 1: vim9script']) 901 call RunDbgCmd(buf, 'step', ['line 1: vim9script'])
901 call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number']) 902 call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number'])
902 call RunDbgCmd(buf, 'step', ['line 9: export def File2Function()']) 903 call RunDbgCmd(buf, 'step', ['line 9: export def File2Function()'])
903 call RunDbgCmd(buf, 'step', ['line 9: def File2Function()']) 904 call RunDbgCmd(buf, 'step', ['line 9: def File2Function()'])
904 call RunDbgCmd(buf, 'step', ['line 13: defcompile']) 905 call RunDbgCmd(buf, 'step', ['line 13: defcompile'])
911 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim', 912 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim',
912 \ '\Vline 14: File2Function()'], 913 \ '\Vline 14: File2Function()'],
913 \ #{match: 'pattern'}) 914 \ #{match: 'pattern'})
914 915
915 " Don't step into compiled functions... 916 " Don't step into compiled functions...
916 call RunDbgCmd(buf, 'step', ['line 15: End of sourced file']) 917 call RunDbgCmd(buf, 'next', ['line 15: End of sourced file'])
917 call RunDbgCmd(buf, 'backtrace', [ 918 call RunDbgCmd(buf, 'backtrace', [
918 \ '\V>backtrace', 919 \ '\V>backtrace',
919 \ '\V 3 function GlobalFunction[1]', 920 \ '\V 3 function GlobalFunction[1]',
920 \ '\V 2 <SNR>\.\*_CallAFunction[1]', 921 \ '\V 2 <SNR>\.\*_CallAFunction[1]',
921 \ '\V 1 <SNR>\.\*_SourceAnotherFile[1]', 922 \ '\V 1 <SNR>\.\*_SourceAnotherFile[1]',
922 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim', 923 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim',
923 \ '\Vline 15: End of sourced file'], 924 \ '\Vline 15: End of sourced file'],
924 \ #{match: 'pattern'}) 925 \ #{match: 'pattern'})
925
926 926
927 call StopVimInTerminal(buf) 927 call StopVimInTerminal(buf)
928 call delete('Xtest1.vim') 928 call delete('Xtest1.vim')
929 call delete('Xtest2.vim') 929 call delete('Xtest2.vim')
930 endfunc 930 endfunc
1114 call RunDbgCmd(buf, 1114 call RunDbgCmd(buf,
1115 \ 'echo s:file1_var', 1115 \ 'echo s:file1_var',
1116 \ [ 'E121: Undefined variable: s:file1_var' ] ) 1116 \ [ 'E121: Undefined variable: s:file1_var' ] )
1117 call RunDbgCmd(buf, 'echo s:file2_var', [ 'file2' ] ) 1117 call RunDbgCmd(buf, 'echo s:file2_var', [ 'file2' ] )
1118 1118
1119 call RunDbgCmd(buf, 'cont')
1119 call StopVimInTerminal(buf) 1120 call StopVimInTerminal(buf)
1120 call delete('Xtest1.vim') 1121 call delete('Xtest1.vim')
1121 call delete('Xtest2.vim') 1122 call delete('Xtest2.vim')
1122 endfunc 1123 endfunc
1123 1124