Skip to content

lib: use debugger statement to break scripts in -e --inspect-brk

When wrapping scripts being evaluated with -e and --inspect-brk, instead of wrapping it with an internal binding:

process.binding('inspector').callAndPauseOnStart(function() {

${source};

}, {})

simply insert a debugger statement:

debugger;
${source}

so that the wrapped script do not rely on any internal magic since we should treat it as a normal user land script. In addition, if the source starts with declarations, it now breaks before the declarations instead of skipping through the declarations and jumping to the first statement.

This patch also introduces helpers for the inspector tests to calculate debug break line numbers programmatically, instead of hard-coding the numbers, since these numbers can change when the way we wrap different kinds of scripts change.

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

Merge request reports

Loading