Skip to content

Commit 7df1ed4

Browse files
committed
debug: do not send terminate to EH debugging
microsoft#57409
1 parent 73d8c44 commit 7df1ed4

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/vs/workbench/parts/debug/electron-browser/debugSession.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export class Session implements ISession {
234234
}
235235

236236
return dbgr.getCustomTelemetryService().then(customTelemetryService => {
237-
this._raw = this.instantiationService.createInstance(RawDebugSession, this.id, this._configuration.resolved.debugServer, dbgr, customTelemetryService, this.root);
237+
this._raw = this.instantiationService.createInstance(RawDebugSession, this.id, this._configuration.resolved, dbgr, customTelemetryService, this.root);
238238
this.registerListeners();
239239

240240
return this._raw.initialize({

src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
1616
import { INotificationService } from 'vs/platform/notification/common/notification';
1717
import { formatPII } from 'vs/workbench/parts/debug/common/debugUtils';
1818
import { SocketDebugAdapter } from 'vs/workbench/parts/debug/node/debugAdapter';
19-
import { DebugEvent, IRawSession, IDebugAdapter } from 'vs/workbench/parts/debug/common/debug';
19+
import { DebugEvent, IRawSession, IDebugAdapter, IConfig } from 'vs/workbench/parts/debug/common/debug';
2020
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
21+
import { equalsIgnoreCase } from 'vs/base/common/strings';
2122

2223
export interface SessionExitedEvent extends DebugEvent {
2324
body: {
@@ -47,7 +48,8 @@ export class RawDebugSession implements IRawSession {
4748
private cancellationTokens: CancellationTokenSource[];
4849
private _capabilities: DebugProtocol.Capabilities;
4950
private allThreadsContinued: boolean;
50-
private isAttached: boolean;
51+
private debugServerPort: number;
52+
private isAttach: boolean;
5153

5254
private readonly _onDidInitialize: Emitter<DebugProtocol.InitializedEvent>;
5355
private readonly _onDidStop: Emitter<DebugProtocol.StoppedEvent>;
@@ -64,7 +66,7 @@ export class RawDebugSession implements IRawSession {
6466

6567
constructor(
6668
private sessionId: string,
67-
private debugServerPort: number,
69+
configuration: IConfig,
6870
private _debugger: Debugger,
6971
public customTelemetryService: ITelemetryService,
7072
private root: IWorkspaceFolder,
@@ -76,6 +78,8 @@ export class RawDebugSession implements IRawSession {
7678
this.readyForBreakpoints = false;
7779
this.allThreadsContinued = true;
7880
this.cancellationTokens = [];
81+
this.debugServerPort = configuration.debugServer;
82+
this.isAttach = configuration.request === 'attach' || equalsIgnoreCase(configuration.type, 'extensionHost');
7983

8084
this._onDidInitialize = new Emitter<DebugProtocol.InitializedEvent>();
8185
this._onDidStop = new Emitter<DebugProtocol.StoppedEvent>();
@@ -288,7 +292,6 @@ export class RawDebugSession implements IRawSession {
288292
}
289293

290294
public attach(args: DebugProtocol.AttachRequestArguments): TPromise<DebugProtocol.AttachResponse> {
291-
this.isAttached = true;
292295
return this.send('attach', args).then(response => this.readCapabilities(response));
293296
}
294297

@@ -347,7 +350,7 @@ export class RawDebugSession implements IRawSession {
347350
}
348351

349352
public terminate(restart = false): TPromise<DebugProtocol.TerminateResponse> {
350-
if (this.capabilities.supportsTerminateRequest && !this.terminated && !this.isAttached) {
353+
if (this.capabilities.supportsTerminateRequest && !this.terminated && !this.isAttach) {
351354
this.terminated = true;
352355
return this.send('terminate', { restart });
353356
}

0 commit comments

Comments
 (0)