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

Comments

@auchenberg
Copy link
Contributor

commented Apr 6, 2018

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 bug labels Apr 6, 2018

@weinand weinand added this to the April 2018 milestone Apr 6, 2018

@roblourens

This comment has been minimized.

Copy link
Member

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 added a commit to microsoft/vscode-chrome-debug-core that referenced this issue Apr 23, 2018

@weinand

This comment has been minimized.

Copy link
Member

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 label Apr 25, 2018

@roblourens

This comment has been minimized.

Copy link
Member

commented Apr 25, 2018

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.

@weinand

This comment has been minimized.

Copy link
Member

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.

@roblourens

This comment has been minimized.

Copy link
Member

commented Apr 25, 2018

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 roblourens closed this Apr 26, 2018

roblourens added a commit that referenced this issue Apr 26, 2018

@mjbvz mjbvz added the verified label Apr 27, 2018

@auchenberg

This comment has been minimized.

Copy link
Contributor Author

commented Apr 27, 2018

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

@roblourens

This comment has been minimized.

Copy link
Member

commented Apr 27, 2018

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

This comment has been minimized.

Copy link
Contributor Author

commented Apr 28, 2018

@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.
Projects
None yet
5 participants
You can’t perform that action at this time.