Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support conditional breakpoints #95

Open
TamaMcGlinn opened this issue Nov 15, 2020 · 2 comments
Open

Support conditional breakpoints #95

TamaMcGlinn opened this issue Nov 15, 2020 · 2 comments

Comments

@TamaMcGlinn
Copy link

If anyone wants to help me in adding support for conditional breakpoints, please do.

For example, gdb will accept this command:

break filename:20 if strcmp(y, "hello") == 0

So the basic idea is to add a function like ./std.vim:351:function! vebugger#std#toggleBreakpoint(file,line) but which accepts an additional expression, which is provided in the mapping using input, for example, adding in plugin/vebugger.vim:75:

"	\'k':'exe "VBGaddConditionalBreakpointThisLine ".input("Conditional> ")',

If there is already a breakpoint on that line, this could give an error (the user should have done a toggle first to remove the breakpoint) - this has the advantage of not throwing away data (the condition) silently. On the other hand, it might be more intuitive to just remove the existing one first, effectively overwriting the condition.

You can already use :VBGrawWrite to achieve the conditional breakpoint, with the disadvantages:

  • there is no highlighting of the line, since vebugger hasn't registered this as a breakpoint. subsequently 'toggling' the breakpoint in fact removes the conditional breakpoint and adds a regular one.
  • you have to type in the name of the file and the current line number (this can be solved with %h and something to get the line number, and creating your own mapping)
@TamaMcGlinn
Copy link
Author

Another very useful feature in this would be to display the condition somehow when the cursor is on the line of a conditional breakpoint.

@TamaMcGlinn
Copy link
Author

I'm sure I've made important mistakes, as I never code in vimscript and my vimscript langserver isn't working, but I've put my first attempt up here: https://github.com/TamaMcGlinn/vim-vebugger/tree/feature/conditional_breakpoints

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant