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

Update WATCH area from debugger #114990

Closed
maziac opened this issue Jan 5, 2021 · 7 comments
Closed

Update WATCH area from debugger #114990

maziac opened this issue Jan 5, 2021 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@maziac
Copy link

maziac commented Jan 5, 2021

I have the following problem:
There is data in the WATCH area. This is updated on every debug step.
So far, so good.

How is it possible to update this programmatically.

In my case the user has the possibility to change data in a memory dump in a WebView.
When he does so the WATCH area is not updated because it is not informed to do so.

Is there any possibility to update the WATCH area initiated by the extension?
Is there a message I can send via the debug adapter protocol to do so?

@connor4312
Copy link
Member

We recently added an invalidated event that should work here https://microsoft.github.io/debug-adapter-protocol/specification#Events_Invalidated

@maziac
Copy link
Author

maziac commented Jan 5, 2021

Hi, this in fact is what I was searching for. I tested it and in general it works.
I send simply

new InvalidatedEvent()

and the data in the WATCH area is refreshed.

However there is maybe a flaw in this mechanism since I cannot expand the variable structures anymore after
InvalidatedEvent is sent until the next debug step.
Please see the attached gif:
invalidated
This happens also on root level of the variable.

@weinand weinand self-assigned this Jan 26, 2021
@weinand
Copy link
Contributor

weinand commented Jan 26, 2021

Moving to VS Code, since implementation issues are out of scope of the DAP.

@weinand weinand transferred this issue from microsoft/debug-adapter-protocol Jan 26, 2021
@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Jan 26, 2021
@isidorn isidorn added the info-needed Issue requires more information from poster label Jan 26, 2021
@isidorn
Copy link
Contributor

isidorn commented Jan 26, 2021

@maziac thanks for providing feedback. As @connor4312 has mentioned an invalidated event should hopefully just work.
Also make sure to send to send the areas = ['variables'] as part of your invalidated event.
Here's how we handle that in vscode https://github.com/microsoft/vscode/blob/fc5f18691dcfd22952c4c2d7cdfb2ae5102535eb/src/vs/workbench/contrib/debug/browser/debugSession.ts#L1021

If this still does not work, it would be great if you create a fork of mock-debug that reproduces this problem, so I can simply clone your fork of mock-debug and investgiate more on my machine.
Thanks!

@maziac
Copy link
Author

maziac commented Jan 26, 2021

Yes, ['variables'] seems to do the trick.
Do you have some explanation for it?
I would guess that invalidate without an info would update 'all'. Why does it work if I narrow the request?
And why do I have to use 'variables' and not 'watch'?

From the docs: "If this property is missing, empty, or if values are not understand the client should assume a single value 'all'"
I tried also a value of 'all' and that does not work either.

What other areas do exist? The documentation does not mention them.

@isidorn
Copy link
Contributor

isidorn commented Jan 27, 2021

Yeah, the code here is the reason

// If invalidated event only requires to update variables, do that, otherwise refatch threads https://github.com/microsoft/vscode/issues/106745

I can change it to also handle the 'watch' as the area. Thus assigning to January

@isidorn isidorn added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Jan 27, 2021
@isidorn isidorn added this to the January 2021 milestone Jan 27, 2021
@isidorn
Copy link
Contributor

isidorn commented Jan 27, 2021

I have pushed a change that now you can aslo send watch as part of the areas.
The reason why we handle it like that is that if the area is not specified that means a "hard refresh" and we will refatch the threads. I would guess that for your debug adapter refatching threads changes some ids and thus it is no longer possible to expand some watch values.

However I would not be happy making more changis in this area since Java debugger depends on this behavior, thus closing this for now, and I suggest that you simply send the areas array.

@connor4312 connor4312 added the verified Verification succeeded label Jan 28, 2021
plainerman pushed a commit to plainerman/vscode that referenced this issue Feb 2, 2021
MarcoZehe pushed a commit to MarcoZehe/vscode that referenced this issue Feb 3, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants
@weinand @isidorn @connor4312 @maziac and others