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

Sometimes, Closure Variables are not available in the Debug Console / Watch window #737

Open
hediet opened this issue Sep 5, 2020 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality

Comments

@hediet
Copy link
Member

hediet commented Sep 5, 2020

Sometimes, variables from the Closure section are not available in the Debug Console / Watch window:

image

This is what the debug console reports:

image

I wonder whether there is a way to overcome that.

@hediet hediet added the feature-request Request for new features or functionality label Sep 5, 2020
@connor4312
Copy link
Member

connor4312 commented Sep 5, 2020

This is the same as microsoft/vscode#12066. I want to look at tacking that at some point... it's a good chunk of work. It requires the debugger to parse and understand the runtime scripts, because sourcemaps only give us a mapping between source positions and names, it doesn't say "here's a variable, here's a function argument." At the moment, we never look at source content or try to parse anything, we rely only in CDP messages from the debug targets.

Participation of the source content in debugging will also unlock a few other advanced scenarios, such as smarter deminification, referenced in #371 (comment)

@connor4312 connor4312 added the *duplicate Issue identified as a duplicate of another issue(s) label Sep 5, 2020
@hediet
Copy link
Member Author

hediet commented Sep 5, 2020

Thanks for your quick response on a Saturday ;)

Variable mapping would be awesome too, but this issue is about closure variables. As you can see, vscode_1 is in the closure and vscode can explore the content, but it is not accessible in the Debug console. I guess this is a nodejs problem though - I will try to reproduce the issue with the chrome debugger for nodejs.

Or did I misunderstand you?

@connor4312
Copy link
Member

connor4312 commented Sep 5, 2020

Oh, apologies.

That's a V8 optimization, it optimizes away variables unused in the current scope. However we could be clever and hoist those like we do $returnValue.

@connor4312 connor4312 reopened this Sep 5, 2020
@connor4312 connor4312 removed the *duplicate Issue identified as a duplicate of another issue(s) label Sep 5, 2020
@JesusTheHun
Copy link

JesusTheHun commented Dec 7, 2023

@connor4312 is there any way to disable such optimization ? I tried several node flags without success.
This gets really annoying during some debug sessions.

EDIT : even if it means we have to recompile node

@connor4312
Copy link
Member

Maybe, but I'm not an expert on v8 internals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants