Added commands
to move around backtrace.
resolves albfan/vim#2
https://github.com/vim/vim/pull/433
—
Reply to this email directly or view it on GitHub.
On my fork issue there's a complete test case (working). My plan is to use it on albfan/vim-breakpts to enhance backtrace view (working too, but without evaluation on different levels be cause of this).
I have compiled and test it manual y. Is there a test framework on project to check features?
Is there a test framework on project to check features?
There are various tests in the testdir/ directory. I am not sure however, if testing the internal debugger will work. You could set up a breakpoint, show the backtrace and continue running the script and at the end store the :mess output.
I have 2 remarks:
1) The patch produces these warnings.
ex_cmds2.c: In function ‘do_debug’:
ex_cmds2.c:269:51: warning: pointer targets in passing argument 1 of ‘strdup’ differ in signedness [-Wpointer-sign]
char * frame = strdup(sourcing_name);
^
In file included from os_unix.h:542:0,
from vim.h:282,
from ex_cmds2.c:14:
/usr/include/string.h:176:14: note: expected ‘const char *’ but argument is of type ‘char_u *’
extern char *strdup (const char *__s)
^
ex_cmds2.c:270:37: warning: declaration of ‘p’ shadows a previous local [-Wshadow]
char * p = strtok(frame, "..");
^
ex_cmds2.c:95:13: warning: shadowed declaration is here [-Wshadow]
char_u *p;
^
2) the backtrace looks very useful. I am not sure however how the up and down are supposed to behave. Pressing [u]p/[d]own will make the indicator in the backtrace move up, but the debugger will continue to work from the last level. Other than that, I haven't seen any other thing happening when pressing up/down. So could you please clarify, how it is supposed to work?
Maybe a test can be created based on debuggredy I will check existing test and see what can be automated.
I was sure there will be warnings about <sfile>
split. I will correct them.
About this feature I will copy verbatim the test case on my fork albfan/vim#2
function Foo() let var1 = 5 let var2 = call Bar(var1) endfunction function Bar(var) let var2 = 7 return a:var + var2 endfunction
A desired debug session
:debug Foo() >step >next >backtrace #0 function Foo() >1 function Bar() >echo var2 7 >echo var1 (undefined) >up >echo var1 5 >backtrace >0 function Foo() #1 function Bar()
see when you issue up, you are in the context of funccall_T.caller (one level up) so you can evaluate functions on up level to see why you get to that point in debug.
It's better to see it visually as albfan/vim-breakpts offers. You can navigate through call stack using ":BPDBacktrace" and if you have patch 7.4.879. I can implement an usage for up and down commands to been able to use :BPDLocals
in current select stacktrace level (see you need to use my fork of vim because I don't know how to detect vim used will have up and down commands)
I will post the branch on albfan/vim-breakpts as soon as possible
I will add command arg for backtrace, so you can do
> backtrace 1
or relative
> b +1
> b -2
to use on plugin vim-breakpts.
I'm working on test for this too.
I have created a test with all new functionality. src/testdir/test108.in
I'm not sure about the format to show backtrace. Any suggestion is appreciated
Something not implemented is the "drop to frame" or "step back" functionality:
https://sourceware.org/gdb/current/onlinedocs/gdb/Reverse-Execution.html#Reverse-Execution
Let me know if that would be a desirable functionality. Seems affordable at this point.
—
Here is all implemented. Just a note about frame (there are collisions):
I wil change frame layout to mimic gdb in no time
Here is all implemented. Just a note about frame (there are collisions):
- f issues file
- fi[nish]
- fr[ame]
I wil change frame layout to mimic gdb in no time
Although that sound understandable, that is not the way debug works on vim. See before this proposal, f
has no collisions and executes directly finish
command:
albfan@bd249d9#diff-28790a430300cd187bda51bd6a014757L200
I have added frame
as a @brammool suggestion, prior implementation do the frame
command behaviour on backtrace
command (with no debug command collisions), so at this point don't know really what command should take priority. This implementation see f
as collisions between finish
and frame
and left to the command to be interpreted as no debug vim command, but after that fi
or fr
are recognized as indubitable debug command and executed.
I will implement this the way you want, but to me sounds reasonable to give priority to debug commands in a debug session, so I would prefer to leave it this way or better off directly choose finish
issuing f
as users would expect before this change.
—
I will fix in a while
declaration, char_u and trailing space are fixed.
I have rebased to tip and now there's some problem with test_tagcase
There are still compiler warnings with clang.
https://travis-ci.org/vim/vim/jobs/94578356#L742
Opps. That was char* before my change. I have fixed it. I will check throughly CI outputs
I can't find more warnings, but now test86 fails on appveyor. Really don't know why
I can't find more warnings, but now test86 fails on appveyor. Really don't know why
test86 sometimes fails on appveyor, so could you restart build?
I just can launch a nuild on my account. Seems to be working
https://ci.appveyor.com/project/albfan/vim/history
test86 sometimes fails on appveyor
This is another problem.
See the history.
https://ci.appveyor.com/project/chrisbra/vim/history
code rebased. now:
test_listlbr_utf8 FAILED
Feeling kind of beta tester.
As supossed, wait is the way to go. test suite has been revamped and now all test pass and coverage has increased.
Let me know if there's anything else to do or rework
I'm a profuse plugin developer, I find myself always tweaking vim plugins, and this feature is unvaluable to detect where a plugin goes wrong (or where some variable value comes from)
Is there anything else I can do to merge this PR?
I suppose coveralls fails on rebase. Is it a known issue?
Here is a arch linux AUR package to test this feaure
https://github.com/albfan/aur-vim
I finally review your commit against my PR. Lot of lessons learned.
I tagged it for easy review:
albfan@backtrace-PR...albfan:backtrace-PR-merge