src: use PauseOnNextJavascriptStatement to implement --inspect-brk-node
Instead of using the `debugger;` statement which is visible in the JS source code and makes primordials.js environment-dependent. PR-URL: https://github.com/nodejs/node/pull/26034 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
04c839bd8c
commit
45b7c98f09
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
/* global breakAtBootstrap, primordials */
|
||||
/* global primordials */
|
||||
|
||||
// This file subclasses and stores the JS builtins that come from the VM
|
||||
// so that Node.js's builtin modules do not need to later look these up from
|
||||
@ -12,10 +12,6 @@
|
||||
// `primordials.Object` where `primordials` is a lexical variable passed
|
||||
// by the native module compiler.
|
||||
|
||||
if (breakAtBootstrap) {
|
||||
debugger; // eslint-disable-line no-debugger
|
||||
}
|
||||
|
||||
function copyProps(src, dest) {
|
||||
for (const key of Reflect.ownKeys(src)) {
|
||||
if (!Reflect.getOwnPropertyDescriptor(dest, key)) {
|
||||
|
10
src/node.cc
10
src/node.cc
@ -249,14 +249,18 @@ MaybeLocal<Value> RunBootstrapping(Environment* env) {
|
||||
// Store primordials
|
||||
env->set_primordials(Object::New(isolate));
|
||||
std::vector<Local<String>> primordials_params = {
|
||||
FIXED_ONE_BYTE_STRING(isolate, "breakAtBootstrap"),
|
||||
env->primordials_string()
|
||||
};
|
||||
std::vector<Local<Value>> primordials_args = {
|
||||
Boolean::New(isolate,
|
||||
env->options()->debug_options().break_node_first_line),
|
||||
env->primordials()
|
||||
};
|
||||
|
||||
#if HAVE_INSPECTOR
|
||||
if (env->options()->debug_options().break_node_first_line) {
|
||||
env->inspector_agent()->PauseOnNextJavascriptStatement(
|
||||
"Break at bootstrap");
|
||||
}
|
||||
#endif // HAVE_INSPECTOR
|
||||
MaybeLocal<Value> primordials_ret =
|
||||
ExecuteBootstrapper(env,
|
||||
"internal/bootstrap/primordials",
|
||||
|
Loading…
x
Reference in New Issue
Block a user