Skip to content

Commit 238b54e

Browse files
joyeecheungaduh95
authored andcommitted
debugger: add more logs to probe mode
Add more log points in the probe mode and enable the debuglog int the probe mode tests. Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com> PR-URL: #63663 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
1 parent f53dee5 commit 238b54e

24 files changed

Lines changed: 31 additions & 23 deletions

‎lib/internal/debugger/inspect_probe.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,15 @@ class ProbeInspectorSession {
505505

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

509510
this.childStderr+=text;
510511

511512
constcombined=this.disconnectSentinelBuffer+text;
512513
// Detect the disconnect sentinel.
513514
if(this.connected&&
514515
StringPrototypeIncludes(combined,kProbeDisconnectSentinel)){
516+
debug('disconnect sentinel detected, resetting client');
515517
this.disconnectRequested=true;
516518
this.client.reset();
517519
}
@@ -587,6 +589,7 @@ class ProbeInspectorSession {
587589
}
588590

589591
onPaused(params){
592+
debug('paused: finished=%d, reason=%s hitBreakpoints=%j',this.finished,params.reason,params.hitBreakpoints);
590593
this.handlePaused(params).catch((error)=>{
591594
if(error===kInspectorFailedSentinel){return;}
592595
this.recordInspectorFailure({
@@ -837,6 +840,9 @@ class ProbeInspectorSession {
837840
}
838841

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

881887
constresult=awaitthis.callCdp('Debugger.setBreakpointByUrl',params);
888+
debug('breakpoint set: id=%s urlRegex=%s locations=%j',
889+
result.breakpointId,params.urlRegex,result.locations);
882890
this.breakpointDefinitions.set(result.breakpointId,{ probeIndices });
883891
}
884892
}

‎test/parallel/test-debugger-probe-bound-never-hit.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spawnSyncAndAssert(process.execPath, [
1616
'--probe','probe-bound-never-hit.js:4',
1717
'--expr','1',
1818
'probe-bound-never-hit.js',
19-
],{ cwd },{
19+
],{ cwd,env: { ...process.env,NODE_DEBUG: 'inspect_probe'}},{
2020
stdout(output){
2121
assertProbeJson(output,{
2222
v: 2,

‎test/parallel/test-debugger-probe-child-inspect-port-zero.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spawnSyncAndAssert(process.execPath, [
1919
'--',
2020
'--inspect-port=0',
2121
'probe.js',
22-
],{ cwd },{
22+
],{ cwd,env: { ...process.env,NODE_DEBUG: 'inspect_probe'}},{
2323
stdout(output){
2424
assertProbeJson(output,{
2525
v: 2,

‎test/parallel/test-debugger-probe-explicit-column.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spawnSyncAndAssert(process.execPath, [
2424
'--probe','probe-multi-statement.js:5:29',
2525
'--expr','acc.length',
2626
'probe-multi-statement.js',
27-
],{ cwd },{
27+
],{ cwd,env: { ...process.env,NODE_DEBUG: 'inspect_probe'}},{
2828
stdout(output){
2929
assertProbeJson(output,{
3030
v: 2,

‎test/parallel/test-debugger-probe-expression-throws.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spawnSyncAndExit(process.execPath, [
2323
'--probe',`${fixture}:16`,'--expr',probes[0].expr,
2424
'--probe',`${fixture}:17`,'--expr',probes[1].expr,
2525
fixture,
26-
],{ cwd },{
26+
],{ cwd,env: { ...process.env,NODE_DEBUG: 'inspect_probe'}},{
2727
status: 0,
2828
signal: null,
2929
stdout(output){

‎test/parallel/test-debugger-probe-failure-hang-during-evaluate.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spawnSyncAndExit(process.execPath, [
2424
'--probe',`${fixture}:10`,'--expr',probes[0].expr,
2525
'--probe',`${fixture}:11`,'--expr',probes[1].expr,
2626
fixture,
27-
],{ cwd },{
27+
],{ cwd,env: { ...process.env,NODE_DEBUG: 'inspect_probe'}},{
2828
status: 1,
2929
signal: null,
3030
stdout(output){

‎test/parallel/test-debugger-probe-failure-process-exit.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spawnSyncAndExit(process.execPath, [
1818
'inspect','--json',
1919
'--probe',`${fixture}:8`,'--expr',probes[0].expr,
2020
fixture,
21-
],{ cwd },{
21+
],{ cwd,env: { ...process.env,NODE_DEBUG: 'inspect_probe'}},{
2222
status: 1,
2323
signal: null,
2424
stdout(output){

‎test/parallel/test-debugger-probe-global-option-order.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spawnSyncAndAssert(process.execPath, [
1717
'--expr','finalValue',
1818
'--json',
1919
'probe.js',
20-
],{ cwd },{
20+
],{ cwd,env: { ...process.env,NODE_DEBUG: 'inspect_probe'}},{
2121
stdout(output){
2222
assertProbeJson(output,{
2323
v: 2,

‎test/parallel/test-debugger-probe-json-preview.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ spawnSyncAndAssert(process.execPath, [
2424
'--probe',probeArg,
2525
'--expr','errorValue',
2626
'probe-types.js',
27-
],{ cwd },{
27+
],{ cwd,env: { ...process.env,NODE_DEBUG: 'inspect_probe'}},{
2828
stdout(output){
2929
assertProbeJson(output,{
3030
v: 2,

‎test/parallel/test-debugger-probe-json-special-values.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ spawnSyncAndAssert(process.execPath, [
3939
'--probe',probeArg,
4040
'--expr','errorValue',
4141
'probe-types.js',
42-
],{ cwd },{
42+
],{ cwd,env: { ...process.env,NODE_DEBUG: 'inspect_probe'}},{
4343
stdout(output){
4444
assertProbeJson(output,{
4545
v: 2,

0 commit comments

Comments
 (0)