annotate src/testdir/test_debugger.vim @ 29234:96ff6c230a66 v8.2.5136

patch 8.2.5136: debugger test fails when run with valgrind Commit: https://github.com/vim/vim/commit/e366ed4f2c6fa8cb663f1b9599b39d57ddbd8a2a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 19 20:13:56 2022 +0100 patch 8.2.5136: debugger test fails when run with valgrind Problem: Debugger test fails when run with valgrind. Solution: Wait longer when using valgrind.
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jun 2022 21:15:03 +0200
parents 723c7d940cba
children a9b2609186bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for the Vim script debug commands
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 source shared.vim
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 source screendump.vim
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
5 source check.vim
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
7 CheckRunVimInTerminal
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
8
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
9 func CheckCWD()
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
10 " Check that the longer lines don't wrap due to the length of the script name
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
11 " in cwd
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
12 let script_len = len( getcwd() .. '/Xtest1.vim' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
13 let longest_line = len( 'Breakpoint in "" line 1' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
14 if script_len > ( 75 - longest_line )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
15 throw 'Skipped: Your CWD has too many characters'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
16 endif
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
17 endfunc
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
18 command! -nargs=0 -bar CheckCWD call CheckCWD()
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
19
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
20 " "options" argument can contain:
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
21 " 'msec' - time to wait for a match
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
22 " 'match' - "pattern" to use "lines" as pattern instead of text
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
23 func CheckDbgOutput(buf, lines, options = {})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
24 " Verify the expected output
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
25 let lnum = 20 - len(a:lines)
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
26 let msec = get(a:options, 'msec', 1000)
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
27 for l in a:lines
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
28 if get(a:options, 'match', 'equal') ==# 'pattern'
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
29 call WaitForAssert({-> assert_match(l, term_getline(a:buf, lnum))}, msec)
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
30 else
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
31 call WaitForAssert({-> assert_equal(l, term_getline(a:buf, lnum))}, msec)
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
32 endif
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
33 let lnum += 1
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
34 endfor
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
35 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
36
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 " Run a Vim debugger command
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 " If the expected output argument is supplied, then check for it.
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 func RunDbgCmd(buf, cmd, ...)
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 call term_sendkeys(a:buf, a:cmd . "\r")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19651
diff changeset
41 call TermWait(a:buf)
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 if a:0 != 0
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
44 let options = #{match: 'equal'}
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
45 if a:0 > 1
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
46 call extend(options, a:2)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
47 endif
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
48 call CheckDbgOutput(a:buf, a:1, options)
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 endif
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 endfunc
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 " Debugger tests
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 func Test_Debugger()
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 " Create a Vim script with some functions
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
55 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
56 func Foo()
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
57 let var1 = 1
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
58 let var2 = Bar(var1) + 9
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
59 return var2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
60 endfunc
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
61 func Bar(var)
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
62 let var1 = 2 + a:var
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
63 let var2 = Bazz(var1) + 4
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
64 return var2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
65 endfunc
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
66 func Bazz(var)
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
67 try
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
68 let var1 = 3 + a:var
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
69 let var3 = "another var"
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
70 let var3 = "value2"
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
71 catch
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
72 let var4 = "exception"
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
73 endtry
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
74 return var1
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
75 endfunc
28033
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
76 def Vim9Func()
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
77 for cmd in ['confirm', 'xxxxxxx']
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
78 for _ in [1, 2]
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
79 echo cmd
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
80 endfor
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
81 endfor
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
82 enddef
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
83 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
84 call writefile(lines, 'Xtest.vim')
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 " Start Vim in a terminal
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 let buf = RunVimInTerminal('-S Xtest.vim', {})
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 " Start the Vim debugger
16920
8d91579414b8 patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16372
diff changeset
90 call RunDbgCmd(buf, ':debug echo Foo()', ['cmd: echo Foo()'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 " Create a few stack frames by stepping through functions
16920
8d91579414b8 patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16372
diff changeset
93 call RunDbgCmd(buf, 'step', ['line 1: let var1 = 1'])
8d91579414b8 patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16372
diff changeset
94 call RunDbgCmd(buf, 'step', ['line 2: let var2 = Bar(var1) + 9'])
8d91579414b8 patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16372
diff changeset
95 call RunDbgCmd(buf, 'step', ['line 1: let var1 = 2 + a:var'])
8d91579414b8 patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16372
diff changeset
96 call RunDbgCmd(buf, 'step', ['line 2: let var2 = Bazz(var1) + 4'])
8d91579414b8 patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16372
diff changeset
97 call RunDbgCmd(buf, 'step', ['line 1: try'])
8d91579414b8 patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16372
diff changeset
98 call RunDbgCmd(buf, 'step', ['line 2: let var1 = 3 + a:var'])
8d91579414b8 patch 8.1.1461: tests do not run or are not reliable on some systems
Bram Moolenaar <Bram@vim.org>
parents: 16372
diff changeset
99 call RunDbgCmd(buf, 'step', ['line 3: let var3 = "another var"'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 " check backtrace
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 call RunDbgCmd(buf, 'backtrace', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 \ ' 2 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 \ ' 1 Bar[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 \ '->0 Bazz',
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
106 \ 'line 3: let var3 = "another var"'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 " Check variables in different stack frames
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 call RunDbgCmd(buf, 'echo var1', ['6'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 call RunDbgCmd(buf, 'up')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 call RunDbgCmd(buf, 'back', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 \ ' 2 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 \ '->1 Bar[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 \ ' 0 Bazz',
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
116 \ 'line 3: let var3 = "another var"'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 call RunDbgCmd(buf, 'echo var1', ['3'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 call RunDbgCmd(buf, 'u')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 call RunDbgCmd(buf, 'bt', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 \ '->2 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 \ ' 1 Bar[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 \ ' 0 Bazz',
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
124 \ 'line 3: let var3 = "another var"'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 call RunDbgCmd(buf, 'echo var1', ['1'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 " Undefined variables
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 call RunDbgCmd(buf, 'step')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 call RunDbgCmd(buf, 'frame 2')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 call RunDbgCmd(buf, 'echo var3', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 \ 'Error detected while processing function Foo[2]..Bar[2]..Bazz:',
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
132 \ 'line 4:',
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 \ 'E121: Undefined variable: var3'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 " var3 is defined in this level with some other value
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 call RunDbgCmd(buf, 'fr 0')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 call RunDbgCmd(buf, 'echo var3', ['another var'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 call RunDbgCmd(buf, 'step')
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
140 call RunDbgCmd(buf, '')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
141 call RunDbgCmd(buf, '')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
142 call RunDbgCmd(buf, '')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
143 call RunDbgCmd(buf, '')
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 call RunDbgCmd(buf, 'step', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 \ 'function Foo[2]..Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 \ 'line 3: End of function'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 call RunDbgCmd(buf, 'up')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 " Undefined var2
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 call RunDbgCmd(buf, 'echo var2', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 \ 'Error detected while processing function Foo[2]..Bar:',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 \ 'line 3:',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 \ 'E121: Undefined variable: var2'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 " Var2 is defined with 10
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 call RunDbgCmd(buf, 'down')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 call RunDbgCmd(buf, 'echo var2', ['10'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 " Backtrace movements
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 call RunDbgCmd(buf, 'b', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161 \ ' 1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 \ '->0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 \ 'line 3: End of function'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 " next command cannot go down, we are on bottom
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 call RunDbgCmd(buf, 'down', ['frame is zero'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 call RunDbgCmd(buf, 'up')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 " next command cannot go up, we are on top
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 call RunDbgCmd(buf, 'up', ['frame at highest level: 1'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 call RunDbgCmd(buf, 'where', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 \ '->1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 \ ' 0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 \ 'line 3: End of function'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 " fil is not frame or finish, it is file
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 call RunDbgCmd(buf, 'fil', ['"[No Name]" --No lines in buffer--'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 " relative backtrace movement
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 call RunDbgCmd(buf, 'fr -1')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 call RunDbgCmd(buf, 'frame', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 \ ' 1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 \ '->0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 \ 'line 3: End of function'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 call RunDbgCmd(buf, 'fr +1')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 call RunDbgCmd(buf, 'fram', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 \ '->1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 \ ' 0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 \ 'line 3: End of function'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 " go beyond limits does not crash
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 call RunDbgCmd(buf, 'fr 100', ['frame at highest level: 1'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 call RunDbgCmd(buf, 'fra', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 \ '->1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 \ ' 0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 \ 'line 3: End of function'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 call RunDbgCmd(buf, 'frame -40', ['frame is zero'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 call RunDbgCmd(buf, 'fram', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 \ ' 1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 \ '->0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 \ 'line 3: End of function'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 " final result 19
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 call RunDbgCmd(buf, 'cont', ['19'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 " breakpoints tests
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 " Start a debug session, so that reading the last line from the terminal
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 " works properly.
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
212 call RunDbgCmd(buf, ':debug echo Foo()', ['cmd: echo Foo()'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 " No breakpoints
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 call RunDbgCmd(buf, 'breakl', ['No breakpoints defined'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 " Place some breakpoints
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 call RunDbgCmd(buf, 'breaka func Bar')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 call RunDbgCmd(buf, 'breaklis', [' 1 func Bar line 1'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 call RunDbgCmd(buf, 'breakadd func 3 Bazz')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 call RunDbgCmd(buf, 'breaklist', [' 1 func Bar line 1',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 \ ' 2 func Bazz line 3'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 " Check whether the breakpoints are hit
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 call RunDbgCmd(buf, 'cont', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 \ 'Breakpoint in "Bar" line 1',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 \ 'function Foo[2]..Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 \ 'line 1: let var1 = 2 + a:var'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 call RunDbgCmd(buf, 'cont', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 \ 'Breakpoint in "Bazz" line 3',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 \ 'function Foo[2]..Bar[2]..Bazz',
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
232 \ 'line 3: let var3 = "another var"'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 " Delete the breakpoints
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 call RunDbgCmd(buf, 'breakd 1')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 call RunDbgCmd(buf, 'breakli', [' 2 func Bazz line 3'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 call RunDbgCmd(buf, 'breakdel func 3 Bazz')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 call RunDbgCmd(buf, 'breakl', ['No breakpoints defined'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 call RunDbgCmd(buf, 'cont')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 " Make sure the breakpoints are removed
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 call RunDbgCmd(buf, ':echo Foo()', ['19'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 " Delete a non-existing breakpoint
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 call RunDbgCmd(buf, ':breakdel 2', ['E161: Breakpoint not found: 2'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 " Expression breakpoint
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 call RunDbgCmd(buf, ':breakadd func 2 Bazz')
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
250 call RunDbgCmd(buf, ':echo Bazz(1)', [
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
251 \ 'Entering Debug mode. Type "cont" to continue.',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
252 \ 'function Bazz',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
253 \ 'line 2: let var1 = 3 + a:var'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
254 call RunDbgCmd(buf, 'step')
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 call RunDbgCmd(buf, 'step')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 call RunDbgCmd(buf, 'breaka expr var3')
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
257 call RunDbgCmd(buf, 'breakl', [' 3 func Bazz line 2',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
258 \ ' 4 expr var3'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
259 call RunDbgCmd(buf, 'cont', ['Breakpoint in "Bazz" line 5',
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 \ 'Oldval = "''another var''"',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261 \ 'Newval = "''value2''"',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 \ 'function Bazz',
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
263 \ 'line 5: catch'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 call RunDbgCmd(buf, 'breakdel *')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266 call RunDbgCmd(buf, 'breakl', ['No breakpoints defined'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
268 " Check for error cases
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
269 call RunDbgCmd(buf, 'breakadd abcd', [
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
270 \ 'Error detected while processing function Bazz:',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
271 \ 'line 5:',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
272 \ 'E475: Invalid argument: abcd'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
273 call RunDbgCmd(buf, 'breakadd func', ['E475: Invalid argument: func'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
274 call RunDbgCmd(buf, 'breakadd func 2', ['E475: Invalid argument: func 2'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
275 call RunDbgCmd(buf, 'breaka func a()', ['E475: Invalid argument: func a()'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
276 call RunDbgCmd(buf, 'breakd abcd', ['E475: Invalid argument: abcd'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
277 call RunDbgCmd(buf, 'breakd func', ['E475: Invalid argument: func'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
278 call RunDbgCmd(buf, 'breakd func a()', ['E475: Invalid argument: func a()'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
279 call RunDbgCmd(buf, 'breakd func a', ['E161: Breakpoint not found: func a'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
280 call RunDbgCmd(buf, 'breakd expr', ['E475: Invalid argument: expr'])
25767
dfa045d2cc89 patch 8.2.3419: a failing debug expression may make Vim unusable
Bram Moolenaar <Bram@vim.org>
parents: 25763
diff changeset
281 call RunDbgCmd(buf, 'breakd expr x', ['E161: Breakpoint not found: expr x'])
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
282
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283 " finish the current function
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
284 call RunDbgCmd(buf, 'finish', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 \ 'function Bazz',
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
286 \ 'line 8: End of function'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
287 call RunDbgCmd(buf, 'cont')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
288
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
289 " Test for :next
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
290 call RunDbgCmd(buf, ':debug echo Bar(1)')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
291 call RunDbgCmd(buf, 'step')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
292 call RunDbgCmd(buf, 'next')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
293 call RunDbgCmd(buf, '', [
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
294 \ 'function Bar',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
295 \ 'line 3: return var2'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
296 call RunDbgCmd(buf, 'c')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
297
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
298 " Test for :interrupt
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
299 call RunDbgCmd(buf, ':debug echo Bazz(1)')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
300 call RunDbgCmd(buf, 'step')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
301 call RunDbgCmd(buf, 'step')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
302 call RunDbgCmd(buf, 'interrupt', [
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
303 \ 'Exception thrown: Vim:Interrupt',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
304 \ 'function Bazz',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
305 \ 'line 5: catch'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
306 call RunDbgCmd(buf, 'c')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
307
28033
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
308 " Test showing local variable in :def function
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
309 call RunDbgCmd(buf, ':breakadd func 2 Vim9Func')
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
310 call RunDbgCmd(buf, ':call Vim9Func()', ['line 2: for _ in [1, 2]'])
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
311 call RunDbgCmd(buf, 'next', ['line 2: for _ in [1, 2]'])
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
312 call RunDbgCmd(buf, 'echo cmd', ['confirm'])
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
313 call RunDbgCmd(buf, 'breakdel *')
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
314 call RunDbgCmd(buf, 'cont')
73f4d1e479f2 patch 8.2.4541: Crash in debugger when a variable is not available
Bram Moolenaar <Bram@vim.org>
parents: 27457
diff changeset
315
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
316 " Test for :quit
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
317 call RunDbgCmd(buf, ':debug echo Foo()')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
318 call RunDbgCmd(buf, 'breakdel *')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
319 call RunDbgCmd(buf, 'breakadd func 3 Foo')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
320 call RunDbgCmd(buf, 'breakadd func 3 Bazz')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
321 call RunDbgCmd(buf, 'cont', [
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
322 \ 'Breakpoint in "Bazz" line 3',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
323 \ 'function Foo[2]..Bar[2]..Bazz',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
324 \ 'line 3: let var3 = "another var"'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
325 call RunDbgCmd(buf, 'quit', [
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
326 \ 'Breakpoint in "Foo" line 3',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
327 \ 'function Foo',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
328 \ 'line 3: return var2'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
329 call RunDbgCmd(buf, 'breakdel *')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
330 call RunDbgCmd(buf, 'quit')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
331 call RunDbgCmd(buf, 'enew! | only!')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
332
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
333 call StopVimInTerminal(buf)
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
334 endfunc
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
335
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
336 func Test_Debugger_breakadd()
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
337 " Tests for :breakadd file and :breakadd here
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
338 " Breakpoints should be set before sourcing the file
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
339
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
340 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
341 let var1 = 10
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
342 let var2 = 20
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
343 let var3 = 30
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
344 let var4 = 40
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
345 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
346 call writefile(lines, 'Xtest.vim')
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
347
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
348 " Start Vim in a terminal
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
349 let buf = RunVimInTerminal('Xtest.vim', {})
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
350 call RunDbgCmd(buf, ':breakadd file 2 Xtest.vim')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
351 call RunDbgCmd(buf, ':4 | breakadd here')
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
352 call RunDbgCmd(buf, ':source Xtest.vim', ['line 2: let var2 = 20'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
353 call RunDbgCmd(buf, 'cont', ['line 4: let var4 = 40'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354 call RunDbgCmd(buf, 'cont')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
355
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 call StopVimInTerminal(buf)
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
357
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
358 call delete('Xtest.vim')
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
359 %bw!
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
360
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
361 call assert_fails('breakadd here', 'E32:')
22375
595ea7f099cd patch 8.2.1736: failure to compile a pattern not tested much
Bram Moolenaar <Bram@vim.org>
parents: 21917
diff changeset
362 call assert_fails('breakadd file Xtest.vim /\)/', 'E55:')
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
363 endfunc
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
364
28570
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
365 " Test for expression breakpoint set using ":breakadd expr <expr>"
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
366 func Test_Debugger_breakadd_expr()
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
367 let lines =<< trim END
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
368 let g:Xtest_var += 1
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
369 END
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
370 call writefile(lines, 'Xtest.vim')
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
371
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
372 " Start Vim in a terminal
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
373 let buf = RunVimInTerminal('Xtest.vim', {})
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
374 call RunDbgCmd(buf, ':let g:Xtest_var = 10')
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
375 call RunDbgCmd(buf, ':breakadd expr g:Xtest_var')
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
376 call RunDbgCmd(buf, ':source %')
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
377 let expected =<< eval trim END
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
378 Oldval = "10"
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
379 Newval = "11"
28718
723c7d940cba patch 8.2.4883: string interpolation only works in heredoc
Bram Moolenaar <Bram@vim.org>
parents: 28570
diff changeset
380 {fnamemodify('Xtest.vim', ':p')}
28570
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
381 line 1: let g:Xtest_var += 1
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
382 END
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
383 call RunDbgCmd(buf, ':source %', expected)
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
384 call RunDbgCmd(buf, 'cont')
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
385 let expected =<< eval trim END
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
386 Oldval = "11"
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
387 Newval = "12"
28718
723c7d940cba patch 8.2.4883: string interpolation only works in heredoc
Bram Moolenaar <Bram@vim.org>
parents: 28570
diff changeset
388 {fnamemodify('Xtest.vim', ':p')}
28570
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
389 line 1: let g:Xtest_var += 1
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
390 END
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
391 call RunDbgCmd(buf, ':source %', expected)
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
392
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
393 call StopVimInTerminal(buf)
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
394 call delete('Xtest.vim')
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
395 endfunc
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
396
35e24d9de858 patch 8.2.4809: various things no6 properly tested
Bram Moolenaar <Bram@vim.org>
parents: 28033
diff changeset
397 def Test_Debugger_breakadd_vim9_expr()
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
398 var lines =<< trim END
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
399 vim9script
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
400 func g:EarlyFunc()
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
401 endfunc
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
402 breakadd expr DoesNotExist()
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
403 func g:LaterFunc()
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
404 endfunc
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
405 breakdel *
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
406 END
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
407 writefile(lines, 'Xtest.vim')
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
408
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
409 # Start Vim in a terminal
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
410 var buf = g:RunVimInTerminal('-S Xtest.vim', {wait_for_ruler: 0})
29234
96ff6c230a66 patch 8.2.5136: debugger test fails when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents: 28718
diff changeset
411 call g:TermWait(buf, g:RunningWithValgrind() ? 1000 : 50)
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
412
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
413 # Despite the failure the functions are defined
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
414 g:RunDbgCmd(buf, ':function g:EarlyFunc',
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
415 ['function EarlyFunc()', 'endfunction'], {match: 'pattern'})
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
416 g:RunDbgCmd(buf, ':function g:LaterFunc',
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
417 ['function LaterFunc()', 'endfunction'], {match: 'pattern'})
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
418
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
419 call g:StopVimInTerminal(buf)
25763
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
420 call delete('Xtest.vim')
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
421 enddef
5e7c96e9036d patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Bram Moolenaar <Bram@vim.org>
parents: 25719
diff changeset
422
26252
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
423 def Test_Debugger_break_at_return()
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
424 var lines =<< trim END
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
425 vim9script
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
426 def g:GetNum(): number
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
427 return 1
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
428 + 2
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
429 + 3
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
430 enddef
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
431 breakadd func GetNum
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
432 END
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
433 writefile(lines, 'Xtest.vim')
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
434
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
435 # Start Vim in a terminal
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
436 var buf = g:RunVimInTerminal('-S Xtest.vim', {wait_for_ruler: 0})
29234
96ff6c230a66 patch 8.2.5136: debugger test fails when run with valgrind
Bram Moolenaar <Bram@vim.org>
parents: 28718
diff changeset
437 call g:TermWait(buf, g:RunningWithValgrind() ? 1000 : 50)
26252
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
438
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
439 g:RunDbgCmd(buf, ':call GetNum()',
26252
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
440 ['line 1: return 1 + 2 + 3'], {match: 'pattern'})
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
441
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26982
diff changeset
442 call g:StopVimInTerminal(buf)
26252
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
443 call delete('Xtest.vim')
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
444 enddef
3d92646fe6c8 patch 8.2.3657: Vim9: debug text misses one line of return statement
Bram Moolenaar <Bram@vim.org>
parents: 26211
diff changeset
445
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
446 func Test_Backtrace_Through_Source()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
447 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
448 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
449 func SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
450 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
451 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
452
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
453 func CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
454 call SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
455 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
456 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
457
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
458 func GlobalFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
459 call CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
460 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
461 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
462 call writefile(file1, 'Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
463
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
464 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
465 func DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
466 echo "DoAThing"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
467 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
468
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
469 func File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
470 call DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
471 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
472
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
473 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
474 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
475 call writefile(file2, 'Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
476
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
477 let buf = RunVimInTerminal('-S Xtest1.vim', {})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
478
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
479 call RunDbgCmd(buf,
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
480 \ ':debug call GlobalFunction()',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
481 \ ['cmd: call GlobalFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
482 call RunDbgCmd(buf, 'step', ['line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
483
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
484 call RunDbgCmd(buf, 'backtrace', ['>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
485 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
486 \ 'line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
487
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
488 call RunDbgCmd(buf, 'step', ['line 1: call SourceAnotherFile()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
489 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
490
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
491 call RunDbgCmd(buf, 'backtrace', ['>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
492 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
493 \ ' 1 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
494 \ '->0 SourceAnotherFile',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
495 \ 'line 1: source Xtest2.vim'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
496
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
497 " Step into the 'source' command. Note that we print the full trace all the
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
498 " way though the source command.
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
499 call RunDbgCmd(buf, 'step', ['line 1: func DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
500 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
501 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
502 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
503 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
504 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
505 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
506 \ 'line 1: func DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
507
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
508 call RunDbgCmd( buf, 'up' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
509 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
510 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
511 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
512 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
513 \ '->1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
514 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
515 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
516
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
517 call RunDbgCmd( buf, 'up' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
518 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
519 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
520 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
521 \ '->2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
522 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
523 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
524 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
525
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
526 call RunDbgCmd( buf, 'up' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
527 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
528 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
529 \ '->3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
530 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
531 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
532 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
533 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
534
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
535 call RunDbgCmd( buf, 'up', [ 'frame at highest level: 3' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
536 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
537 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
538 \ '->3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
539 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
540 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
541 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
542 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
543
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
544 call RunDbgCmd( buf, 'down' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
545 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
546 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
547 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
548 \ '->2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
549 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
550 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
551 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
552
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
553 call RunDbgCmd( buf, 'down' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
554 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
555 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
556 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
557 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
558 \ '->1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
559 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
560 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
561
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
562 call RunDbgCmd( buf, 'down' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
563 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
564 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
565 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
566 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
567 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
568 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
569 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
570
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
571 call RunDbgCmd( buf, 'down', [ 'frame is zero' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
572
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25767
diff changeset
573 " step until we have another meaningful trace
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
574 call RunDbgCmd(buf, 'step', ['line 5: func File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
575 call RunDbgCmd(buf, 'step', ['line 9: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
576 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
577 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
578 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
579 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
580 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
581 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
582 \ 'line 9: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
583
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
584 call RunDbgCmd(buf, 'step', ['line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
585 call RunDbgCmd(buf, 'step', ['line 1: echo "DoAThing"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
586 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
587 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
588 \ ' 5 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
589 \ ' 4 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
590 \ ' 3 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
591 \ ' 2 script ' .. getcwd() .. '/Xtest2.vim[9]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
592 \ ' 1 function File2Function[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
593 \ '->0 DoAThing',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
594 \ 'line 1: echo "DoAThing"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
595
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
596 " Now, step (back to Xfile1.vim), and call the function _in_ Xfile2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
597 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
598 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
599 call RunDbgCmd(buf, 'step', ['line 10: End of sourced file'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
600 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
601 call RunDbgCmd(buf, 'step', ['line 2: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
602 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
603 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
604 \ ' 1 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
605 \ '->0 CallAFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
606 \ 'line 2: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
607
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
608 call RunDbgCmd(buf, 'step', ['line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
609 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
610 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
611 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
612 \ ' 1 CallAFunction[2]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
613 \ '->0 File2Function',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
614 \ 'line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
615
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
616 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
617 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
618 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
619 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
620
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
621 func Test_Backtrace_Autocmd()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
622 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
623 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
624 func SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
625 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
626 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
627
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
628 func CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
629 call SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
630 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
631 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
632
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
633 func GlobalFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
634 call CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
635 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
636
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
637 au User TestGlobalFunction :call GlobalFunction() | echo "Done"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
638 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
639 call writefile(file1, 'Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
640
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
641 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
642 func DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
643 echo "DoAThing"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
644 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
645
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
646 func File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
647 call DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
648 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
649
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
650 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
651 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
652 call writefile(file2, 'Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
653
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
654 let buf = RunVimInTerminal('-S Xtest1.vim', {})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
655
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
656 call RunDbgCmd(buf,
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
657 \ ':debug doautocmd User TestGlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
658 \ ['cmd: doautocmd User TestGlobalFunction'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
659 call RunDbgCmd(buf, 'step', ['cmd: call GlobalFunction() | echo "Done"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
660
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25767
diff changeset
661 " At this point the only thing in the stack is the autocommand
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
662 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
663 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
664 \ '->0 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
665 \ 'cmd: call GlobalFunction() | echo "Done"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
666
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
667 " And now we're back into the call stack
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
668 call RunDbgCmd(buf, 'step', ['line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
669 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
670 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
671 \ ' 1 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
672 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
673 \ 'line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
674
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
675 call RunDbgCmd(buf, 'step', ['line 1: call SourceAnotherFile()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
676 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
677
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
678 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
679 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
680 \ ' 3 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
681 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
682 \ ' 1 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
683 \ '->0 SourceAnotherFile',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
684 \ 'line 1: source Xtest2.vim'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
685
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
686 " Step into the 'source' command. Note that we print the full trace all the
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
687 " way though the source command.
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
688 call RunDbgCmd(buf, 'step', ['line 1: func DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
689 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
690 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
691 \ ' 4 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
692 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
693 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
694 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
695 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
696 \ 'line 1: func DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
697
21917
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
698 call RunDbgCmd( buf, 'up' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
699 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
700 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
701 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
702 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
703 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
704 \ '->1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
705 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
706 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
707
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
708 call RunDbgCmd( buf, 'up' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
709 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
710 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
711 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
712 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
713 \ '->2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
714 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
715 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
716 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
717
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
718 call RunDbgCmd( buf, 'up' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
719 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
720 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
721 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
722 \ '->3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
723 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
724 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
725 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
726 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
727
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
728 call RunDbgCmd( buf, 'up' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
729 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
730 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
731 \ '->4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
732 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
733 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
734 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
735 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
736 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
737
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
738 call RunDbgCmd( buf, 'up', [ 'frame at highest level: 4' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
739 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
740 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
741 \ '->4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
742 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
743 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
744 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
745 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
746 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
747
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
748 call RunDbgCmd( buf, 'down' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
749 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
750 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
751 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
752 \ '->3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
753 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
754 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
755 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
756 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
757
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
758
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
759 call RunDbgCmd( buf, 'down' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
760 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
761 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
762 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
763 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
764 \ '->2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
765 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
766 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
767 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
768
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
769 call RunDbgCmd( buf, 'down' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
770 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
771 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
772 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
773 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
774 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
775 \ '->1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
776 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
777 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
778
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
779 call RunDbgCmd( buf, 'down' )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
780 call RunDbgCmd( buf, 'backtrace', [
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
781 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
782 \ ' 4 User Autocommands for "TestGlobalFunction"',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
783 \ ' 3 function GlobalFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
784 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
785 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
786 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
787 \ 'line 1: func DoAThing()' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
788
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
789 call RunDbgCmd( buf, 'down', [ 'frame is zero' ] )
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
790
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25767
diff changeset
791 " step until we have another meaningful trace
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
792 call RunDbgCmd(buf, 'step', ['line 5: func File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
793 call RunDbgCmd(buf, 'step', ['line 9: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
794 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
795 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
796 \ ' 4 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
797 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
798 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
799 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
800 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
801 \ 'line 9: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
802
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
803 call RunDbgCmd(buf, 'step', ['line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
804 call RunDbgCmd(buf, 'step', ['line 1: echo "DoAThing"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
805 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
806 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
807 \ ' 6 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
808 \ ' 5 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
809 \ ' 4 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
810 \ ' 3 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
811 \ ' 2 script ' .. getcwd() .. '/Xtest2.vim[9]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
812 \ ' 1 function File2Function[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
813 \ '->0 DoAThing',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
814 \ 'line 1: echo "DoAThing"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
815
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
816 " Now, step (back to Xfile1.vim), and call the function _in_ Xfile2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
817 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
818 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
819 call RunDbgCmd(buf, 'step', ['line 10: End of sourced file'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
820 call RunDbgCmd(buf, 'step', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
821 call RunDbgCmd(buf, 'step', ['line 2: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
822 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
823 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
824 \ ' 2 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
825 \ ' 1 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
826 \ '->0 CallAFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
827 \ 'line 2: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
828
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
829 call RunDbgCmd(buf, 'step', ['line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
830 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
831 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
832 \ ' 3 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
833 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
834 \ ' 1 CallAFunction[2]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
835 \ '->0 File2Function',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
836 \ 'line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
837
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
838
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
839 " Now unwind so that we get back to the original autocommand (and the second
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
840 " cmd echo "Done")
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
841 call RunDbgCmd(buf, 'finish', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
842 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
843 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
844 \ ' 3 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
845 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
846 \ ' 1 CallAFunction[2]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
847 \ '->0 File2Function',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
848 \ 'line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
849
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
850 call RunDbgCmd(buf, 'finish', ['line 2: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
851 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
852 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
853 \ ' 2 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
854 \ ' 1 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
855 \ '->0 CallAFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
856 \ 'line 2: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
857
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
858 call RunDbgCmd(buf, 'finish', ['line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
859 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
860 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
861 \ ' 1 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
862 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
863 \ 'line 1: End of function'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
864
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
865 call RunDbgCmd(buf, 'step', ['cmd: echo "Done"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
866 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
867 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
868 \ '->0 User Autocommands for "TestGlobalFunction"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
869 \ 'cmd: echo "Done"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
870
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
871 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
872 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
873 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
874 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
875
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
876 func Test_Backtrace_CmdLine()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
877 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
878 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
879 func SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
880 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
881 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
882
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
883 func CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
884 call SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
885 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
886 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
887
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
888 func GlobalFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
889 call CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
890 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
891
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
892 au User TestGlobalFunction :call GlobalFunction() | echo "Done"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
893 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
894 call writefile(file1, 'Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
895
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
896 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
897 func DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
898 echo "DoAThing"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
899 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
900
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
901 func File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
902 call DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
903 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
904
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
905 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
906 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
907 call writefile(file2, 'Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
908
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
909 let buf = RunVimInTerminal(
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
910 \ '-S Xtest1.vim -c "debug call GlobalFunction()"',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
911 \ {'wait_for_ruler': 0})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
912
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
913 " Need to wait for the vim-in-terminal to be ready.
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
914 " With valgrind this can take quite long.
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
915 call CheckDbgOutput(buf, ['command line',
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
916 \ 'cmd: call GlobalFunction()'], #{msec: 5000})
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
917
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25767
diff changeset
918 " At this point the only thing in the stack is the cmdline
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
919 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
920 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
921 \ '->0 command line',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
922 \ 'cmd: call GlobalFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
923
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
924 " And now we're back into the call stack
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
925 call RunDbgCmd(buf, 'step', ['line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
926 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
927 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
928 \ ' 1 command line',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
929 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
930 \ 'line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
931
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
932 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
933 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
934 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
935 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
936
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
937 func Test_Backtrace_DefFunction()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
938 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
939 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
940 vim9script
26982
f15bf2470359 patch 8.2.4020: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26911
diff changeset
941 import './Xtest2.vim' as imp
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
942
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
943 def SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
944 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
945 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
946
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
947 def CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
948 SourceAnotherFile()
26982
f15bf2470359 patch 8.2.4020: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26911
diff changeset
949 imp.File2Function()
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
950 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
951
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
952 def g:GlobalFunction()
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
953 var some = "some var"
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
954 CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
955 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
956
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
957 defcompile
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
958 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
959 call writefile(file1, 'Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
960
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
961 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
962 vim9script
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
963
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
964 def DoAThing(): number
22486
4086a1708c83 patch 8.2.1791: Vim9: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
965 var a = 100 * 2
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
966 a += 3
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
967 return a
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
968 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
969
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
970 export def File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
971 DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
972 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
973
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
974 defcompile
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
975 File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
976 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
977 call writefile(file2, 'Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
978
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
979 let buf = RunVimInTerminal('-S Xtest1.vim', {})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
980
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
981 call RunDbgCmd(buf,
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
982 \ ':debug call GlobalFunction()',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
983 \ ['cmd: call GlobalFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
984
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
985 call RunDbgCmd(buf, 'step', ['line 1: var some = "some var"'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
986 call RunDbgCmd(buf, 'step', ['line 2: CallAFunction()'])
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
987 call RunDbgCmd(buf, 'echo some', ['some var'])
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
988
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
989 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
990 \ '\V>backtrace',
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
991 \ '\V->0 function GlobalFunction',
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
992 \ '\Vline 2: CallAFunction()',
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
993 \ ],
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
994 \ #{match: 'pattern'})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
995
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
996 call RunDbgCmd(buf, 'step', ['line 1: SourceAnotherFile()'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
997 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
26771
fc859aea8cec patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents: 26252
diff changeset
998 " Repeated line, because we first are in the compiled function before the
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
999 " EXEC and then in do_cmdline() before the :source command.
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
1000 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1001 call RunDbgCmd(buf, 'step', ['line 1: vim9script'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1002 call RunDbgCmd(buf, 'step', ['line 3: def DoAThing(): number'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1003 call RunDbgCmd(buf, 'step', ['line 9: export def File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1004 call RunDbgCmd(buf, 'step', ['line 9: def File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1005 call RunDbgCmd(buf, 'step', ['line 13: defcompile'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1006 call RunDbgCmd(buf, 'step', ['line 14: File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1007 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1008 \ '\V>backtrace',
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
1009 \ '\V 3 function GlobalFunction[2]',
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1010 \ '\V 2 <SNR>\.\*_CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1011 \ '\V 1 <SNR>\.\*_SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1012 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1013 \ '\Vline 14: File2Function()'],
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1014 \ #{match: 'pattern'})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1015
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1016 " Don't step into compiled functions...
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
1017 call RunDbgCmd(buf, 'next', ['line 15: End of sourced file'])
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1018 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1019 \ '\V>backtrace',
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
1020 \ '\V 3 function GlobalFunction[2]',
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1021 \ '\V 2 <SNR>\.\*_CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1022 \ '\V 1 <SNR>\.\*_SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1023 \ '\V->0 script ' .. getcwd() .. '/Xtest2.vim',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1024 \ '\Vline 15: End of sourced file'],
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1025 \ #{match: 'pattern'})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1026
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1027 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1028 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1029 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
1030 endfunc
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1031
25719
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1032 func Test_DefFunction_expr()
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1033 CheckCWD
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1034 let file3 =<< trim END
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1035 vim9script
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1036 g:someVar = "foo"
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1037 def g:ChangeVar()
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1038 g:someVar = "bar"
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1039 echo "changed"
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1040 enddef
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1041 defcompile
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1042 END
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1043 call writefile(file3, 'Xtest3.vim')
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1044 let buf = RunVimInTerminal('-S Xtest3.vim', {})
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1045
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1046 call RunDbgCmd(buf, ':breakadd expr g:someVar')
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1047 call RunDbgCmd(buf, ':call g:ChangeVar()', ['Oldval = "''foo''"', 'Newval = "''bar''"', 'function ChangeVar', 'line 2: echo "changed"'])
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1048
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1049 call StopVimInTerminal(buf)
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1050 call delete('Xtest3.vim')
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1051 endfunc
154663508d9b patch 8.2.3395: Vim9: expression breakpoint not checked in :def function
Bram Moolenaar <Bram@vim.org>
parents: 25204
diff changeset
1052
25059
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1053 func Test_debug_def_and_legacy_function()
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1054 CheckCWD
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1055 let file =<< trim END
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1056 vim9script
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1057 def g:SomeFunc()
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1058 echo "here"
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1059 echo "and"
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1060 echo "there"
24980
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1061 breakadd func 2 LocalFunc
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1062 LocalFunc()
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1063 enddef
24980
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1064
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1065 def LocalFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1066 echo "first"
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1067 echo "second"
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1068 breakadd func LegacyFunc
24980
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1069 LegacyFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1070 enddef
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1071
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1072 func LegacyFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1073 echo "legone"
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1074 echo "legtwo"
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1075 endfunc
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1076
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1077 breakadd func 2 g:SomeFunc
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1078 END
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1079 call writefile(file, 'XtestDebug.vim')
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1080
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1081 let buf = RunVimInTerminal('-S XtestDebug.vim', {})
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1082
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1083 call RunDbgCmd(buf,':call SomeFunc()', ['line 2: echo "and"'])
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1084 call RunDbgCmd(buf,'next', ['line 3: echo "there"'])
24980
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1085 call RunDbgCmd(buf,'next', ['line 4: breakadd func 2 LocalFunc'])
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1086
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1087 " continue, next breakpoint is in LocalFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1088 call RunDbgCmd(buf,'cont', ['line 2: echo "second"'])
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1089
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1090 " continue, next breakpoint is in LegacyFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
1091 call RunDbgCmd(buf,'cont', ['line 1: echo "legone"'])
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1092
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1093 call RunDbgCmd(buf, 'cont')
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1094
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1095 call StopVimInTerminal(buf)
25118
12fd67997953 patch 8.2.3096: temp files remain after running tests
Bram Moolenaar <Bram@vim.org>
parents: 25098
diff changeset
1096 call delete('XtestDebug.vim')
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1097 endfunc
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
1098
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1099 func Test_debug_def_function()
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1100 CheckCWD
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1101 let file =<< trim END
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1102 vim9script
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1103 def g:Func()
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1104 var n: number
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1105 def Closure(): number
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1106 return n + 3
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1107 enddef
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1108 n += Closure()
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1109 echo 'result: ' .. n
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1110 enddef
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1111
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1112 def g:FuncWithArgs(text: string, nr: number, ...items: list<number>)
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1113 echo text .. nr
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1114 for it in items
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1115 echo it
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1116 endfor
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1117 echo "done"
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1118 enddef
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1119
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1120 def g:FuncWithDict()
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1121 var d = {
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1122 a: 1,
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1123 b: 2,
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1124 }
24960
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1125 # comment
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1126 def Inner()
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1127 eval 1 + 2
24960
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1128 enddef
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1129 enddef
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1130
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1131 def g:FuncComment()
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1132 # comment
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1133 echo "first"
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1134 .. "one"
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1135 # comment
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1136 echo "second"
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1137 enddef
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1138
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1139 def g:FuncForLoop()
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1140 eval 1 + 2
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1141 for i in [11, 22, 33]
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1142 eval i + 2
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1143 endfor
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1144 echo "done"
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1145 enddef
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1146
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1147 def g:FuncWithSplitLine()
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1148 eval 1 + 2
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1149 | eval 2 + 3
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1150 enddef
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1151 END
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1152 call writefile(file, 'Xtest.vim')
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1153
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1154 let buf = RunVimInTerminal('-S Xtest.vim', {})
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1155
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1156 call RunDbgCmd(buf,
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1157 \ ':debug call Func()',
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1158 \ ['cmd: call Func()'])
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1159 call RunDbgCmd(buf, 'next', ['result: 3'])
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1160 call term_sendkeys(buf, "\r")
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1161 call RunDbgCmd(buf, 'cont')
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1162
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1163 call RunDbgCmd(buf,
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1164 \ ':debug call FuncWithArgs("asdf", 42, 1, 2, 3)',
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1165 \ ['cmd: call FuncWithArgs("asdf", 42, 1, 2, 3)'])
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1166 call RunDbgCmd(buf, 'step', ['line 1: echo text .. nr'])
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1167 call RunDbgCmd(buf, 'echo text', ['asdf'])
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1168 call RunDbgCmd(buf, 'echo nr', ['42'])
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1169 call RunDbgCmd(buf, 'echo items', ['[1, 2, 3]'])
26911
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1170 call RunDbgCmd(buf, 'step', ['asdf42', 'function FuncWithArgs', 'line 2: for it in items'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1171 call RunDbgCmd(buf, 'step', ['function FuncWithArgs', 'line 2: for it in items'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1172 call RunDbgCmd(buf, 'echo it', ['0'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1173 call RunDbgCmd(buf, 'step', ['line 3: echo it'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1174 call RunDbgCmd(buf, 'echo it', ['1'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1175 call RunDbgCmd(buf, 'step', ['1', 'function FuncWithArgs', 'line 4: endfor'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1176 call RunDbgCmd(buf, 'step', ['line 2: for it in items'])
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1177 call RunDbgCmd(buf, 'echo it', ['1'])
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1178 call RunDbgCmd(buf, 'step', ['line 3: echo it'])
26911
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1179 call RunDbgCmd(buf, 'step', ['2', 'function FuncWithArgs', 'line 4: endfor'])
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1180 call RunDbgCmd(buf, 'step', ['line 2: for it in items'])
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1181 call RunDbgCmd(buf, 'echo it', ['2'])
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1182 call RunDbgCmd(buf, 'step', ['line 3: echo it'])
26911
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1183 call RunDbgCmd(buf, 'step', ['3', 'function FuncWithArgs', 'line 4: endfor'])
24952
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1184 call RunDbgCmd(buf, 'step', ['line 2: for it in items'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1185 call RunDbgCmd(buf, 'step', ['line 5: echo "done"'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1186 call RunDbgCmd(buf, 'cont')
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1187
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1188 call RunDbgCmd(buf,
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1189 \ ':debug call FuncWithDict()',
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1190 \ ['cmd: call FuncWithDict()'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1191 call RunDbgCmd(buf, 'step', ['line 1: var d = { a: 1, b: 2, }'])
24960
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1192 call RunDbgCmd(buf, 'step', ['line 6: def Inner()'])
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1193 call RunDbgCmd(buf, 'cont')
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1194
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1195 call RunDbgCmd(buf, ':breakadd func 1 FuncComment')
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1196 call RunDbgCmd(buf, ':call FuncComment()', ['function FuncComment', 'line 2: echo "first" .. "one"'])
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1197 call RunDbgCmd(buf, ':breakadd func 3 FuncComment')
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1198 call RunDbgCmd(buf, 'cont', ['function FuncComment', 'line 5: echo "second"'])
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1199 call RunDbgCmd(buf, 'cont')
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1200
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1201 call RunDbgCmd(buf, ':breakadd func 2 FuncForLoop')
26911
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1202 call RunDbgCmd(buf, ':call FuncForLoop()', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1203 call RunDbgCmd(buf, 'step', ['line 2: for i in [11, 22, 33]'])
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1204 call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 3: eval i + 2'])
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1205 call RunDbgCmd(buf, 'echo i', ['11'])
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1206 call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 4: endfor'])
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1207 call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]'])
26911
c451e8657110 patch 8.2.3984: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 26771
diff changeset
1208 call RunDbgCmd(buf, 'next', ['line 3: eval i + 2'])
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1209 call RunDbgCmd(buf, 'echo i', ['22'])
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1210
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1211 call RunDbgCmd(buf, 'breakdel *')
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1212 call RunDbgCmd(buf, 'cont')
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1213
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1214 call RunDbgCmd(buf, ':breakadd func FuncWithSplitLine')
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1215 call RunDbgCmd(buf, ':call FuncWithSplitLine()', ['function FuncWithSplitLine', 'line 1: eval 1 + 2 | eval 2 + 3'])
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1216
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1217 call RunDbgCmd(buf, 'cont')
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1218 call StopVimInTerminal(buf)
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1219 call delete('Xtest.vim')
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1220 endfunc
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1221
25059
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1222 func Test_debug_def_function_with_lambda()
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1223 CheckCWD
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1224 let lines =<< trim END
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1225 vim9script
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1226 def g:Func()
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1227 var s = 'a'
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1228 ['b']->map((_, v) => s)
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1229 echo "done"
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1230 enddef
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1231 breakadd func 2 g:Func
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1232 END
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1233 call writefile(lines, 'XtestLambda.vim')
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1234
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1235 let buf = RunVimInTerminal('-S XtestLambda.vim', {})
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1236
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1237 call RunDbgCmd(buf,
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1238 \ ':call g:Func()',
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1239 \ ['function Func', 'line 2: [''b'']->map((_, v) => s)'])
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1240 call RunDbgCmd(buf,
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1241 \ 'next',
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1242 \ ['function Func', 'line 3: echo "done"'])
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1243
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1244 call RunDbgCmd(buf, 'cont')
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1245 call StopVimInTerminal(buf)
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1246 call delete('XtestLambda.vim')
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1247 endfunc
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1248
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1249 func Test_debug_backtrace_level()
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1250 CheckCWD
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1251 let lines =<< trim END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1252 let s:file1_var = 'file1'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1253 let g:global_var = 'global'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1254
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1255 func s:File1Func( arg )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1256 let s:file1_var .= a:arg
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1257 let local_var = s:file1_var .. ' test1'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1258 let g:global_var .= local_var
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1259 source Xtest2.vim
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1260 endfunc
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1261
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1262 call s:File1Func( 'arg1' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1263 END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1264 call writefile(lines, 'Xtest1.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1265
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1266 let lines =<< trim END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1267 let s:file2_var = 'file2'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1268
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1269 func s:File2Func( arg )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1270 let s:file2_var .= a:arg
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1271 let local_var = s:file2_var .. ' test2'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1272 let g:global_var .= local_var
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1273 endfunc
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1274
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1275 call s:File2Func( 'arg2' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1276 END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1277 call writefile(lines, 'Xtest2.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1278
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1279 let file1 = getcwd() .. '/Xtest1.vim'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1280 let file2 = getcwd() .. '/Xtest2.vim'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1281
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1282 " set a breakpoint and source file1.vim
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1283 let buf = RunVimInTerminal(
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1284 \ '-c "breakadd file 1 Xtest1.vim" -S Xtest1.vim',
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
1285 \ #{wait_for_ruler: 0})
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1286
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1287 call CheckDbgOutput(buf, [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1288 \ 'Breakpoint in "' .. file1 .. '" line 1',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1289 \ 'Entering Debug mode. Type "cont" to continue.',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1290 \ 'command line..script ' .. file1,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1291 \ 'line 1: let s:file1_var = ''file1'''
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
1292 \ ], #{msec: 5000})
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1293
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 22969
diff changeset
1294 " step through the initial declarations
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1295 call RunDbgCmd(buf, 'step', [ 'line 2: let g:global_var = ''global''' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1296 call RunDbgCmd(buf, 'step', [ 'line 4: func s:File1Func( arg )' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1297 call RunDbgCmd(buf, 'echo s:file1_var', [ 'file1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1298 call RunDbgCmd(buf, 'echo g:global_var', [ 'global' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1299 call RunDbgCmd(buf, 'echo global_var', [ 'global' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1300
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1301 " step in to the first function
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1302 call RunDbgCmd(buf, 'step', [ 'line 11: call s:File1Func( ''arg1'' )' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1303 call RunDbgCmd(buf, 'step', [ 'line 1: let s:file1_var .= a:arg' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1304 call RunDbgCmd(buf, 'echo a:arg', [ 'arg1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1305 call RunDbgCmd(buf, 'echo s:file1_var', [ 'file1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1306 call RunDbgCmd(buf, 'echo g:global_var', [ 'global' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1307 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1308 \'echo global_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1309 \[ 'E121: Undefined variable: global_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1310 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1311 \'echo local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1312 \[ 'E121: Undefined variable: local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1313 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1314 \'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1315 \[ 'E121: Undefined variable: l:local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1316
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1317 " backtrace up
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1318 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1319 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1320 \ '\V 2 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1321 \ '\V 1 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1322 \ '\V->0 function <SNR>\.\*_File1Func',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1323 \ '\Vline 1: let s:file1_var .= a:arg',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1324 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1325 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1326 call RunDbgCmd(buf, 'up', [ '>up' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1327
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1328 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1329 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1330 \ '\V 2 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1331 \ '\V->1 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1332 \ '\V 0 function <SNR>\.\*_File1Func',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1333 \ '\Vline 1: let s:file1_var .= a:arg',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1334 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1335 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1336
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1337 " Expression evaluation in the script frame (not the function frame)
26211
485c7c4afeb7 patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents: 25767
diff changeset
1338 " FIXME: Unexpected in this scope (a: should not be visible)
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1339 call RunDbgCmd(buf, 'echo a:arg', [ 'arg1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1340 call RunDbgCmd(buf, 'echo s:file1_var', [ 'file1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1341 call RunDbgCmd(buf, 'echo g:global_var', [ 'global' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1342 " FIXME: Unexpected in this scope (global should be found)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1343 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1344 \'echo global_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1345 \[ 'E121: Undefined variable: global_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1346 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1347 \'echo local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1348 \[ 'E121: Undefined variable: local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1349 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1350 \'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1351 \[ 'E121: Undefined variable: l:local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1352
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1353
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1354 " step while backtraced jumps to the latest frame
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1355 call RunDbgCmd(buf, 'step', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1356 \ 'line 2: let local_var = s:file1_var .. '' test1''' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1357 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1358 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1359 \ '\V 2 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1360 \ '\V 1 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1361 \ '\V->0 function <SNR>\.\*_File1Func',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1362 \ '\Vline 2: let local_var = s:file1_var .. '' test1''',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1363 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1364 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1365
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1366 call RunDbgCmd(buf, 'step', [ 'line 3: let g:global_var .= local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1367 call RunDbgCmd(buf, 'echo local_var', [ 'file1arg1 test1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1368 call RunDbgCmd(buf, 'echo l:local_var', [ 'file1arg1 test1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1369
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1370 call RunDbgCmd(buf, 'step', [ 'line 4: source Xtest2.vim' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1371 call RunDbgCmd(buf, 'step', [ 'line 1: let s:file2_var = ''file2''' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1372 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1373 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1374 \ '\V 3 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1375 \ '\V 2 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1376 \ '\V 1 function <SNR>\.\*_File1Func[4]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1377 \ '\V->0 script ' .. file2,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1378 \ '\Vline 1: let s:file2_var = ''file2''',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1379 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1380 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1381
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1382 " Expression evaluation in the script frame file2 (not the function frame)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1383 call RunDbgCmd(buf, 'echo a:arg', [ 'E121: Undefined variable: a:arg' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1384 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1385 \ 'echo s:file1_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1386 \ [ 'E121: Undefined variable: s:file1_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1387 call RunDbgCmd(buf, 'echo g:global_var', [ 'globalfile1arg1 test1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1388 call RunDbgCmd(buf, 'echo global_var', [ 'globalfile1arg1 test1' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1389 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1390 \'echo local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1391 \[ 'E121: Undefined variable: local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1392 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1393 \'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1394 \[ 'E121: Undefined variable: l:local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1395 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1396 \ 'echo s:file2_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1397 \ [ 'E121: Undefined variable: s:file2_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1398
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1399 call RunDbgCmd(buf, 'step', [ 'line 3: func s:File2Func( arg )' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1400 call RunDbgCmd(buf, 'echo s:file2_var', [ 'file2' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1401
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1402 " Up the stack to the other script context
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1403 call RunDbgCmd(buf, 'up')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1404 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1405 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1406 \ '\V 3 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1407 \ '\V 2 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1408 \ '\V->1 function <SNR>\.\*_File1Func[4]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1409 \ '\V 0 script ' .. file2,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1410 \ '\Vline 3: func s:File2Func( arg )',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1411 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1412 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1413 " FIXME: Unexpected. Should see the a: and l: dicts from File1Func
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1414 call RunDbgCmd(buf, 'echo a:arg', [ 'E121: Undefined variable: a:arg' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1415 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1416 \ 'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1417 \ [ 'E121: Undefined variable: l:local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1418
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1419 call RunDbgCmd(buf, 'up')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1420 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1421 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1422 \ '\V 3 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1423 \ '\V->2 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1424 \ '\V 1 function <SNR>\.\*_File1Func[4]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1425 \ '\V 0 script ' .. file2,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1426 \ '\Vline 3: func s:File2Func( arg )',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1427 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1428 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1429
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1430 " FIXME: Unexpected (wrong script vars are used)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1431 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1432 \ 'echo s:file1_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1433 \ [ 'E121: Undefined variable: s:file1_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1434 call RunDbgCmd(buf, 'echo s:file2_var', [ 'file2' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1435
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
1436 call RunDbgCmd(buf, 'cont')
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1437 call StopVimInTerminal(buf)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1438 call delete('Xtest1.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1439 call delete('Xtest2.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1440 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21687
diff changeset
1441
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1442 " Test for setting a breakpoint on a :endif where the :if condition is false
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1443 " and then quit the script. This should generate an interrupt.
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1444 func Test_breakpt_endif_intr()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1445 func F()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1446 let g:Xpath ..= 'a'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1447 if v:false
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1448 let g:Xpath ..= 'b'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1449 endif
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1450 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1451 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1452
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1453 let g:Xpath = ''
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1454 breakadd func 4 F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1455 try
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1456 let caught_intr = 0
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1457 debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1458 call feedkeys(":call F()\<CR>quit\<CR>", "xt")
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1459 catch /^Vim:Interrupt$/
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1460 call assert_match('\.F, line 4', v:throwpoint)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1461 let caught_intr = 1
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1462 endtry
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1463 0debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1464 call assert_equal(1, caught_intr)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1465 call assert_equal('a', g:Xpath)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1466 breakdel *
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1467 delfunc F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1468 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1469
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1470 " Test for setting a breakpoint on a :else where the :if condition is false
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1471 " and then quit the script. This should generate an interrupt.
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1472 func Test_breakpt_else_intr()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1473 func F()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1474 let g:Xpath ..= 'a'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1475 if v:false
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1476 let g:Xpath ..= 'b'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1477 else
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1478 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1479 endif
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1480 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1481 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1482
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1483 let g:Xpath = ''
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1484 breakadd func 4 F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1485 try
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1486 let caught_intr = 0
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1487 debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1488 call feedkeys(":call F()\<CR>quit\<CR>", "xt")
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1489 catch /^Vim:Interrupt$/
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1490 call assert_match('\.F, line 4', v:throwpoint)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1491 let caught_intr = 1
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1492 endtry
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1493 0debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1494 call assert_equal(1, caught_intr)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1495 call assert_equal('a', g:Xpath)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1496 breakdel *
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1497 delfunc F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1498 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1499
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1500 " Test for setting a breakpoint on a :endwhile where the :while condition is
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1501 " false and then quit the script. This should generate an interrupt.
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1502 func Test_breakpt_endwhile_intr()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1503 func F()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1504 let g:Xpath ..= 'a'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1505 while v:false
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1506 let g:Xpath ..= 'b'
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1507 endwhile
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1508 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1509 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1510
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1511 let g:Xpath = ''
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1512 breakadd func 4 F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1513 try
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1514 let caught_intr = 0
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1515 debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1516 call feedkeys(":call F()\<CR>quit\<CR>", "xt")
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1517 catch /^Vim:Interrupt$/
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1518 call assert_match('\.F, line 4', v:throwpoint)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1519 let caught_intr = 1
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1520 endtry
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1521 0debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1522 call assert_equal(1, caught_intr)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1523 call assert_equal('a', g:Xpath)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1524 breakdel *
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1525 delfunc F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1526 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1527
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1528 " Test for setting a breakpoint on a script local function
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1529 func Test_breakpt_scriptlocal_func()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1530 let g:Xpath = ''
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1531 func s:G()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1532 let g:Xpath ..= 'a'
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1533 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1534
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1535 let funcname = expand("<SID>") .. "G"
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1536 exe "breakadd func 1 " .. funcname
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1537 debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1538 redir => output
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1539 call feedkeys(":call " .. funcname .. "()\<CR>c\<CR>", "xt")
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1540 redir END
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1541 0debuggreedy
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1542 call assert_match('Breakpoint in "' .. funcname .. '" line 1', output)
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1543 call assert_equal('a', g:Xpath)
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1544 breakdel *
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1545 exe "delfunc " .. funcname
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1546 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1547
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21687
diff changeset
1548 " vim: shiftwidth=2 sts=2 expandtab