From da87557500bc9a5fefd4ef8f8acd4c60d2a43a00 Mon Sep 17 00:00:00 2001 From: Brett Saviano Date: Thu, 25 Jul 2024 12:10:19 -0400 Subject: [PATCH 1/2] Always stop the debug target process when attaching --- package.json | 5 ----- src/debug/debugSession.ts | 13 +++---------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 460e7916..a76a4180 100644 --- a/package.json +++ b/package.json @@ -1707,11 +1707,6 @@ "string" ], "description": "The CSP debug ID to use to identify the target process. If provided, 'processId' and 'stopOnEntry' are ignored." - }, - "stopOnEntry": { - "type": "boolean", - "description": "Automatically stop target after attach. If not specified, target does not stop.", - "default": false } } } diff --git a/src/debug/debugSession.ts b/src/debug/debugSession.ts index 73aeb03e..047739f3 100644 --- a/src/debug/debugSession.ts +++ b/src/debug/debugSession.ts @@ -106,9 +106,6 @@ export class ObjectScriptDebugSession extends LoggingDebugSession { /** If we're stopped at a breakpoint. */ private _break = false; - /** If we should automatically stop target */ - private _stopOnEntry: boolean; - /** If this is a `launch` session */ private _isLaunch = false; @@ -228,7 +225,7 @@ export class ObjectScriptDebugSession extends LoggingDebugSession { protected async launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): Promise { try { - this._debugTargetSet = this._stopOnEntry = false; + this._debugTargetSet = false; this._isLaunch = true; const debugTarget = `${this._namespace}:${args.program}`; await this._connection.sendFeatureSetCommand("debug_target", debugTarget, true); @@ -243,7 +240,6 @@ export class ObjectScriptDebugSession extends LoggingDebugSession { protected async attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): Promise { try { this._debugTargetSet = this._isLaunch = false; - this._stopOnEntry = args.stopOnEntry; const debugTarget = args.cspDebugId != undefined ? `CSPDEBUG:${args.cspDebugId}` : `PID:${args.processId}`; await this._connection.sendFeatureSetCommand("debug_target", debugTarget); if (args.cspDebugId != undefined) { @@ -258,7 +254,6 @@ export class ObjectScriptDebugSession extends LoggingDebugSession { await this._connection.sendBreakpointSetCommand(new xdebug.Watchpoint("ok", this._cspWatchpointCondition)); this._isCsp = true; } - this._stopOnEntry = false; this.sendResponse(response); } else { this._isCsp = false; @@ -291,11 +286,9 @@ export class ObjectScriptDebugSession extends LoggingDebugSession { args: DebugProtocol.ConfigurationDoneArguments ): Promise { if (!this._isLaunch && !this._isCsp) { - // The debug agent ignores the first run command for non-CSP attaches, - // so send one right away, regardless of the stopOnEntry value + // The debug agent ignores the first run command + // for non-CSP attaches, so send one right away await this._connection.sendRunCommand(); - } - if (this._stopOnEntry && !this._isLaunch && !this._isCsp) { // Tell VS Code that we're stopped this.sendResponse(response); const event: DebugProtocol.StoppedEvent = new StoppedEvent("entry", this._connection.id); From c6f0e648f1f92913d10254840dbd30f4eea127e1 Mon Sep 17 00:00:00 2001 From: Brett Saviano Date: Thu, 25 Jul 2024 14:02:05 -0400 Subject: [PATCH 2/2] Update package.json Co-authored-by: John Murray --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a76a4180..75f7f110 100644 --- a/package.json +++ b/package.json @@ -1706,7 +1706,7 @@ "number", "string" ], - "description": "The CSP debug ID to use to identify the target process. If provided, 'processId' and 'stopOnEntry' are ignored." + "description": "The CSP debug ID to use to identify the target process. If provided, 'processId' is ignored." } } }