annotate src/testdir/test_debugger.vim @ 25204:bc1633df8a88 v8.2.3138

patch 8.2.3138: debugger test fails Commit: https://github.com/vim/vim/commit/31e21766d6fb0a386e15ccc8c2192f6a3a210f53 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 10 20:43:59 2021 +0200 patch 8.2.3138: debugger test fails Problem: Debugger test fails. Solution: Adjust eval command.
author Bram Moolenaar <Bram@vim.org>
date Sat, 10 Jul 2021 20:45:03 +0200
parents b2a6a71a11e8
children 154663508d9b
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
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
76 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
77 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
78
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 " 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
80 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
81
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 " 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
83 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
84
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 " 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
86 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
87 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
88 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
89 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
90 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
91 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
92 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
93
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 " check backtrace
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 call RunDbgCmd(buf, 'backtrace', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 \ ' 2 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 \ ' 1 Bar[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 \ '->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
99 \ '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 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
102 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
103
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 call RunDbgCmd(buf, 'up')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 call RunDbgCmd(buf, 'back', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 \ ' 2 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 \ '->1 Bar[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 \ ' 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
109 \ '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
110 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
111
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 call RunDbgCmd(buf, 'u')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 call RunDbgCmd(buf, 'bt', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 \ '->2 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 \ ' 1 Bar[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 \ ' 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
117 \ '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
118 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
119
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 " Undefined variables
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 call RunDbgCmd(buf, 'step')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 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
123 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
124 \ '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
125 \ 'line 4:',
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 \ 'E121: Undefined variable: var3'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 " 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
129 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
130 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
131
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 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
133 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
134 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
135 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
136 call RunDbgCmd(buf, '')
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 call RunDbgCmd(buf, 'step', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 \ 'function Foo[2]..Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 \ '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
140 call RunDbgCmd(buf, 'up')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 " Undefined var2
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 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
144 \ '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
145 \ 'line 3:',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 \ 'E121: Undefined variable: var2'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 " 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
149 call RunDbgCmd(buf, 'down')
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', ['10'])
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 " Backtrace movements
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 call RunDbgCmd(buf, 'b', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 \ ' 1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 \ '->0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 \ '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
157
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 " 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
159 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
160 call RunDbgCmd(buf, 'up')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 " 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
163 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
164 call RunDbgCmd(buf, 'where', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 \ '->1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 \ ' 0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 \ '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
168
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 " 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
170 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
171
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 " relative backtrace movement
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 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
174 call RunDbgCmd(buf, 'frame', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 \ ' 1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 \ '->0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 \ '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
178
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 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
180 call RunDbgCmd(buf, 'fram', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 \ '->1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 \ ' 0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 \ '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
184
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 " 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
186 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
187 call RunDbgCmd(buf, 'fra', [
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 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
193 call RunDbgCmd(buf, 'fram', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 \ ' 1 function Foo[2]',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 \ '->0 Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 \ '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
197
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 " final result 19
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 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
200
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 " breakpoints tests
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 " 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
204 " works properly.
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
205 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
206
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 " No breakpoints
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 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
209
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 " Place some breakpoints
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 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
212 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
213 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
214 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
215 \ ' 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
216
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 " 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
218 call RunDbgCmd(buf, 'cont', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 \ '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
220 \ 'function Foo[2]..Bar',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 \ '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
222 call RunDbgCmd(buf, 'cont', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223 \ '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
224 \ '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
225 \ '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
226
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 " Delete the breakpoints
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 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
229 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
230 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
231 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
232
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 call RunDbgCmd(buf, 'cont')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 " 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
236 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
237
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 " 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
239 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
240
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 " Expression breakpoint
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 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
243 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
244 \ '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
245 \ '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
246 \ '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
247 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
248 call RunDbgCmd(buf, 'step')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 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
250 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
251 \ ' 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
252 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
253 \ 'Oldval = "''another var''"',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 \ 'Newval = "''value2''"',
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 \ '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
256 \ 'line 5: catch'])
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 call RunDbgCmd(buf, 'breakdel *')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 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
260
16372
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
261 " 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
262 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
263 \ '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
264 \ '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
265 \ '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
266 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
267 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
268 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
269 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
270 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
271 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
272 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
273 call RunDbgCmd(buf, 'breakd expr', ['E475: Invalid argument: expr'])
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, 'breakd expr x', [
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
275 \ 'E121: Undefined variable: x',
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
276 \ 'E161: Breakpoint not found: expr x'])
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
277
16350
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 " finish the current function
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279 call RunDbgCmd(buf, 'finish', [
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 \ '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
281 \ '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
282 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
283
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
284 " 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
285 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
286 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
287 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
288 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
289 \ '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
290 \ '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
291 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
292
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
293 " 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
294 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
295 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
296 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
297 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
298 \ '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
299 \ '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
300 \ '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
301 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
302
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
303 " 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
304 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
305 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
306 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
307 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
308 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
309 \ '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
310 \ '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
311 \ '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
312 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
313 \ '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
314 \ '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
315 \ '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
316 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
317 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
318 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
319
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 StopVimInTerminal(buf)
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
321
5900941b2e37 patch 8.1.1191: not all debug commands are covered by a test
Bram Moolenaar <Bram@vim.org>
parents: 16350
diff changeset
322 " 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
323 " 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
324
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
325 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
326 let var1 = 10
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
327 let var2 = 20
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
328 let var3 = 30
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
329 let var4 = 40
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
330 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
331 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
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 " 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
334 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
335 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
336 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
337 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
338 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
339 call RunDbgCmd(buf, 'cont')
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 call StopVimInTerminal(buf)
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342
ffa791471a4c patch 8.1.1180: Vim script debugger tests are old style
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 call delete('Xtest.vim')
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
344 %bw!
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
345 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
346 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
347 endfunc
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
348
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
349 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
350 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
351 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
352 func SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
353 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
354 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
355
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
356 func CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
357 call SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
358 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
359 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
360
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
361 func GlobalFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
362 call CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
363 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
364 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
365 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
366
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
367 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
368 func DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
369 echo "DoAThing"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
370 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
371
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
372 func File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
373 call DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
374 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
375
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
376 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
377 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
378 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
379
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
380 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
381
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
382 call RunDbgCmd(buf,
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
383 \ ':debug call GlobalFunction()',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
384 \ ['cmd: call GlobalFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
385 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
386
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
387 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
388 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
389 \ 'line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
390
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
391 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
392 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
393
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
394 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
395 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
396 \ ' 1 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
397 \ '->0 SourceAnotherFile',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
398 \ '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
399
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
400 " 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
401 " 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
402 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
403 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
404 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
405 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
406 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
407 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
408 \ '->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
409 \ 'line 1: func DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
410
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
411 call RunDbgCmd( buf, 'up' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
412 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
413 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
414 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
415 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
416 \ '->1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
417 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
418 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
419
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
420 call RunDbgCmd( buf, 'up' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
421 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
422 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
423 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
424 \ '->2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
425 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
426 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
427 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
428
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
429 call RunDbgCmd( buf, 'up' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
430 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
431 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
432 \ '->3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
433 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
434 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
435 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
436 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
437
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
438 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
439 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
440 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
441 \ '->3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
442 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
443 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
444 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
445 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
446
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
447 call RunDbgCmd( buf, 'down' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
448 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
449 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
450 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
451 \ '->2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
452 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
453 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
454 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
455
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
456 call RunDbgCmd( buf, 'down' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
457 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
458 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
459 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
460 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
461 \ '->1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
462 \ ' 0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
463 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
464
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
465 call RunDbgCmd( buf, 'down' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
466 call RunDbgCmd( buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
467 \ '>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
468 \ ' 3 function GlobalFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
469 \ ' 2 CallAFunction[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
470 \ ' 1 SourceAnotherFile[1]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
471 \ '->0 script ' .. getcwd() .. '/Xtest2.vim',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
472 \ 'line 1: func DoAThing()' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
473
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
474 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
475
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
476 " step until we have another meaninfgul trace
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
477 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
478 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
479 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
480 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
481 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
482 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
483 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
484 \ '->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
485 \ 'line 9: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
486
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
487 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
488 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
489 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
490 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
491 \ ' 5 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
492 \ ' 4 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
493 \ ' 3 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
494 \ ' 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
495 \ ' 1 function File2Function[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
496 \ '->0 DoAThing',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
497 \ 'line 1: echo "DoAThing"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
498
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
499 " 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
500 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
501 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
502 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
503 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
504 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
505 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
506 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
507 \ ' 1 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
508 \ '->0 CallAFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
509 \ 'line 2: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
510
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
511 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
512 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
513 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
514 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
515 \ ' 1 CallAFunction[2]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
516 \ '->0 File2Function',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
517 \ 'line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
518
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
519 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
520 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
521 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
522 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
523
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
524 func Test_Backtrace_Autocmd()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
525 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
526 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
527 func SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
528 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
529 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
530
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
531 func CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
532 call SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
533 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
534 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
535
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
536 func GlobalFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
537 call CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
538 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
539
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
540 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
541 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
542 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
543
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
544 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
545 func DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
546 echo "DoAThing"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
547 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
548
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
549 func File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
550 call DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
551 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
552
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
553 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
554 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
555 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
556
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
557 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
558
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
559 call RunDbgCmd(buf,
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
560 \ ':debug doautocmd User TestGlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
561 \ ['cmd: doautocmd User TestGlobalFunction'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
562 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
563
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
564 " At this point the ontly thing in the stack is the autocommand
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
565 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
566 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
567 \ '->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
568 \ '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
569
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
570 " 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
571 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
572 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
573 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
574 \ ' 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
575 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
576 \ 'line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
577
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
578 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
579 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
580
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
581 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
582 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
583 \ ' 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
584 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
585 \ ' 1 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
586 \ '->0 SourceAnotherFile',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
587 \ '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
588
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
589 " 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
590 " 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
591 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
592 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
593 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
594 \ ' 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
595 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
596 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
597 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
598 \ '->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
599 \ 'line 1: func DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
600
21917
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
601 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
602 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
603 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
604 \ ' 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
605 \ ' 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
606 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
607 \ '->1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
608 \ ' 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
609 \ '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
610
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
611 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
612 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
613 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
614 \ ' 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
615 \ ' 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
616 \ '->2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
617 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
618 \ ' 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
619 \ '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
620
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
621 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
622 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
623 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
624 \ ' 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
625 \ '->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
626 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
627 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
628 \ ' 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
629 \ '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
630
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
631 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
632 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
633 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
634 \ '->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
635 \ ' 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
636 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
637 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
638 \ ' 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
639 \ '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
640
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
641 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
642 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
643 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
644 \ '->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
645 \ ' 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
646 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
647 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
648 \ ' 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
649 \ '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
650
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
651 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
652 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
653 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
654 \ ' 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
655 \ '->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
656 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
657 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
658 \ ' 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
659 \ '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
660
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
661
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
662 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
663 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
664 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
665 \ ' 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
666 \ ' 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
667 \ '->2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
668 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
669 \ ' 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
670 \ '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
671
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
672 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
673 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
674 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
675 \ ' 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
676 \ ' 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
677 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
678 \ '->1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
679 \ ' 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
680 \ '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
681
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
682 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
683 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
684 \ '>backtrace',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
685 \ ' 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
686 \ ' 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
687 \ ' 2 CallAFunction[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
688 \ ' 1 SourceAnotherFile[1]',
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
689 \ '->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
690 \ '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
691
94376326c096 patch 8.2.1508: not all debugger commands covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 21781
diff changeset
692 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
693
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
694 " step until we have another meaninfgul trace
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
695 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
696 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
697 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
698 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
699 \ ' 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
700 \ ' 3 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
701 \ ' 2 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
702 \ ' 1 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
703 \ '->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
704 \ 'line 9: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
705
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
706 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
707 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
708 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
709 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
710 \ ' 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
711 \ ' 5 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
712 \ ' 4 CallAFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
713 \ ' 3 SourceAnotherFile[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
714 \ ' 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
715 \ ' 1 function File2Function[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
716 \ '->0 DoAThing',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
717 \ 'line 1: echo "DoAThing"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
718
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
719 " 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
720 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
721 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
722 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
723 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
724 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
725 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
726 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
727 \ ' 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
728 \ ' 1 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
729 \ '->0 CallAFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
730 \ 'line 2: call File2Function()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
731
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
732 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
733 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
734 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
735 \ ' 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
736 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
737 \ ' 1 CallAFunction[2]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
738 \ '->0 File2Function',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
739 \ 'line 1: call DoAThing()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
740
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
741
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
742 " 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
743 " cmd echo "Done")
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
744 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
745 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
746 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
747 \ ' 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
748 \ ' 2 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
749 \ ' 1 CallAFunction[2]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
750 \ '->0 File2Function',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
751 \ '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
752
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
753 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
754 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
755 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
756 \ ' 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
757 \ ' 1 function GlobalFunction[1]',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
758 \ '->0 CallAFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
759 \ '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
760
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
761 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
762 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
763 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
764 \ ' 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
765 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
766 \ '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
767
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
768 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
769 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
770 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
771 \ '->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
772 \ 'cmd: echo "Done"'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
773
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
774 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
775 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
776 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
777 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
778
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
779 func Test_Backtrace_CmdLine()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
780 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
781 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
782 func SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
783 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
784 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
785
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
786 func CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
787 call SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
788 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
789 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
790
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
791 func GlobalFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
792 call CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
793 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
794
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
795 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
796 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
797 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
798
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
799 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
800 func DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
801 echo "DoAThing"
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
802 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
803
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
804 func File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
805 call DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
806 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
807
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
808 call File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
809 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
810 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
811
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
812 let buf = RunVimInTerminal(
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
813 \ '-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
814 \ {'wait_for_ruler': 0})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
815
22969
dcb59b1cc0c1 patch 8.2.2031: some tests fail when run under valgrind
Bram Moolenaar <Bram@vim.org>
parents: 22486
diff changeset
816 " 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
817 " 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
818 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
819 \ '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
820
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
821 " At this point the ontly thing in the stack is the cmdline
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 \ '->0 command line',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
825 \ 'cmd: call GlobalFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
826
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
827 " 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
828 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
829 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
830 \ '>backtrace',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
831 \ ' 1 command line',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
832 \ '->0 function GlobalFunction',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
833 \ 'line 1: call CallAFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
834
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
835 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
836 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
837 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
838 endfunc
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
839
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
840 func Test_Backtrace_DefFunction()
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
841 CheckCWD
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
842 let file1 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
843 vim9script
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
844 import File2Function from './Xtest2.vim'
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
845
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
846 def SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
847 source Xtest2.vim
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
848 enddef
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 def CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
851 SourceAnotherFile()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
852 File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
853 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
854
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
855 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
856 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
857 CallAFunction()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
858 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
859
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
860 defcompile
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
861 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
862 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
863
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
864 let file2 =<< trim END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
865 vim9script
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
866
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
867 def DoAThing(): number
22486
4086a1708c83 patch 8.2.1791: Vim9: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 22375
diff changeset
868 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
869 a += 3
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
870 return a
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
871 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
872
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
873 export def File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
874 DoAThing()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
875 enddef
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
876
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
877 defcompile
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
878 File2Function()
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
879 END
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
880 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
881
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
882 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
883
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
884 call RunDbgCmd(buf,
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
885 \ ':debug call GlobalFunction()',
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
886 \ ['cmd: call GlobalFunction()'])
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
887
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
888 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
889 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
890 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
891
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
892 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
893 \ '\V>backtrace',
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
894 \ '\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
895 \ '\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
896 \ ],
21508
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
897 \ #{match: 'pattern'})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
898
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
899 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
900 call RunDbgCmd(buf, 'step', ['line 1: source Xtest2.vim'])
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
901 " Repeated line, because we fist are in the compiled function before the
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
902 " 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
903 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
904 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
905 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
906 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
907 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
908 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
909 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
910 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
911 \ '\V>backtrace',
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
912 \ '\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
913 \ '\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
914 \ '\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
915 \ '\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
916 \ '\Vline 14: File2Function()'],
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
917 \ #{match: 'pattern'})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
918
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
919 " 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
920 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
921 call RunDbgCmd(buf, 'backtrace', [
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
922 \ '\V>backtrace',
24918
f11779c1d123 patch 8.2.2996: Vim9: when debugging cannot inspect local variables
Bram Moolenaar <Bram@vim.org>
parents: 24895
diff changeset
923 \ '\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
924 \ '\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
925 \ '\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
926 \ '\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
927 \ '\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
928 \ #{match: 'pattern'})
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
929
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
930 call StopVimInTerminal(buf)
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
931 call delete('Xtest1.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
932 call delete('Xtest2.vim')
6b2a5418cbc3 patch 8.2.1304: debug backtrace isn't tested much
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
933 endfunc
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
934
25059
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
935 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
936 CheckCWD
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
937 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
938 vim9script
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
939 def g:SomeFunc()
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
940 echo "here"
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
941 echo "and"
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
942 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
943 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
944 LocalFunc()
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
945 enddef
24980
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
946
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
947 def LocalFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
948 echo "first"
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
949 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
950 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
951 LegacyFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
952 enddef
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
953
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
954 func LegacyFunc()
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
955 echo "legone"
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
956 echo "legtwo"
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
957 endfunc
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
958
24978
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
959 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
960 END
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
961 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
962
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
963 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
964
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
965 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
966 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
967 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
968
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
969 " 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
970 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
971
2cb78583fada patch 8.2.3027: Vim9: breakpoint in compiled function not always checked
Bram Moolenaar <Bram@vim.org>
parents: 24978
diff changeset
972 " 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
973 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
974
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
975 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
976
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
977 call StopVimInTerminal(buf)
25118
12fd67997953 patch 8.2.3096: temp files remain after running tests
Bram Moolenaar <Bram@vim.org>
parents: 25098
diff changeset
978 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
979 endfunc
2818b8108d92 patch 8.2.3026: Vim9: cannot set breakpoint in compiled function
Bram Moolenaar <Bram@vim.org>
parents: 24960
diff changeset
980
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
981 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
982 CheckCWD
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
983 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
984 vim9script
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
985 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
986 var n: number
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
987 def Closure(): number
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
988 return n + 3
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
989 enddef
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
990 n += Closure()
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
991 echo 'result: ' .. n
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
992 enddef
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
993
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
994 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
995 echo text .. nr
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
996 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
997 echo it
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
998 endfor
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
999 echo "done"
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1000 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
1001
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1002 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
1003 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
1004 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
1005 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
1006 }
24960
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1007 # comment
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1008 def Inner()
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1009 eval 1 + 2
24960
64b70a958f19 patch 8.2.3017: Vim9: debugger shows too many lines
Bram Moolenaar <Bram@vim.org>
parents: 24952
diff changeset
1010 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
1011 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
1012
25004
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1013 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
1014 # comment
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1015 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
1016 .. "one"
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1017 # comment
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1018 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
1019 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
1020
25098
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1021 def g:FuncForLoop()
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1022 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
1023 for i in [11, 22, 33]
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1024 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
1025 endfor
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1026 echo "done"
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1027 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
1028
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1029 def g:FuncWithSplitLine()
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1030 eval 1 + 2
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1031 | 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
1032 enddef
24932
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1033 END
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1034 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
1035
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1036 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
1037
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1038 call RunDbgCmd(buf,
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1039 \ ':debug call Func()',
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1040 \ ['cmd: call Func()'])
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1041 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
1042 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
1043 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
1044
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1045 call RunDbgCmd(buf,
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1046 \ ':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
1047 \ ['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
1048 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
1049 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
1050 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
1051 call RunDbgCmd(buf, 'echo items', ['[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
1052 call RunDbgCmd(buf, 'step', ['asdf42', 'function FuncWithArgs', '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
1053 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
1054 call RunDbgCmd(buf, 'step', ['line 3: echo it'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1055 call RunDbgCmd(buf, 'step', ['1', 'function FuncWithArgs', 'line 4: endfor'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1056 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
1057 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
1058 call RunDbgCmd(buf, 'step', ['line 3: echo it'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1059 call RunDbgCmd(buf, 'step', ['2', 'function FuncWithArgs', 'line 4: endfor'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1060 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
1061 call RunDbgCmd(buf, 'echo it', ['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
1062 call RunDbgCmd(buf, 'step', ['line 3: echo it'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1063 call RunDbgCmd(buf, 'step', ['3', 'function FuncWithArgs', 'line 4: endfor'])
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1064 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
1065 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
1066
ffe784fdec57 patch 8.2.3013: Vim: when debugging only first line of command is displayed
Bram Moolenaar <Bram@vim.org>
parents: 24948
diff changeset
1067 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
1068 \ ':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
1069 \ ['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
1070 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
1071 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
1072 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
1073
70f55a30f03c patch 8.2.3039: Vim9: breakpoint at a comment line does not work
Bram Moolenaar <Bram@vim.org>
parents: 24980
diff changeset
1074 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
1075 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
1076 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
1077 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
1078 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
1079
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1080 call RunDbgCmd(buf, ':breakadd func 2 FuncForLoop')
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1081 call RunDbgCmd(buf, ':call FuncForLoop()', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]'])
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1082 call RunDbgCmd(buf, 'echo i', ['11'])
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1083 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
1084 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
1085 call RunDbgCmd(buf, 'next', ['function FuncForLoop', 'line 2: for i in [11, 22, 33]'])
765a642e0e20 patch 8.2.3086: Vim9: breakpoint on "for" does not work
Bram Moolenaar <Bram@vim.org>
parents: 25059
diff changeset
1086 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
1087
25159
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1088 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
1089 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
1090
b2a6a71a11e8 patch 8.2.3116: Vim9: crash when debugging a function with line continuation
Bram Moolenaar <Bram@vim.org>
parents: 25118
diff changeset
1091 call RunDbgCmd(buf, ':breakadd func FuncWithSplitLine')
25204
bc1633df8a88 patch 8.2.3138: debugger test fails
Bram Moolenaar <Bram@vim.org>
parents: 25159
diff changeset
1092 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
1093
24948
5c418c774f95 patch 8.2.3011: Vim9: cannot get argument values during debugging
Bram Moolenaar <Bram@vim.org>
parents: 24932
diff changeset
1094 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
1095 call StopVimInTerminal(buf)
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1096 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
1097 endfunc
afaa7f3aae56 patch 8.2.3003: Vim9: closure compiled with wrong compile type
Bram Moolenaar <Bram@vim.org>
parents: 24918
diff changeset
1098
25059
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1099 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
1100 CheckCWD
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1101 let lines =<< trim END
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1102 vim9script
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1103 def g:Func()
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1104 var s = 'a'
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1105 ['b']->map((_, v) => s)
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1106 echo "done"
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1107 enddef
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1108 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
1109 END
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1110 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
1111
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1112 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
1113
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1114 call RunDbgCmd(buf,
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1115 \ ':call g:Func()',
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1116 \ ['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
1117 call RunDbgCmd(buf,
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1118 \ 'next',
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1119 \ ['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
1120
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1121 call RunDbgCmd(buf, 'cont')
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1122 call StopVimInTerminal(buf)
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1123 call delete('XtestLambda.vim')
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1124 endfunc
671ded1facd5 patch 8.2.3066: Vim9: debugging lambda does not work
Bram Moolenaar <Bram@vim.org>
parents: 25004
diff changeset
1125
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1126 func Test_debug_backtrace_level()
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1127 CheckCWD
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1128 let lines =<< trim END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1129 let s:file1_var = 'file1'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1130 let g:global_var = 'global'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1131
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1132 func s:File1Func( arg )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1133 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
1134 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
1135 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
1136 source Xtest2.vim
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1137 endfunc
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1138
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1139 call s:File1Func( 'arg1' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1140 END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1141 call writefile(lines, 'Xtest1.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1142
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1143 let lines =<< trim END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1144 let s:file2_var = 'file2'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1145
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1146 func s:File2Func( arg )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1147 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
1148 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
1149 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
1150 endfunc
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1151
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1152 call s:File2Func( 'arg2' )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1153 END
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1154 call writefile(lines, 'Xtest2.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1155
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1156 let file1 = getcwd() .. '/Xtest1.vim'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1157 let file2 = getcwd() .. '/Xtest2.vim'
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1158
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1159 " 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
1160 let buf = RunVimInTerminal(
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1161 \ '-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
1162 \ #{wait_for_ruler: 0})
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1163
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1164 call CheckDbgOutput(buf, [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1165 \ 'Breakpoint in "' .. file1 .. '" line 1',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1166 \ '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
1167 \ 'command line..script ' .. file1,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1168 \ '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
1169 \ ], #{msec: 5000})
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1170
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 22969
diff changeset
1171 " 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
1172 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
1173 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
1174 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
1175 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
1176 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
1177
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1178 " 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
1179 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
1180 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
1181 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
1182 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
1183 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
1184 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1185 \'echo global_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1186 \[ 'E121: Undefined variable: global_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1187 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1188 \'echo local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1189 \[ 'E121: Undefined variable: local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1190 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1191 \'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1192 \[ '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
1193
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1194 " backtrace up
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1195 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1196 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1197 \ '\V 2 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1198 \ '\V 1 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1199 \ '\V->0 function <SNR>\.\*_File1Func',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1200 \ '\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
1201 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1202 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1203 call RunDbgCmd(buf, 'up', [ '>up' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1204
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1205 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1206 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1207 \ '\V 2 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1208 \ '\V->1 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1209 \ '\V 0 function <SNR>\.\*_File1Func',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1210 \ '\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
1211 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1212 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1213
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1214 " Expression evaluation in the script frame (not the function frame)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1215 " FIXME: Unexpected in this scope (a: should not be visibnle)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1216 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
1217 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
1218 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
1219 " 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
1220 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1221 \'echo global_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1222 \[ 'E121: Undefined variable: global_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1223 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1224 \'echo local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1225 \[ 'E121: Undefined variable: local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1226 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1227 \'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1228 \[ '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
1229
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1230
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1231 " 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
1232 call RunDbgCmd(buf, 'step', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1233 \ '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
1234 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1235 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1236 \ '\V 2 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1237 \ '\V 1 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1238 \ '\V->0 function <SNR>\.\*_File1Func',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1239 \ '\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
1240 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1241 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1242
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1243 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
1244 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
1245 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
1246
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1247 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
1248 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
1249 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1250 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1251 \ '\V 3 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1252 \ '\V 2 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1253 \ '\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
1254 \ '\V->0 script ' .. file2,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1255 \ '\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
1256 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1257 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1258
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1259 " 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
1260 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
1261 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1262 \ 'echo s:file1_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1263 \ [ '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
1264 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
1265 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
1266 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1267 \'echo local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1268 \[ 'E121: Undefined variable: local_var' ] )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1269 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1270 \'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1271 \[ '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
1272 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1273 \ 'echo s:file2_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1274 \ [ '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
1275
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1276 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
1277 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
1278
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1279 " 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
1280 call RunDbgCmd(buf, 'up')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1281 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1282 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1283 \ '\V 3 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1284 \ '\V 2 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1285 \ '\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
1286 \ '\V 0 script ' .. file2,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1287 \ '\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
1288 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1289 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1290 " 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
1291 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
1292 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1293 \ 'echo l:local_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1294 \ [ '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
1295
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1296 call RunDbgCmd(buf, 'up')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1297 call RunDbgCmd(buf, 'backtrace', [
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1298 \ '\V>backtrace',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1299 \ '\V 3 command line',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1300 \ '\V->2 script ' .. file1 .. '[11]',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1301 \ '\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
1302 \ '\V 0 script ' .. file2,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1303 \ '\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
1304 \ ],
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1305 \ #{ match: 'pattern' } )
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1306
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1307 " 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
1308 call RunDbgCmd(buf,
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1309 \ 'echo s:file1_var',
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1310 \ [ '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
1311 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
1312
24895
e61a2085c89b patch 8.2.2985: Vim9: a compiled function cannot be debugged
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
1313 call RunDbgCmd(buf, 'cont')
21687
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1314 call StopVimInTerminal(buf)
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1315 call delete('Xtest1.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1316 call delete('Xtest2.vim')
83b618c0315d patch 8.2.1393: insufficient testing for script debugging
Bram Moolenaar <Bram@vim.org>
parents: 21508
diff changeset
1317 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21687
diff changeset
1318
21777
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1319 " 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
1320 " 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
1321 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
1322 func F()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1323 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
1324 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
1325 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
1326 endif
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1327 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1328 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1329
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1330 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
1331 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
1332 try
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1333 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
1334 debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1335 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
1336 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
1337 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
1338 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
1339 endtry
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1340 0debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1341 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
1342 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
1343 breakdel *
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1344 delfunc F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1345 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1346
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1347 " 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
1348 " 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
1349 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
1350 func F()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1351 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
1352 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
1353 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
1354 else
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1355 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1356 endif
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1357 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1358 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1359
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1360 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
1361 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
1362 try
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1363 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
1364 debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1365 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
1366 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
1367 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
1368 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
1369 endtry
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1370 0debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1371 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
1372 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
1373 breakdel *
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1374 delfunc F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1375 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1376
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1377 " 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
1378 " 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
1379 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
1380 func F()
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1381 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
1382 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
1383 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
1384 endwhile
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1385 invalid_command
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1386 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1387
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1388 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
1389 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
1390 try
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1391 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
1392 debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1393 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
1394 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
1395 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
1396 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
1397 endtry
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1398 0debuggreedy
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1399 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
1400 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
1401 breakdel *
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1402 delfunc F
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1403 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1404
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1405 " 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
1406 func Test_breakpt_scriptlocal_func()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1407 let g:Xpath = ''
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1408 func s:G()
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1409 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
1410 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1411
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1412 let funcname = expand("<SID>") .. "G"
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1413 exe "breakadd func 1 " .. funcname
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1414 debuggreedy
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1415 redir => output
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1416 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
1417 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
1418 0debuggreedy
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1419 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
1420 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
1421 breakdel *
21781
99fe9e960207 patch 8.2.1440: debugger code insufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 21777
diff changeset
1422 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
1423 endfunc
4279767da6e8 patch 8.2.1438: missing tests for interrupting script execution from debugger
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
1424
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21687
diff changeset
1425 " vim: shiftwidth=2 sts=2 expandtab