Skip to content

Commit

Permalink
debug: function breakpoints first steps.
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Nov 27, 2015
1 parent 3ff3b84 commit 5c1d9f9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/vs/workbench/parts/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export interface IBreakpoint extends IEnablement {
condition: string;
}

export interface IFunctionBreakpoint extends IEnablement {
functionName: string;
}

export interface IExceptionBreakpoint extends IEnablement {
name: string;
}
Expand Down Expand Up @@ -119,6 +123,7 @@ export interface IModel extends ee.IEventEmitter, ITreeElement {
getThreads(): { [reference: number]: IThread; };
getBreakpoints(): IBreakpoint[];
areBreakpointsActivated(): boolean;
getFunctionBreakpoints(): IFunctionBreakpoint[];
getExceptionBreakpoints(): IExceptionBreakpoint[];
getWatchExpressions(): IExpression[];
getReplElements(): ITreeElement[];
Expand Down
25 changes: 21 additions & 4 deletions src/vs/workbench/parts/debug/common/debugModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ export class Breakpoint implements debug.IBreakpoint {
}
}

export class FunctionBreakpoint implements debug.IFunctionBreakpoint {

private id: string;

constructor(public functionName: string, public enabled: boolean) {
this.id = uuid.generateUuid();
}

public getId(): string {
return this.id;
}
}

export class ExceptionBreakpoint implements debug.IExceptionBreakpoint {

private id: string;
Expand All @@ -286,7 +299,7 @@ export class Model extends ee.EventEmitter implements debug.IModel {
private toDispose: lifecycle.IDisposable[];
private replElements: debug.ITreeElement[];

constructor(private breakpoints: debug.IBreakpoint[], private breakpointsActivated: boolean,
constructor(private breakpoints: debug.IBreakpoint[], private breakpointsActivated: boolean, private functionBreakpoints: debug.IFunctionBreakpoint[],
private exceptionBreakpoints: debug.IExceptionBreakpoint[], private watchExpressions: Expression[]) {

super();
Expand Down Expand Up @@ -331,6 +344,10 @@ export class Model extends ee.EventEmitter implements debug.IModel {
return this.breakpoints;
}

public getFunctionBreakpoints(): debug.IFunctionBreakpoint[] {
return this.functionBreakpoints;
}

public getExceptionBreakpoints(): debug.IExceptionBreakpoint[] {
return this.exceptionBreakpoints;
}
Expand Down Expand Up @@ -378,9 +395,8 @@ export class Model extends ee.EventEmitter implements debug.IModel {
bp.lineNumber = bp.desiredLineNumber;
}
});
this.exceptionBreakpoints.forEach(ebp => {
ebp.enabled = enabled;
});
this.exceptionBreakpoints.forEach(ebp => ebp.enabled = enabled);
this.functionBreakpoints.forEach(fbp => fbp.enabled = enabled);

this.emit(debug.ModelEvents.BREAKPOINTS_UPDATED);
}
Expand Down Expand Up @@ -600,6 +616,7 @@ export class Model extends ee.EventEmitter implements debug.IModel {
this.threads = null;
this.breakpoints = null;
this.exceptionBreakpoints = null;
this.functionBreakpoints = null;
this.watchExpressions = null;
this.replElements = null;
this.toDispose = lifecycle.disposeAll(this.toDispose);
Expand Down

0 comments on commit 5c1d9f9

Please sign in to comment.