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

inspector: migrate process.binding to internalBinding #24931

Closed
wants to merge 1 commit into from
Closed

inspector: migrate process.binding to internalBinding #24931

wants to merge 1 commit into from

Conversation

BeniCheni
Copy link
Contributor

@BeniCheni BeniCheni commented Dec 10, 2018

Refs #22160, this PR attempts to migrate process.binding('inspector') to internalBinding('inspector').

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

In places of process.binding('inspector'), migrate code to adapt
internalBinding.

Refs: #22160
@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Dec 10, 2018
@joyeecheung
Copy link
Member

joyeecheung commented Dec 10, 2018

@BeniCheni
Copy link
Contributor Author

BeniCheni commented Dec 10, 2018

Hi reviewers,

Would like some mentoring on these observations.

Couldn't change these inline code w. process.binding('inspector'). If using internalBinding('inspector'), tests seemed to failed with ReferenceError: internalBinding is not defined:

return `process.binding('inspector')...`
const script = `
  ...
  if (!process.binding('inspector').isEnabled()) return;
const script = `
...
const inspector = process.binding('inspector');

Another observation is when seemingly inside a child process, I would also run into failed test if using internalBinding

if (process.argv[2] === 'child') {
  ...
  const { registerAsyncHook } = process.binding('inspector');

P.S.: I've experimented w. // Flags: --expose-internals & const { internalBinding } = require('internal/test/binding');, but no luck.

@devsnek
Copy link
Member

devsnek commented Dec 10, 2018

wrapForBreakOnFirstLine is concerning. i think we should be able to use the inspector api to set a breakpoint instead of modifying the code? cc @nodejs/v8-inspector

@joyeecheung
Copy link
Member

@BeniCheni

For the test failures (ReferenceErrors), you'd need to obtain internalBinding via const { internalBinding } = require('internal/test/binding'); (which also needs --expose-internals)

For the wrapForBreakOnFirstLine, maybe instead of wrapping the source and pass it to callAndPauseOnStart, prepending a debugger; statement to the source would work, but I am not really sure

@joyeecheung
Copy link
Member

BTW, do we even need to wrap that in wrapForBreakOnFirstLine? module._compile is already wrapping the source with callAndPauseOnStart if process._breakFirstLine is true

@joyeecheung
Copy link
Member

I implemented the part about -e --inspect-brk in #24946 since it involves quite of bit of changes in the inspector tests.

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 12, 2018
@danbev
Copy link
Contributor

danbev commented Dec 13, 2018

Landed in 0500237.

@danbev danbev closed this Dec 13, 2018
danbev pushed a commit that referenced this pull request Dec 13, 2018
In places of process.binding('inspector'), migrate code to adapt
internalBinding.

PR-URL: #24931
Refs: #22160
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@BeniCheni BeniCheni deleted the inspector-internal-binding branch December 13, 2018 04:48
@MylesBorins
Copy link
Contributor

This doesn't land cleanly on v11.x, would someone be willing to make a backport?

BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 9, 2019
In places of process.binding('inspector'), migrate code to adapt
internalBinding.

PR-URL: nodejs#24931
Refs: nodejs#22160
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
BridgeAR pushed a commit that referenced this pull request Jan 10, 2019
In places of process.binding('inspector'), migrate code to adapt
internalBinding.

PR-URL: #24931
Refs: #22160
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
joyeecheung pushed a commit to joyeecheung/node that referenced this pull request Jan 11, 2019
In places of process.binding('inspector'), migrate code to adapt
internalBinding.

PR-URL: nodejs#24931
Refs: nodejs#22160
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
addaleax pushed a commit that referenced this pull request Jan 14, 2019
In places of process.binding('inspector'), migrate code to adapt
internalBinding.

PR-URL: #24931
Refs: #22160
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
addaleax pushed a commit that referenced this pull request Jan 14, 2019
In places of process.binding('inspector'), migrate code to adapt
internalBinding.

PR-URL: #24931
Refs: #22160
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>

Backport-PR-URL: #25446
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
In places of process.binding('inspector'), migrate code to adapt
internalBinding.

PR-URL: nodejs#24931
Refs: nodejs#22160
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Jan 16, 2019
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
In places of process.binding('inspector'), migrate code to adapt
internalBinding.

PR-URL: nodejs#24931
Refs: nodejs#22160
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
In places of process.binding('inspector'), migrate code to adapt
internalBinding.

PR-URL: nodejs#24931
Refs: nodejs#22160
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>

Backport-PR-URL: nodejs#25446
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants