microsoft / vscode-mock-debug

Starter sample for developing debug adapters for VSCode.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should debug protocol support variables for evaluate expression?

paulo-fernando-silva opened this issue · comments

commented

I would like to start a discussion on watches and why the debugger should have the option to return a Variable if it knows the expression is one of the variables already referenced in the current scope. Not sure where to do it though. Here or on the vsc repo, or even somewhere else.

The idea is that if we know the expression is a variable it can be much more efficient to return a reference to it than to evaluate it again. Especially when the variables is expensive to evaluate.

"Watches" are evaluated whenever the debuggee is stopped.

Since the debugger frontend in VS Code does not know whether a "watch" (arbitrary expression) depends on other variables that might have changed, we cannot shortcut the re-evaluation and just return the variable.

However, if a debug adapter knows all the dependencies between watches, it can shortcut inside its implementation of the "evaluate" request.