From 08b0a9bc59793f85e0ad5d84242c902f26706d2d Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 6 Dec 2019 10:40:38 +0100 Subject: [PATCH] Persisted data breakpoints are not registered when starting a new debug session fixes #83743 --- .../api/browser/mainThreadDebugService.ts | 4 ++-- src/vs/workbench/api/common/extHost.protocol.ts | 1 + .../contrib/debug/browser/breakpointsView.ts | 2 +- .../contrib/debug/browser/debugService.ts | 6 +++--- .../contrib/debug/browser/variablesView.ts | 2 +- src/vs/workbench/contrib/debug/common/debug.ts | 6 +++--- .../workbench/contrib/debug/common/debugModel.ts | 14 ++++++++------ 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadDebugService.ts b/src/vs/workbench/api/browser/mainThreadDebugService.ts index 41005c20e4e..673177f0f01 100644 --- a/src/vs/workbench/api/browser/mainThreadDebugService.ts +++ b/src/vs/workbench/api/browser/mainThreadDebugService.ts @@ -141,7 +141,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb } else if (dto.type === 'function') { this.debugService.addFunctionBreakpoint(dto.functionName, dto.id); } else if (dto.type === 'data') { - this.debugService.addDataBreakpoint(dto.label, dto.dataId, dto.canPersist); + this.debugService.addDataBreakpoint(dto.label, dto.dataId, dto.canPersist, dto.accessTypes); } } return Promise.resolve(); @@ -336,7 +336,7 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb condition: dbp.condition, hitCondition: dbp.hitCondition, logMessage: dbp.logMessage, - label: dbp.label, + label: dbp.description, canPersist: dbp.canPersist }; } else { diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index b7d4837a61e..3dab81c9c55 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1287,6 +1287,7 @@ export interface IDataBreakpointDto extends IBreakpointDto { dataId: string; canPersist: boolean; label: string; + accessTypes?: DebugProtocol.DataBreakpointAccessType[]; } export interface ISourceBreakpointDto extends IBreakpointDto { diff --git a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts index d9711706037..8d19e351841 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts @@ -500,7 +500,7 @@ class DataBreakpointsRenderer implements IListRenderer { - this.model.addDataBreakpoint(label, dataId, canPersist); + async addDataBreakpoint(label: string, dataId: string, canPersist: boolean, accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined): Promise { + this.model.addDataBreakpoint(label, dataId, canPersist, accessTypes); await this.sendDataBreakpoints(); this.storeBreakpoints(); @@ -1100,7 +1100,7 @@ export class DebugService implements IDebugService { let result: DataBreakpoint[] | undefined; try { result = JSON.parse(this.storageService.get(DEBUG_DATA_BREAKPOINTS_KEY, StorageScope.WORKSPACE, '[]')).map((dbp: any) => { - return new DataBreakpoint(dbp.label, dbp.dataId, true, dbp.enabled, dbp.hitCondition, dbp.condition, dbp.logMessage); + return new DataBreakpoint(dbp.description, dbp.dataId, true, dbp.enabled, dbp.hitCondition, dbp.condition, dbp.logMessage, dbp.accessTypes); }); } catch (e) { } diff --git a/src/vs/workbench/contrib/debug/browser/variablesView.ts b/src/vs/workbench/contrib/debug/browser/variablesView.ts index 81012b401ae..fb82b157b50 100644 --- a/src/vs/workbench/contrib/debug/browser/variablesView.ts +++ b/src/vs/workbench/contrib/debug/browser/variablesView.ts @@ -185,7 +185,7 @@ export class VariablesView extends ViewletPane { if (dataid) { actions.push(new Separator()); actions.push(new Action('debug.breakWhenValueChanges', nls.localize('breakWhenValueChanges', "Break When Value Changes"), undefined, true, () => { - return this.debugService.addDataBreakpoint(response.description, dataid, !!response.canPersist); + return this.debugService.addDataBreakpoint(response.description, dataid, !!response.canPersist, response.accessTypes); })); } } diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index 9b87af8cbe4..88ac5aa6786 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -215,7 +215,7 @@ export interface IDebugSession extends ITreeElement { sendBreakpoints(modelUri: uri, bpts: IBreakpoint[], sourceModified: boolean): Promise; sendFunctionBreakpoints(fbps: IFunctionBreakpoint[]): Promise; - dataBreakpointInfo(name: string, variablesReference?: number): Promise<{ dataId: string | null, description: string, canPersist?: boolean }>; + dataBreakpointInfo(name: string, variablesReference?: number): Promise<{ dataId: string | null, description: string, canPersist?: boolean, accessTypes?: DebugProtocol.DataBreakpointAccessType[] }>; sendDataBreakpoints(dbps: IDataBreakpoint[]): Promise; sendExceptionBreakpoints(exbpts: IExceptionBreakpoint[]): Promise; breakpointsLocations(uri: uri, lineNumber: number): Promise; @@ -377,7 +377,7 @@ export interface IExceptionBreakpoint extends IEnablement { } export interface IDataBreakpoint extends IBaseBreakpoint { - readonly label: string; + readonly description: string; readonly dataId: string; readonly canPersist: boolean; } @@ -795,7 +795,7 @@ export interface IDebugService { /** * Adds a new data breakpoint. */ - addDataBreakpoint(label: string, dataId: string, canPersist: boolean): Promise; + addDataBreakpoint(label: string, dataId: string, canPersist: boolean, accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined): Promise; /** * Removes all data breakpoints. If id is passed only removes the data breakpoint with the passed id. diff --git a/src/vs/workbench/contrib/debug/common/debugModel.ts b/src/vs/workbench/contrib/debug/common/debugModel.ts index 311ac19dcf7..5ad9aa7d55d 100644 --- a/src/vs/workbench/contrib/debug/common/debugModel.ts +++ b/src/vs/workbench/contrib/debug/common/debugModel.ts @@ -748,13 +748,14 @@ export class FunctionBreakpoint extends BaseBreakpoint implements IFunctionBreak export class DataBreakpoint extends BaseBreakpoint implements IDataBreakpoint { constructor( - public label: string, + public description: string, public dataId: string, public canPersist: boolean, enabled: boolean, hitCondition: string | undefined, condition: string | undefined, logMessage: string | undefined, + private accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined, id = generateUuid() ) { super(enabled, hitCondition, condition, logMessage, id); @@ -762,8 +763,9 @@ export class DataBreakpoint extends BaseBreakpoint implements IDataBreakpoint { toJSON(): any { const result = super.toJSON(); - result.label = this.label; - result.dataid = this.dataId; + result.description = this.description; + result.dataId = this.dataId; + result.accessTypes = this.accessTypes; return result; } @@ -777,7 +779,7 @@ export class DataBreakpoint extends BaseBreakpoint implements IDataBreakpoint { } toString(): string { - return this.label; + return this.description; } } @@ -1159,8 +1161,8 @@ export class DebugModel implements IDebugModel { this._onDidChangeBreakpoints.fire({ removed }); } - addDataBreakpoint(label: string, dataId: string, canPersist: boolean): void { - const newDataBreakpoint = new DataBreakpoint(label, dataId, canPersist, true, undefined, undefined, undefined); + addDataBreakpoint(label: string, dataId: string, canPersist: boolean, accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined): void { + const newDataBreakpoint = new DataBreakpoint(label, dataId, canPersist, true, undefined, undefined, undefined, accessTypes); this.dataBreakopints.push(newDataBreakpoint); this._onDidChangeBreakpoints.fire({ added: [newDataBreakpoint] }); }