Persisted data breakpoints are not registered when starting a new debug session

fixes #83743
This commit is contained in:
isidor 2019-12-06 10:40:38 +01:00
parent a3d4c6d37f
commit 08b0a9bc59
7 changed files with 19 additions and 16 deletions

View file

@ -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 {

View file

@ -1287,6 +1287,7 @@ export interface IDataBreakpointDto extends IBreakpointDto {
dataId: string;
canPersist: boolean;
label: string;
accessTypes?: DebugProtocol.DataBreakpointAccessType[];
}
export interface ISourceBreakpointDto extends IBreakpointDto {

View file

@ -500,7 +500,7 @@ class DataBreakpointsRenderer implements IListRenderer<DataBreakpoint, IBaseBrea
renderElement(dataBreakpoint: DataBreakpoint, index: number, data: IBaseBreakpointWithIconTemplateData): void {
data.context = dataBreakpoint;
data.name.textContent = dataBreakpoint.label;
data.name.textContent = dataBreakpoint.description;
const { className, message } = getBreakpointMessageAndClassName(this.debugService, dataBreakpoint);
data.icon.className = `codicon ${className}`;
data.icon.title = message ? message : '';

View file

@ -987,8 +987,8 @@ export class DebugService implements IDebugService {
this.storeBreakpoints();
}
async addDataBreakpoint(label: string, dataId: string, canPersist: boolean): Promise<void> {
this.model.addDataBreakpoint(label, dataId, canPersist);
async addDataBreakpoint(label: string, dataId: string, canPersist: boolean, accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined): Promise<void> {
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) { }

View file

@ -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);
}));
}
}

View file

@ -215,7 +215,7 @@ export interface IDebugSession extends ITreeElement {
sendBreakpoints(modelUri: uri, bpts: IBreakpoint[], sourceModified: boolean): Promise<void>;
sendFunctionBreakpoints(fbps: IFunctionBreakpoint[]): Promise<void>;
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<void>;
sendExceptionBreakpoints(exbpts: IExceptionBreakpoint[]): Promise<void>;
breakpointsLocations(uri: uri, lineNumber: number): Promise<IPosition[]>;
@ -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<void>;
addDataBreakpoint(label: string, dataId: string, canPersist: boolean, accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined): Promise<void>;
/**
* Removes all data breakpoints. If id is passed only removes the data breakpoint with the passed id.

View file

@ -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] });
}