提交 77dffb00 编写于 作者: I isidor

debug: introduce thread.stoppedReason

上级 bd734208
......@@ -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
......
......@@ -190,11 +190,9 @@ export class CallStackDataSource implements tree.IDataSource {
const threads = (<model.Model> 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);
......
......@@ -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 {
......
......@@ -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);
......
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册