-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
loader: fix --inspect-brk #18949
loader: fix --inspect-brk #18949
Conversation
Could you add a test? |
side question to anyone who can answer, why can't we just do something like void PauseOnStart(const FunctionCallbackInfo<v8::Value>& args) {
Environment* env = Environment::GetCurrent(args);
env->inspector_agent()->PauseOnNextJavascriptStatement("Break on start");
} if (this.inspectBrk)
process.binding('inspector').pauseOnStart();
this.module.instantiate(); |
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.
edit: i found test-inspector-esm.js 👍 |
@devsnek Because that would break on |
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.
Looks good - I just copied the approach from #17360 exactly when doing this initially to get this feature moving. Edit: ah, I see I tried to move the wrapper to avoid an instance property which was the issue here!
I did experiment wrapping the break on the execution function itself to no success, this only seems to be working when wrapping instantiate specifically. If there's a way to get a pauseOnStart going there'd be no reason not to though surely.
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.
LGTM with a test.
We can't do it because next JS instruction will be before calling the function. I.e. instead of breaking inside the function (that is a user code) we will arrive to a function callsite, which is framework code. That will confuse the users a lot. |
i've been messing around with the tests but i just can't figure out this inspector stuff :( basically the test just needs to be modified to import one other module to ensure nothing is called out of band. i tried to make these changes but i started getting assertion errors from the test inspector wrapper about urls |
@devsnek could you share where exactly the test is giving you issues? It should just be adding another case https://github.com/nodejs/node/blob/master/test/parallel/test-inspector-esm.js#L107, or modifying that existing case to have a dependency right? |
@guybedford i did that earlier but but it keeps giving me an assertion error here: https://github.com/nodejs/node/blob/master/test/common/inspector-helper.js#L248 and i still really don't understand all this stuff but i've been slowly making my way through the devtools docs |
@devsnek what are the expected and actual values in that case that are failing? If it's pathing issues that may be a test bug. |
@guybedford i added uh const depUrl = UrlResolve(session.scriptURL(), 'message.mjs');
session.waitForBreakOnLine(0, depUrl); which throws an assertion error for i also changed |
@devsnek does the |
@guybedford i have no idea which module.js it refers to, but yea these changes work perfectly |
0741fcd
to
8e6594a
Compare
8e6594a
to
19a0ead
Compare
@guybedford it seems the test i made is working now, i'm running a full test run on my laptop then i'll spin up a ci and if that passes hopefully land this 🙏 |
@addaleax if i land this tonight or tomorrow we can still squeeze it into 9.7.0 right? |
cc @nodejs/build |
@devsnek Sorry, I wasn’t around when you posted that comment – if you think something is important enough to let a release wait for it, commenting in the release proposal might be best… Then again, I’d be happy to also prepare another 9.x release next week. |
landed in abd0d79 |
PR-URL: nodejs#18949 Fixes: nodejs#18948 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Notable Changes: * crypto: - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson) #17690 * lib: - v8_prof_processor works again 🎉 (Anna Henningsen) #19059 * loader: - --inspect-brk now works properly for esmodules (Gus Caplan) #18949 * src: - handle exceptions in env-\>SetImmediates (James M Snell) #18297 - make process.dlopen() load well-known symbol (Ben Noordhuis) #18934 * trace_events: - add file pattern cli option (Andreas Madsen) #18480 PR-URL: #19181
Notable Changes: * crypto: - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson) #17690 * lib: - v8_prof_processor works again 🎉 (Anna Henningsen) #19059 * loader: - --inspect-brk now works properly for esmodules (Gus Caplan) #18949 * src: - handle exceptions in env-\>SetImmediates (James M Snell) #18297 - make process.dlopen() load well-known symbol (Ben Noordhuis) #18934 * trace_events: - add file pattern cli option (Andreas Madsen) #18480 PR-URL: #19181
Notable Changes: * crypto: - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson) #17690 * http2: - Fixed issues with aborted connections in the HTTP/2 implementation (Anna Henningsen) #18987 #19002 * loader: - --inspect-brk now works properly for esmodules (Gus Caplan) #18949 * src: - make process.dlopen() load well-known symbol (Ben Noordhuis) #18934 * trace_events: - add file pattern cli option (Andreas Madsen) #18480 * Added new collaborators: - Chen Gang (MoonBall) https://github.com/MoonBall PR-URL: #19181
Notable Changes: * crypto: - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson) #17690 * http2: - Fixed issues with aborted connections in the HTTP/2 implementation (Anna Henningsen) #18987 #19002 * loader: - --inspect-brk now works properly for esmodules (Gus Caplan) #18949 * src: - make process.dlopen() load well-known symbol (Ben Noordhuis) #18934 * trace_events: - add file pattern cli option (Andreas Madsen) #18480 * Added new collaborators: - Chen Gang (MoonBall) https://github.com/MoonBall PR-URL: #19181
PR-URL: nodejs#18949 Fixes: nodejs#18948 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Notable Changes: * crypto: - add cert.fingerprint256 as SHA256 fingerprint (Hannes Magnusson) nodejs#17690 * http2: - Fixed issues with aborted connections in the HTTP/2 implementation (Anna Henningsen) nodejs#18987 nodejs#19002 * loader: - --inspect-brk now works properly for esmodules (Gus Caplan) nodejs#18949 * src: - make process.dlopen() load well-known symbol (Ben Noordhuis) nodejs#18934 * trace_events: - add file pattern cli option (Andreas Madsen) nodejs#18480 * Added new collaborators: - Chen Gang (MoonBall) https://github.com/MoonBall PR-URL: nodejs#19181
Should this be backported to 8.x? |
Fixes: #18948
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
loader