Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-03-11 23:28:51 +0300
committerJoyee Cheung <joyeec9h3@gmail.com>2019-03-19 00:45:40 +0300
commit97a919b12dd214b4c1e938ed2cd0d25a3b2cdeab (patch)
tree2602d8ceb906dd54d1f904fc5df81dabc1c44453 /src/inspector_agent.cc
parenta91d36fcc12c90f842d38f4a6b50809133bf1bc7 (diff)
inspector: patch C++ debug options instead of process._breakFirstLine
Instead of patching process._breakFirstLine to inform the JS land to wait for the debugger, check that the JS land has not yet serialized the options and then patch the debug options from C++. The changes will be carried into JS later during option serialization. PR-URL: https://github.com/nodejs/node/pull/26602 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'src/inspector_agent.cc')
-rw-r--r--src/inspector_agent.cc16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index 7b4dec90fc9..90ed2857815 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -728,18 +728,12 @@ bool Agent::Start(const std::string& path,
return false;
}
- // TODO(joyeecheung): we should not be using process as a global object
- // to transport --inspect-brk. Instead, the JS land can get this through
- // require('internal/options') since it should be set once CLI parsing
- // is done.
+ // Patch the debug options to implement waitForDebuggerOnStart for
+ // the NodeWorker.enable method.
if (wait_for_connect) {
- HandleScope scope(parent_env_->isolate());
- parent_env_->process_object()->DefineOwnProperty(
- parent_env_->context(),
- FIXED_ONE_BYTE_STRING(parent_env_->isolate(), "_breakFirstLine"),
- True(parent_env_->isolate()),
- static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum))
- .FromJust();
+ CHECK(!parent_env_->has_serialized_options());
+ debug_options_.EnableBreakFirstLine();
+ parent_env_->options()->get_debug_options()->EnableBreakFirstLine();
client_->waitForFrontend();
}
return true;