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

Node LogPoints shows up as the VM source in debug console #47274

Closed
auchenberg opened this issue Apr 6, 2018 · 8 comments
Closed

Node LogPoints shows up as the VM source in debug console #47274

auchenberg opened this issue Apr 6, 2018 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality release-notes Release notes issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@auchenberg
Copy link
Contributor

Per conversation microsoft/vscode-node-debug#174

Node LogPoints shows up as a virtual source, and not a real source from where the LogPoint is set.

Example:

screen shot 2018-04-05 at 7 20 29 pm

@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues bug Issue identified by VS Code Team member as probable bug labels Apr 6, 2018
@weinand weinand added this to the April 2018 milestone Apr 6, 2018
@roblourens
Copy link
Member

roblourens commented Apr 22, 2018

The log event from Node contains the full stack, but the top frame is in an eval context. So I just have to identify a message from a logpoint and knock off the top frame.

I could do this by adding an extra argument to the end of the console.log that we send to the runtime with some identifiable string that identifies this log event as belonging to a logpoint. It's simple but the magic string would show up if you attach Chrome devtools at the same time.

Or I could look at the stack and check whether it comes from a line that we have an active logpoint on.

I'll go with the first for now as it's simpler and stateless.

@weinand weinand removed their assignment Apr 23, 2018
@roblourens roblourens added the release-notes Release notes issues label Apr 23, 2018
roblourens added a commit to microsoft/vscode-chrome-debug-core that referenced this issue Apr 23, 2018
@weinand
Copy link
Contributor

weinand commented Apr 25, 2018

Your approach works fine for the debug console but in the integrated terminal it results in this:

2018-04-25_16-18-42

Instead of using $vscode_logpoint_expr$ you could use a few strange characters and the same number of backspace characters. This would result in something invisible in the integrated or external terminal ;-)

Or just use some NO-OP ANSI-Escape sequence...

@weinand weinand added the verified Verification succeeded label Apr 25, 2018
@roblourens
Copy link
Member

Dang... I'm worried that using special characters could cause weird issues somewhere. But it would be easier.

I could also use sourceURL on the script to tag it as ours.

@roblourens roblourens reopened this Apr 25, 2018
@roblourens roblourens added verification-found Issue verification failed and removed verified Verification succeeded labels Apr 25, 2018
@weinand
Copy link
Contributor

weinand commented Apr 25, 2018

"I could also use sourceURL on the script to tag it as ours."

I don't know how this works, but it sounds good!

Alternative:
Since you can find the eval script ID in the stack trace on the receiving side (where the Output event is generated), you could add the $vscode_logpoint_expr$ marker as a comment to the script and detect that later.

Or you could wrap the console.log in another function with a special marker name so you could find it easily in the stack.

@weinand weinand added the feature-request Request for new features or functionality label Apr 25, 2018
@roblourens
Copy link
Member

If you add a special comment to the end of an evaluated script, //# sourceURL="myscript" then it will be reported as having a url of myscript. F12 did this with all evaluated scripts so they could be filtered from the UI, I have an issue somewhere to do the same.

roblourens added a commit to microsoft/vscode-chrome-debug-core that referenced this issue Apr 26, 2018
roblourens added a commit to microsoft/vscode-chrome-debug-core that referenced this issue Apr 26, 2018
roblourens added a commit that referenced this issue Apr 26, 2018
@roblourens roblourens removed the verification-found Issue verification failed label Apr 26, 2018
@mjbvz mjbvz added the verified Verification succeeded label Apr 27, 2018
@chrmarti chrmarti added the verification-needed Verification of issue is requested label Apr 27, 2018
@auchenberg
Copy link
Contributor Author

@roblourens Doesn't this change make all logpoints showup coming from the same file, and not the original?

@roblourens
Copy link
Member

No, I use sourceURL to mark them as logpoints so I know to hide the eval stack frame. The user won't see it.

@auchenberg
Copy link
Contributor Author

@roblourens Roger

@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 10, 2018
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 feature-request Request for new features or functionality release-notes Release notes issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants