-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: break in eval script #14581
Conversation
What I don't like about this solution is that the wrapper is reported to frontend. E.g. running process.binding('inspector').callAndPauseOnStart(function() {
console.log(3);
}, {}) Alternative would be to modify the node_contextify.cc to add a parameter to break on the first line of the code ran in the context. I am not sure this is something that should be done for just debugging the eval scripts. |
@@ -420,7 +427,7 @@ | |||
const module = new Module(name); | |||
module.filename = path.join(cwd, name); | |||
module.paths = Module._nodeModulePaths(cwd); | |||
const body = process._eval; | |||
const body = wrapForBreakOnFirstLine(process._eval); | |||
const script = `global.__filename = ${JSON.stringify(name)};\n` + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it work better if you applied wrapForBreakOnFirstLine
to script
, not to body
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the entire block will be reported as source and actual user code will be a string - e.g. it will not be possible to set a breakpoint there. Stepping into the vm module will be required in order to step into the user code.
PTAL @nodejs/v8-inspector |
@nodejs/collaborators PTAL |
LGTM. I feel like there could be a few weird edge cases with this approach, but if so I guess just seeing when they show up is fine. |
@eugeneo I think this might need to be updated |
I added "in progress" label as this PR needs some rework due to changes elsewhere. |
As it turns out, a number of tests were relying on this bug. I updated them to expect the new breakpoint and adjusted the line numbers. |
@eugeneo by the way, the typo is still in the commit message … ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM
Another CI attempt - https://ci.nodejs.org/job/node-test-pull-request/10146/ |
Windows CI failed because of an issue that's already fixed. Here is another run with the same parameters: https://ci.nodejs.org/job/node-test-commit-windows-fanned/11803/ |
Fixes: #14577 PR-URL: #14581 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
This CI does not seems to indicate any regressions caused by this PR: https://ci.nodejs.org/job/node-test-pull-request/10147/ |
Landed as 75606c4 |
Fixes: #14577 PR-URL: #14581 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: nodejs/node#14577 PR-URL: nodejs/node#14581 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: nodejs/node#14577 PR-URL: nodejs/node#14581 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #14577
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
eval scripts are now wrapped into inspector call to break on a first line.