Skip to content

v8_inspector: Support the V8 debugger from within VM contexts #7593

Closed

Description

@ide

This is a feature request to support Node 6.3.0's V8 inspector capability (node --inspect) from within the vm module's contexts. For example:

vm.runInNewContext(code, sandbox, {
  inspect: 9999, // same as --inspect=9999
});

If it's not possible to make individual contexts inspectable, it'd also meet our needs to make other contexts inspectable if the parent Node process is running with --inspect. Currently code that runs in other contexts isn't debuggable (ex: debugger statements are ignored).

Activity

  1. changed the title [-]v8_inspector: Support the V8 debugger from with VM contexts[/-] [+]v8_inspector: Support the V8 debugger from within VM contexts[/+] on Jul 7, 2016
  2. added
    inspector
    vm
    feature request
    on Jul 7, 2016
  3. cpojer commented on Oct 24, 2016

    @cpojer

    node --inspect also doesn't stop for debugger; statements.

    Repro:

    var vm = require('vm');
    new vm.Script('debugger;').runInContext(vm.createContext());
    debugger;
    
  4. ide commented on Oct 24, 2016

    @ide
    ContributorAuthor

    @cpojer are you running Node with the --debug-brk option? You need that so that Node waits for you to connect the Blink Inspector since debugger statements are no-ops unless there is a debugger actively attached.

  5. cpojer commented on Oct 24, 2016

    @cpojer

    @ide yes, please see jestjs/jest#1652 for more details.

  6. hybrist commented on Oct 24, 2016

    @hybrist
    Contributor

    Quoting @bmeck (https://twitter.com/bradleymeck/status/790571493579116546):

    basically you need to setup

    void V8InspectorImpl::contextCreated(const V8ContextInfo& info)
    properly to work w/ vm module

  7. bmeck commented on Oct 24, 2016

    @bmeck
    Member

    can be based upon https://github.com/bmeck/node/tree/inspect-contexts , don't really have time to figure out segfaults currently but would need tests for sure to ensure GC properly works on this.

  8. added
    help wanted
    on Oct 24, 2016
  9. ofrobots commented on Oct 24, 2016

    @ofrobots
    Contributor

    The branch from @bmeck looks like a good starting point. This would be a really neat contribution.

    /cc @nodejs/v8-inspector.

  10. bmeck commented on Oct 25, 2016

    @bmeck
    Member

    i'll take this over, it seems like there is also a bug with the inspector not being synced the contexts on connect which makes this less trivial since we need to rejig the handshaking.

  11. self-assigned this
    on Oct 25, 2016
  12. removed
    help wanted
    on Oct 25, 2016
  13. 10 remaining items

  14. michahell commented on Jul 5, 2017

    @michahell

    ping. This issue is still causing JEST tests to not trigger on debugger; statements: jestjs/jest#1652

  15. aschrijver commented on Jul 12, 2017

    @aschrijver

    I just referred to this issue from stackoverflow after spending more than a day on setting up debugging, without results! FYI: https://stackoverflow.com/questions/45056952/debugging-jest-unit-tests-with-breakpoints-in-vs-code-with-react-native

  16. aschrijver commented on Jul 12, 2017

    @aschrijver

    Are there any debuggers besides Chrome and VS Code that I can use to debug using V8 or should I downgrade and bide my time?

    [UPDATE: I decided to downgrade to node 7 and now debugging in VS Code is a breeze! See details...]

  17. self-assigned this
    on Jul 14, 2017
  18. wangxuepeng commented on Jul 25, 2017

    @wangxuepeng

    Downgrade to 7.10.1 to work-around the issue. Keep watching on this.

  19. hakunin commented on Jul 26, 2017

    @hakunin

    @cpojer Maybe FB should donate a developer to the node project for a few months so we can get somewhere :D

  20. jgoz commented on Aug 11, 2017

    @jgoz

    @eugeneo This is closed now that #14465 is merged, right?

  21. ide commented on Aug 17, 2017

    @ide
    ContributorAuthor

    Closing this since Node 8.4.0 supports attaching to vm contexts out of the box.

  22. jbeard4 commented on Aug 24, 2017

    @jbeard4

    Source maps are ignored in chrome dev tools for code that is evaluated using vm.runInContext.

  23. added a commit that references this issue on Mar 14, 2018
  24. added a commit that references this issue on Mar 15, 2018
  25. added a commit that references this issue on Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature requestinspectorvm

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions