Skip to content

Always stop the debug target process when attaching #1415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
13 changes: 3 additions & 10 deletions src/debug/debugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -228,7 +225,7 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {

protected async launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): Promise<void> {
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);
Expand All @@ -243,7 +240,6 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
protected async attachRequest(response: DebugProtocol.AttachResponse, args: AttachRequestArguments): Promise<void> {
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) {
Expand All @@ -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;
Expand Down Expand Up @@ -291,11 +286,9 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
args: DebugProtocol.ConfigurationDoneArguments
): Promise<void> {
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);
Expand Down