Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/internal/debugger/inspect_probe.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,15 @@ class ProbeInspectorSession {

onChildOutput(text, which) {
if (which !== 'stderr') { return; }
debug('child stderr: %j', text);

this.childStderr += text;

const combined = this.disconnectSentinelBuffer + text;
// Detect the disconnect sentinel.
if (this.connected &&
StringPrototypeIncludes(combined, kProbeDisconnectSentinel)) {
debug('disconnect sentinel detected, resetting client');
this.disconnectRequested = true;
this.client.reset();
}
Expand Down Expand Up @@ -587,6 +589,7 @@ class ProbeInspectorSession {
}

onPaused(params) {
debug('paused: finished=%d, reason=%s hitBreakpoints=%j', this.finished, params.reason, params.hitBreakpoints);
this.handlePaused(params).catch((error) => {
if (error === kInspectorFailedSentinel) { return; }
this.recordInspectorFailure({
Expand Down Expand Up @@ -837,6 +840,9 @@ class ProbeInspectorSession {
}

onScriptParsed(params) {
if (params.url && !StringPrototypeStartsWith(params.url, 'node:')) {
debug('scriptParsed: scriptId=%s url=%s, length=%d', params.scriptId, params.url, params.length);
}
// This map grows by the number of scripts parsed, which is limited, and is just a
// small string -> string map. The lifetime is bounded by probe timeout etc. so cleanup is overkill.
this.scriptIdToUrl.set(params.scriptId, params.url);
Expand Down Expand Up @@ -879,6 +885,8 @@ class ProbeInspectorSession {
}

const result = await this.callCdp('Debugger.setBreakpointByUrl', params);
debug('breakpoint set: id=%s urlRegex=%s locations=%j',
result.breakpointId, params.urlRegex, result.locations);
this.breakpointDefinitions.set(result.breakpointId, { probeIndices });
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-bound-never-hit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', 'probe-bound-never-hit.js:4',
'--expr', '1',
'probe-bound-never-hit.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spawnSyncAndAssert(process.execPath, [
'--',
'--inspect-port=0',
'probe.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-explicit-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', 'probe-multi-statement.js:5:29',
'--expr', 'acc.length',
'probe-multi-statement.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-expression-throws.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spawnSyncAndExit(process.execPath, [
'--probe', `${fixture}:16`, '--expr', probes[0].expr,
'--probe', `${fixture}:17`, '--expr', probes[1].expr,
fixture,
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
status: 0,
signal: null,
stdout(output) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spawnSyncAndExit(process.execPath, [
'--probe', `${fixture}:10`, '--expr', probes[0].expr,
'--probe', `${fixture}:11`, '--expr', probes[1].expr,
fixture,
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
status: 1,
signal: null,
stdout(output) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-failure-process-exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spawnSyncAndExit(process.execPath, [
'inspect', '--json',
'--probe', `${fixture}:8`, '--expr', probes[0].expr,
fixture,
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
status: 1,
signal: null,
stdout(output) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-global-option-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spawnSyncAndAssert(process.execPath, [
'--expr', 'finalValue',
'--json',
'probe.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-json-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', probeArg,
'--expr', 'errorValue',
'probe-types.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-json-special-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', probeArg,
'--expr', 'errorValue',
'probe-types.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', 'probe.js:12',
'--expr', 'finalValue',
'probe.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-late-resolution.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', 'probe-late-target.cjs:5',
'--expr', 'value',
'probe-late-entry.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spawnSyncAndExit(process.execPath, [
'--',
'--not-a-real-node-flag',
'probe.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
signal: null,
status: 1,
stderr(output) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-miss.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', 'probe-miss.js:99',
'--expr', '42',
'probe-miss.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-missing-expr.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spawnSyncAndExit(process.execPath, [
'inspect',
'--probe', 'probe.js:12',
'probe.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
signal: null,
status: 9,
stderr: /Each --probe must be followed immediately by --expr/,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-multi-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', 'utils.js:5',
'--expr', 'b',
'probe-multi-entry.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-narrow-suffix.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', 'probe-multi-a/utils.js:5',
'--expr', 'b',
'probe-multi-entry.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-no-column-indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', 'probe-indented.js:6', // No `:col`
'--expr', 'x',
'probe-indented.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeJson(output, {
v: 2,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-requires-separator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spawnSyncAndExit(process.execPath, [
'--expr', 'finalValue',
'--inspect-port=0',
'probe.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
signal: null,
status: 9,
stderr: /Use -- before child Node\.js flags in probe mode/,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-script-throws.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spawnSyncAndExit(process.execPath, [
'--probe', `${fixture}:7`, '--expr', probes[0].expr,
'--probe', `${fixture}:4`, '--expr', probes[1].expr,
fixture,
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
// probe_target_exit: probing process exits 0 (hits trustworthy).
status: 0,
signal: null,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-target-syntax-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spawnSyncAndExit(process.execPath, [
'inspect', '--json',
'--probe', `${fixture}:3`, '--expr', probes[0].expr,
fixture,
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
// probe_target_exit: probing process exits 0.
status: 0,
signal: null,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-text-special-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', probeArg,
'--expr', 'errorValue',
'probe-types.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeText(output, [
`Hit 1 at ${hitText}`,
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spawnSyncAndAssert(process.execPath, [
'--probe', 'probe.js:12',
'--expr', 'finalValue',
'probe.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
stdout(output) {
assertProbeText(output,
`Hit 1 at ${probeUrl}:12:1\n` +
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debugger-probe-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spawnSyncAndExit(process.execPath, [
'--probe', 'probe-timeout.js:99',
'--expr', '1',
'probe-timeout.js',
], { cwd }, {
], { cwd, env: { ...process.env, NODE_DEBUG: 'inspect_probe' } }, {
signal: null,
status: 1,
stdout(output) {
Expand Down
Loading