diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-05-18 12:51:20 +0200 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-06-22 05:20:49 +0200 |
commit | 9ca41e964246ad5f804a91419d6590ee83653fd8 (patch) | |
tree | 2fab0ae015df2b0ac41d0d68f8988726225572fb /src | |
parent | 2f1a23e5be9e1774a579d4201da24adaf3df2f1e (diff) | |
download | android-node-v8-9ca41e964246ad5f804a91419d6590ee83653fd8.tar.gz android-node-v8-9ca41e964246ad5f804a91419d6590ee83653fd8.tar.bz2 android-node-v8-9ca41e964246ad5f804a91419d6590ee83653fd8.zip |
src: introduce inspect-brk-node
This commit is a suggestion to add a new option to the node executable
to allow for breaking in node's javascript bootstrapper code.
Previously I've been able to set breakpoints in node bootstrapper code
and then restart the debugging session and those breakpoints would be
hit, but I don't seem to be able to do so anymore. Having this option
would allow me to use this option and then step through or add more
break points as needed.
PR-URL: https://github.com/nodejs/node/pull/20819
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 8 | ||||
-rw-r--r-- | src/node_debug_options.cc | 4 | ||||
-rw-r--r-- | src/node_debug_options.h | 6 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/node.cc b/src/node.cc index 6cf5f2ad84..71af5b93f6 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2190,6 +2190,11 @@ void SetupProcessObject(Environment* env, "_breakFirstLine", True(env->isolate())); } + if (debug_options.break_node_first_line()) { + READONLY_DONT_ENUM_PROPERTY(process, + "_breakNodeFirstLine", True(env->isolate())); + } + // --inspect --debug-brk if (debug_options.deprecated_invocation()) { READONLY_DONT_ENUM_PROPERTY(process, @@ -2401,7 +2406,8 @@ void LoadEnvironment(Environment* env) { env->process_object(), get_binding_fn, get_linked_binding_fn, - get_internal_binding_fn + get_internal_binding_fn, + Boolean::New(env->isolate(), debug_options.break_node_first_line()) }; // Bootstrap internal loaders diff --git a/src/node_debug_options.cc b/src/node_debug_options.cc index 3ec7731320..5fc29059dd 100644 --- a/src/node_debug_options.cc +++ b/src/node_debug_options.cc @@ -58,6 +58,7 @@ DebugOptions::DebugOptions() : inspector_enabled_(false), deprecated_debug_(false), break_first_line_(false), + break_node_first_line_(false), host_name_("127.0.0.1"), port_(-1) { } bool DebugOptions::ParseOption(const char* argv0, const std::string& option) { @@ -90,6 +91,9 @@ bool DebugOptions::ParseOption(const char* argv0, const std::string& option) { } else if (option_name == "--inspect-brk") { inspector_enabled_ = true; break_first_line_ = true; + } else if (option_name == "--inspect-brk-node") { + inspector_enabled_ = true; + break_node_first_line_ = true; } else if (option_name == "--debug-brk") { break_first_line_ = true; deprecated_debug_ = true; diff --git a/src/node_debug_options.h b/src/node_debug_options.h index 99364f4098..98922ab099 100644 --- a/src/node_debug_options.h +++ b/src/node_debug_options.h @@ -19,16 +19,20 @@ class DebugOptions { bool invalid_invocation() const { return deprecated_debug_ && !inspector_enabled_; } - bool wait_for_connect() const { return break_first_line_; } + bool wait_for_connect() const { + return break_first_line_ || break_node_first_line_; + } std::string host_name() const { return host_name_; } void set_host_name(std::string host_name) { host_name_ = host_name; } int port() const; void set_port(int port) { port_ = port; } + bool break_node_first_line() const { return break_node_first_line_; } private: bool inspector_enabled_; bool deprecated_debug_; bool break_first_line_; + bool break_node_first_line_; std::string host_name_; int port_; }; |