From 5c1d9f976216786b92c5677757f2a21d2e1dc526 Mon Sep 17 00:00:00 2001 From: isidor Date: Fri, 27 Nov 2015 16:13:05 +0100 Subject: [PATCH] debug: function breakpoints first steps. --- src/vs/workbench/parts/debug/common/debug.ts | 5 ++++ .../parts/debug/common/debugModel.ts | 25 ++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index b20f7356cfb..cdd7f3ceb5d 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -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; } @@ -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[]; diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index 1094bf447d3..3ae588b9d77 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -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; @@ -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(); @@ -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; } @@ -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); } @@ -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);