提交 15e410b9 编写于 作者: I isidor

Pending breakpoint should be saved across restarts

fixes #103165
上级 95e42d7e
......@@ -817,6 +817,7 @@ export class DebugService implements IDebugService {
async enableOrDisableBreakpoints(enable: boolean, breakpoint?: IEnablement): Promise<void> {
if (breakpoint) {
this.model.setEnablement(breakpoint, enable);
this.debugStorage.storeBreakpoints(this.model);
if (breakpoint instanceof Breakpoint) {
await this.sendBreakpoints(breakpoint.uri);
} else if (breakpoint instanceof FunctionBreakpoint) {
......@@ -828,6 +829,7 @@ export class DebugService implements IDebugService {
}
} else {
this.model.enableOrDisableAllBreakpoints(enable);
this.debugStorage.storeBreakpoints(this.model);
await this.sendAllBreakpoints();
}
this.debugStorage.storeBreakpoints(this.model);
......@@ -838,6 +840,9 @@ export class DebugService implements IDebugService {
breakpoints.forEach(bp => aria.status(nls.localize('breakpointAdded', "Added breakpoint, line {0}, file {1}", bp.lineNumber, uri.fsPath)));
breakpoints.forEach(bp => this.telemetry.logDebugAddBreakpoint(bp, context));
// In some cases we need to store breakpoints before we send them because sending them can take a long time
// And after sending them because the debug adapter can attach adapter data to a breakpoint
this.debugStorage.storeBreakpoints(this.model);
await this.sendBreakpoints(uri);
this.debugStorage.storeBreakpoints(this.model);
return breakpoints;
......@@ -845,12 +850,13 @@ export class DebugService implements IDebugService {
async updateBreakpoints(uri: uri, data: Map<string, DebugProtocol.Breakpoint>, sendOnResourceSaved: boolean): Promise<void> {
this.model.updateBreakpoints(data);
this.debugStorage.storeBreakpoints(this.model);
if (sendOnResourceSaved) {
this.breakpointsToSendOnResourceSaved.add(uri.toString());
} else {
await this.sendBreakpoints(uri);
this.debugStorage.storeBreakpoints(this.model);
}
this.debugStorage.storeBreakpoints(this.model);
}
async removeBreakpoints(id?: string): Promise<void> {
......@@ -860,8 +866,8 @@ export class DebugService implements IDebugService {
this.model.removeBreakpoints(toRemove);
await Promise.all(urisToClear.map(uri => this.sendBreakpoints(uri)));
this.debugStorage.storeBreakpoints(this.model);
await Promise.all(urisToClear.map(uri => this.sendBreakpoints(uri)));
}
setBreakpointsActivated(activated: boolean): Promise<void> {
......@@ -876,27 +882,27 @@ export class DebugService implements IDebugService {
async renameFunctionBreakpoint(id: string, newFunctionName: string): Promise<void> {
this.model.renameFunctionBreakpoint(id, newFunctionName);
await this.sendFunctionBreakpoints();
this.debugStorage.storeBreakpoints(this.model);
await this.sendFunctionBreakpoints();
}
async removeFunctionBreakpoints(id?: string): Promise<void> {
this.model.removeFunctionBreakpoints(id);
await this.sendFunctionBreakpoints();
this.debugStorage.storeBreakpoints(this.model);
await this.sendFunctionBreakpoints();
}
async addDataBreakpoint(label: string, dataId: string, canPersist: boolean, accessTypes: DebugProtocol.DataBreakpointAccessType[] | undefined): Promise<void> {
this.model.addDataBreakpoint(label, dataId, canPersist, accessTypes);
this.debugStorage.storeBreakpoints(this.model);
await this.sendDataBreakpoints();
this.debugStorage.storeBreakpoints(this.model);
}
async removeDataBreakpoints(id?: string): Promise<void> {
this.model.removeDataBreakpoints(id);
await this.sendDataBreakpoints();
this.debugStorage.storeBreakpoints(this.model);
await this.sendDataBreakpoints();
}
async sendAllBreakpoints(session?: IDebugSession): Promise<any> {
......@@ -909,7 +915,6 @@ export class DebugService implements IDebugService {
private async sendBreakpoints(modelUri: uri, sourceModified = false, session?: IDebugSession): Promise<void> {
const breakpointsToSend = this.model.getBreakpoints({ uri: modelUri, enabledOnly: true });
await sendToOneOrAllSessions(this.model, session, s => s.sendBreakpoints(modelUri, breakpointsToSend, sourceModified));
}
......@@ -923,10 +928,10 @@ export class DebugService implements IDebugService {
});
}
private sendDataBreakpoints(session?: IDebugSession): Promise<void> {
private async sendDataBreakpoints(session?: IDebugSession): Promise<void> {
const breakpointsToSend = this.model.getDataBreakpoints().filter(fbp => fbp.enabled && this.model.areBreakpointsActivated());
return sendToOneOrAllSessions(this.model, session, async s => {
await sendToOneOrAllSessions(this.model, session, async s => {
if (s.capabilities.supportsDataBreakpoints) {
await s.sendDataBreakpoints(breakpointsToSend);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册