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 --inspect ignores debugger statements and breakpoints inside vm.runInContext #12096

Closed
clarabstract opened this issue Mar 28, 2017 · 8 comments
Assignees
Labels
inspector Issues and PRs related to the V8 inspector protocol vm Issues and PRs related to the vm subsystem.

Comments

@clarabstract
Copy link

  • Version: 7.73
  • Platform: Windows (10, 64bit)
  • Subsystem: v8-debug (?)

The chrome-devtools:// view correctly displays the console output, is aware of the files being executed using vm.runInContext (with filename set), even lets me set breakpoints in them, it just doesn't actually break for them.

I forward the outer console object into the vm context so console.log statements get correctly printed out by the inspector and I can dig through objects, assign them etc. (though it crashes when accessing certain objects - by the looks of it, it doesn't keep a GC reference to them so they are probably just no longer there).

I'm hoping there is a similar mechanism I can use to have the VM's debug context share the outer one?

@richardlau
Copy link
Member

cc @nodejs/diagnostics

@eugeneo
Copy link
Contributor

eugeneo commented Mar 28, 2017

There is a pull request that is trying to address this: #7593

Currently this is all blocked on old debugger getting deprecated/disabled - then we will be able to enable the inspector sooner and track all VM contexts. I will assign this issue to me for now.

@eugeneo eugeneo self-assigned this Mar 28, 2017
@mscdex mscdex added inspector Issues and PRs related to the V8 inspector protocol vm Issues and PRs related to the vm subsystem. labels Mar 28, 2017
@clarabstract
Copy link
Author

Thanks!
Is using the old debugger going to work for the time being? (and is that node debugger or node --debug?)

Alternately, what's the last version where it would work?

@eugeneo
Copy link
Contributor

eugeneo commented Mar 28, 2017

I do not know if --debug supports multicontext.

node debug is a CLI debugger that uses --debug as a protocol.

@xtaltas
Copy link

xtaltas commented Apr 24, 2017

--debug works most of the time to debug context as long as you set "debugger" instructions within the code executed in the context. But it is not a very efficient protocol to debug Promises. It would be great if it could be fixed. Anyway we can help?

@eugeneo
Copy link
Contributor

eugeneo commented Apr 25, 2017

This issue a dublicate of #7593

jgoz pushed a commit to jgoz/node that referenced this issue Jun 20, 2017
This enables inspector support for contexts created using the vm
module.

Fixes: nodejs#7593
Fixes: nodejs#12096
Refs: nodejs#9272
@Trott
Copy link
Member

Trott commented Aug 16, 2017

Did #14465 solve this?

@jkrems
Copy link
Contributor

jkrems commented Aug 16, 2017

Verified that in node 8.4.0 the following breaks as expected:

node --inspect-brk -e 'vm.runInNewContext("const obj = { log: console.log };\nobj.log(1);\ndebugger;\nobj.log(2);", { console })'

I think this is good to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inspector Issues and PRs related to the V8 inspector protocol vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants