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: use inspector API for "break on start" #12076

Merged
merged 0 commits into from Mar 30, 2017

Conversation

Projects
None yet
6 participants
@eugeneo
Copy link
Contributor

commented Mar 27, 2017

This change removes a need for using deprecated debug context for
breaking at the start of the main module.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

inspector

@eugeneo

This comment has been minimized.

Copy link
Contributor Author

commented Mar 27, 2017

lib/internal/bootstrap_node.js Outdated
@@ -258,7 +258,9 @@
if (process.inspector) {
inspectorConsole = global.console;
wrapConsoleCall = process.inspector.wrapConsoleCall;
delete process.inspector;
delete process.inspector.wrapConsoleCall;
if (Object.keys(process.inspector).length == 0)

This comment has been minimized.

Copy link
@bnoordhuis

This comment has been minimized.

Copy link
@eugeneo

eugeneo Mar 29, 2017

Author Contributor

Done

lib/module.js Outdated
}
var wrapper = inspector.callAndPauseOnStart.bind(inspector);
delete inspector.callAndPauseOnStart;
if (Object.keys(process.inspector).length == 0) {

This comment has been minimized.

Copy link
@bnoordhuis

This comment has been minimized.

Copy link
@eugeneo

eugeneo Mar 29, 2017

Author Contributor

Done

src/inspector_agent.cc Outdated
void AgentImpl::CallAndPauseOnStart(
const v8::FunctionCallbackInfo<v8::Value>& args) {
Environment* env = Environment::GetCurrent(args);
v8::HandleScope scope(env->isolate());

This comment has been minimized.

Copy link
@bnoordhuis

bnoordhuis Mar 29, 2017

Member

The HandleScope isn't necessary, API functions get one implicitly.

This comment has been minimized.

Copy link
@eugeneo

eugeneo Mar 29, 2017

Author Contributor

Done.

src/inspector_agent.cc Outdated
return env->ThrowError("First argument for a "
"inspector.callAndPauseOnStart call "
"should be a function");
}

This comment has been minimized.

Copy link
@bnoordhuis

bnoordhuis Mar 29, 2017

Member

Just CHECK(args.Length() > 1) and CHECK(args[0]->IsFunction())? This is only called by built-in code, right?

This comment has been minimized.

Copy link
@eugeneo

eugeneo Mar 29, 2017

Author Contributor

For now, it is not supposed to be a public API. This might change in the future.

src/inspector_agent.cc Outdated
call_args.push_back(args[i]);
}

env->inspector_agent()->SchedulePauseOnNextStatement("Break on start");

This comment has been minimized.

Copy link
@bnoordhuis

bnoordhuis Mar 29, 2017

Member

This effectively breaks on the next call into JS land? If this function were to return instead of calling the function, it would break at the next line in lib/module.js?

This comment has been minimized.

Copy link
@eugeneo

eugeneo Mar 29, 2017

Author Contributor

It breaks on the next JS instruction. E.g. I just noticed that it is not breaking inside the wrapper - it seems to break on the wrapper call (e.g. one step is required to reach the same point it was breaking before). It does not make any difference for the tests as the line number and variables are the same.

@eugeneo

This comment has been minimized.

Copy link
Contributor Author

commented Mar 29, 2017

Thank you for the review. I addressed the comments, please take another look.

src/inspector_agent.cc Outdated
@@ -310,6 +313,14 @@ class V8NodeInspector : public v8_inspector::V8InspectorClient {
session_->dispatchProtocolMessage(message);
}

void schedulePauseOnNextStatement(const std::string& reason) {
if (session_) {

This comment has been minimized.

Copy link
@bnoordhuis

bnoordhuis Mar 29, 2017

Member

Can you check that session_ != nullptr?

src/inspector_agent.cc Outdated

env->inspector_agent()->SchedulePauseOnNextStatement("Break on start");

v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();

This comment has been minimized.

Copy link
@TimothyGu

TimothyGu Mar 29, 2017

Member

env->context() might be simpler

This comment has been minimized.

Copy link
@eugeneo

eugeneo Mar 29, 2017

Author Contributor

Done.

@jasnell

This comment has been minimized.

Copy link
Member

commented Mar 30, 2017

CI has some challenges but they appear unrelated.

@eugeneo eugeneo modified the milestone: ake -j16 test Mar 30, 2017

@eugeneo eugeneo closed this Mar 30, 2017

@eugeneo eugeneo deleted the eugeneo:continue-to-location branch Mar 30, 2017

@eugeneo

This comment has been minimized.

Copy link
Contributor Author

commented Mar 30, 2017

Landed as 7954d2a

@eugeneo eugeneo merged commit 7954d2a into nodejs:master Mar 30, 2017

@jasnell jasnell referenced this pull request Apr 4, 2017

Closed

8.0.0 Release Proposal #12220

@italoacasas

This comment has been minimized.

Copy link
Member

commented Apr 10, 2017

@eugeneo

This comment has been minimized.

Copy link
Contributor Author

commented Apr 10, 2017

@italoacasas - sorry, I forgot to add labels. This code does not need to be ported to pre-8x as those versions still rely on debug context. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.