Mercurial > vim
diff src/testdir/test108.in @ 7605:8fc60af6dbf5 v7.4.1102
commit https://github.com/vim/vim/commit/f1f60f859cdbb2638b3662ccf7b1d179865fe7dc
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 16 15:40:53 2016 +0100
patch 7.4.1102
Problem: Debugger has no stack backtrace support.
Solution: Add "backtrace", "frame", "up" and "down" commands. (Alberto
Fanjul, closes https://github.com/vim/vim/issues/433)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Jan 2016 15:45:04 +0100 |
parents | |
children | 503534e56ce1 |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/src/testdir/test108.in @@ -0,0 +1,87 @@ +Tests for backtrace debug commands. vim: set ft=vim : + +STARTTEST +:so small.vim +:function! Foo() +: let var1 = 1 +: let var2 = Bar(var1) + 9 +: return var2 +:endfunction +: +:function! Bar(var) +: let var1 = 2 + a:var +: let var2 = Bazz(var1) + 4 +: return var2 +:endfunction +: +:function! Bazz(var) +: let var1 = 3 + a:var +: let var3 = "another var" +: return var1 +:endfunction +:new +:debuggreedy +:redir => out +:debug echo Foo() +step +step +step +step +step +step +echo "- show backtrace:\n" +backtrace +echo "\nshow variables on different levels:\n" +echo var1 +up +back +echo var1 +u +bt +echo var1 +echo "\n- undefined vars:\n" +step +frame 2 +echo "undefined var3 on former level:" +echo var3 +fr 0 +echo "here var3 is defined with \"another var\":" +echo var3 +step +step +step +up +echo "\nundefined var2 on former level" +echo var2 +down +echo "here var2 is defined with 10:" +echo var2 +echo "\n- backtrace movements:\n" +b +echo "\nnext command cannot go down, we are on bottom\n" +down +up +echo "\nnext command cannot go up, we are on top\n" +up +b +echo "fil is not frame or finish, it is file" +fil +echo "\n- relative backtrace movement\n" +fr -1 +frame +fra +1 +fram +echo "\n- go beyond limits does not crash\n" +fr 100 +fra +frame -40 +fram +echo "\n- final result 19:" +cont +:0debuggreedy +:redir END +:$put =out +:w! test.out +:qa! +ENDTEST +