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
Add support for data breakpoints #134
base: master
Are you sure you want to change the base?
Conversation
lua/dap.lua
Outdated
|
||
function M.listeners.after.event_terminated.databreakpoints() | ||
for key, bp in pairs(data_bp_info) do | ||
if not bp.canPersist then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not only check whether they can persist, but also save from which debug adapter they where generated. We can only reuse them with the same debug adapter.
4b42ba5
to
6cfe8ac
Compare
|
||
if variable then | ||
local parent | ||
for _, p in pairs(state.line_to_variable) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will only work when the parent is also display in this variable buffer. So if the breakpoint is set on any of the non-root elements. A depth search on current_frame.variables
might be more precise.
09fd9b8
to
916a790
Compare
lua/dap.lua
Outdated
end | ||
|
||
|
||
function M.toggle_data_breakpoint(resolve_expression_fn, condition, hit_condition) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DAP protocol allows data breakpoints to be an arbitrary expression. But I don't use an adapter that supports this to test.
9b19f0f
to
1073b74
Compare
1073b74
to
a0949c2
Compare
Sorry for not getting back to this earlier, I wanted to wrap up some of the other stuff I was working on first. Quite a bit has changed in the module structures so it looks like this PR would have to be adjusted. Are you still up for that? |
I guess this could be split into multiple PRs. If you want you can take the methods for I may have time for this next week. |
Early WIP, picking up #134 but implemented on top of widget & entity - [ ] Refine user API - [ ] Variable render should indicate if there is an active data breakpoint - [ ] Handle persistence (Do they go into dap.breakpoints, new module, or are part of the session) - [ ] What goes into entity and what into session
First draft for data breakpoints. Program execution will stop when the specified variable/expression is modified. Since in the video it its not 100% obvious why the program has stopped, I added some message after capturing the screencast.
databreakpoint.mp4
They can persist over sessions. Java debug adapter only supports data breakpoints for value contained in some kind of container (a class or object) not free standing stack variables like a loop counter
i
nor more general expressions.