Mercurial > vim
comparison src/testdir/test_debugger.vim @ 24918:f11779c1d123 v8.2.2996
patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Commit: https://github.com/vim/vim/commit/b69c6fb7b423ddc4578b093cb19257cad459dfae
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 14 20:40:37 2021 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 14 Jun 2021 20:45:03 +0200 |
parents | e61a2085c89b |
children | afaa7f3aae56 |
comparison
equal
deleted
inserted
replaced
24917:71d44d317212 | 24918:f11779c1d123 |
---|---|
851 SourceAnotherFile() | 851 SourceAnotherFile() |
852 File2Function() | 852 File2Function() |
853 enddef | 853 enddef |
854 | 854 |
855 def g:GlobalFunction() | 855 def g:GlobalFunction() |
856 var some = "some var" | |
856 CallAFunction() | 857 CallAFunction() |
857 enddef | 858 enddef |
858 | 859 |
859 defcompile | 860 defcompile |
860 END | 861 END |
882 | 883 |
883 call RunDbgCmd(buf, | 884 call RunDbgCmd(buf, |
884 \ ':debug call GlobalFunction()', | 885 \ ':debug call GlobalFunction()', |
885 \ ['cmd: call GlobalFunction()']) | 886 \ ['cmd: call GlobalFunction()']) |
886 | 887 |
887 call RunDbgCmd(buf, 'step', ['line 1: CallAFunction()']) | 888 call RunDbgCmd(buf, 'step', ['line 1: var some = "some var"']) |
888 | 889 call RunDbgCmd(buf, 'step', ['line 2: CallAFunction()']) |
889 " FIXME: not quite right | 890 call RunDbgCmd(buf, 'echo some', ['some var']) |
891 | |
890 call RunDbgCmd(buf, 'backtrace', [ | 892 call RunDbgCmd(buf, 'backtrace', [ |
891 \ '\V>backtrace', | 893 \ '\V>backtrace', |
892 \ '\V->0 function GlobalFunction', | 894 \ '\V->0 function GlobalFunction', |
893 \ '\Vline 1: CallAFunction()', | 895 \ '\Vline 2: CallAFunction()', |
894 \ ], | 896 \ ], |
895 \ #{match: 'pattern'}) | 897 \ #{match: 'pattern'}) |
896 | 898 |
897 call RunDbgCmd(buf, 'step', ['line 1: SourceAnotherFile()']) | 899 call RunDbgCmd(buf, 'step', ['line 1: SourceAnotherFile()']) |
898 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim']) | 900 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim']) |
899 " FIXME: repeated line | 901 " Repeated line, because we fist are in the compiled function before the |
902 " EXEC and then in do_cmdline() before the :source command. | |
900 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim']) | 903 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim']) |
901 call RunDbgCmd(buf, 'step', ['line 1: vim9script']) | 904 call RunDbgCmd(buf, 'step', ['line 1: vim9script']) |
902 call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number']) | 905 call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number']) |
903 call RunDbgCmd(buf, 'step', ['line 9: export def File2Function()']) | 906 call RunDbgCmd(buf, 'step', ['line 9: export def File2Function()']) |
904 call RunDbgCmd(buf, 'step', ['line 9: def File2Function()']) | 907 call RunDbgCmd(buf, 'step', ['line 9: def File2Function()']) |
905 call RunDbgCmd(buf, 'step', ['line 13: defcompile']) | 908 call RunDbgCmd(buf, 'step', ['line 13: defcompile']) |
906 call RunDbgCmd(buf, 'step', ['line 14: File2Function()']) | 909 call RunDbgCmd(buf, 'step', ['line 14: File2Function()']) |
907 call RunDbgCmd(buf, 'backtrace', [ | 910 call RunDbgCmd(buf, 'backtrace', [ |
908 \ '\V>backtrace', | 911 \ '\V>backtrace', |
909 \ '\V 3 function GlobalFunction[1]', | 912 \ '\V 3 function GlobalFunction[2]', |
910 \ '\V 2 <SNR>\.\*_CallAFunction[1]', | 913 \ '\V 2 <SNR>\.\*_CallAFunction[1]', |
911 \ '\V 1 <SNR>\.\*_SourceAnotherFile[1]', | 914 \ '\V 1 <SNR>\.\*_SourceAnotherFile[1]', |
912 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim', | 915 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim', |
913 \ '\Vline 14: File2Function()'], | 916 \ '\Vline 14: File2Function()'], |
914 \ #{match: 'pattern'}) | 917 \ #{match: 'pattern'}) |
915 | 918 |
916 " Don't step into compiled functions... | 919 " Don't step into compiled functions... |
917 call RunDbgCmd(buf, 'next', ['line 15: End of sourced file']) | 920 call RunDbgCmd(buf, 'next', ['line 15: End of sourced file']) |
918 call RunDbgCmd(buf, 'backtrace', [ | 921 call RunDbgCmd(buf, 'backtrace', [ |
919 \ '\V>backtrace', | 922 \ '\V>backtrace', |
920 \ '\V 3 function GlobalFunction[1]', | 923 \ '\V 3 function GlobalFunction[2]', |
921 \ '\V 2 <SNR>\.\*_CallAFunction[1]', | 924 \ '\V 2 <SNR>\.\*_CallAFunction[1]', |
922 \ '\V 1 <SNR>\.\*_SourceAnotherFile[1]', | 925 \ '\V 1 <SNR>\.\*_SourceAnotherFile[1]', |
923 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim', | 926 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim', |
924 \ '\Vline 15: End of sourced file'], | 927 \ '\Vline 15: End of sourced file'], |
925 \ #{match: 'pattern'}) | 928 \ #{match: 'pattern'}) |