From 77dffb0026ae88fab1a99cfa534050a096df45b8 Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 4 Jan 2016 15:46:55 +0100 Subject: [PATCH] debug: introduce thread.stoppedReason --- .../parts/debug/browser/debugEditorModelManager.ts | 2 +- src/vs/workbench/parts/debug/browser/debugViewer.ts | 8 +++----- src/vs/workbench/parts/debug/common/debug.ts | 4 ++-- src/vs/workbench/parts/debug/common/debugModel.ts | 10 +++++----- .../parts/debug/electron-browser/debugService.ts | 2 +- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts b/src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts index 79d759f6ee2..8d637ea1dc4 100644 --- a/src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts +++ b/src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts @@ -144,7 +144,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution { range: createRange(sf.lineNumber, sf.column, sf.lineNumber, sf.column + 1) }); - if (thread.exception) { + if (thread.stoppedReason === 'exception') { result.push({ options: DebugEditorModelManager.TOP_STACK_FRAME_EXCEPTION_DECORATION, range: wholeLineRange diff --git a/src/vs/workbench/parts/debug/browser/debugViewer.ts b/src/vs/workbench/parts/debug/browser/debugViewer.ts index 6ee537b7d14..52442f6799e 100644 --- a/src/vs/workbench/parts/debug/browser/debugViewer.ts +++ b/src/vs/workbench/parts/debug/browser/debugViewer.ts @@ -190,11 +190,9 @@ export class CallStackDataSource implements tree.IDataSource { const threads = ( element).getThreads(); const threadsArray: debug.IThread[] = []; - for (let reference in threads) { - if (threads.hasOwnProperty(reference)) { - threadsArray.push(threads[reference]); - } - } + Object.keys(threads).forEach(threadId => { + threadsArray.push(threads[threadId]); + }); if (threadsArray.length === 1) { return Promise.as(threadsArray[0].callStack); diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index 410fea6e181..96125e8fb16 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -22,7 +22,7 @@ export interface IRawModelUpdate { threadId: number; thread?: DebugProtocol.Thread; callStack?: DebugProtocol.StackFrame[]; - exception?: boolean; + stoppedReason?: string; } // model @@ -45,7 +45,7 @@ export interface IThread extends ITreeElement { threadId: number; name: string; callStack: IStackFrame[]; - exception: boolean; + stoppedReason: string; } export interface IScope extends IExpressionContainer { diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index 6735de1ed38..90be426455a 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -64,10 +64,10 @@ export function getFullExpressionName(expression: debug.IExpression, sessionType export class Thread implements debug.IThread { - public exception: boolean; + public stoppedReason: string; constructor(public name: string, public threadId, public callStack: debug.IStackFrame[]) { - this.exception = false; + this.stoppedReason = undefined; } public getId(): string { @@ -335,7 +335,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { delete this.threads[reference]; } else { this.threads[reference].callStack = []; - this.threads[reference].exception = false; + this.threads[reference].stoppedReason = undefined; } } else { if (removeThreads) { @@ -345,7 +345,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { for (let ref in this.threads) { if (this.threads.hasOwnProperty(ref)) { this.threads[ref].callStack = []; - this.threads[ref].exception = false; + this.threads[ref].stoppedReason = undefined; } } } @@ -616,7 +616,7 @@ export class Model extends ee.EventEmitter implements debug.IModel { return new StackFrame(data.threadId, rsf.id, rsf.source ? Source.fromRawSource(rsf.source) : Source.fromUri(uri.parse('unknown')), rsf.name, rsf.line, rsf.column); }); - this.threads[data.threadId].exception = data.exception; + this.threads[data.threadId].stoppedReason = data.stoppedReason; } this.emit(debug.ModelEvents.CALLSTACK_UPDATED); diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 588bdf283a3..755870eab55 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -234,7 +234,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService this.getThreadData(threadId).then(() => { this.session.stackTrace({ threadId: threadId, levels: 20 }).done((result) => { - this.model.rawUpdate({ threadId: threadId, callStack: result.body.stackFrames, exception: event.body && event.body.reason === 'exception' }); + this.model.rawUpdate({ threadId: threadId, callStack: result.body.stackFrames, stoppedReason: event.body.reason }); this.windowService.getWindow().focus(); const callStack = this.model.getThreads()[threadId].callStack; if (callStack.length > 0) { -- GitLab