From 63554b9dbf564999c2295b4f4c653b19204f4c21 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Wed, 24 May 2017 14:38:56 -0700 Subject: [PATCH] Fix Microsoft/vscode#25594 - respect stackTrace range arguments --- src/chrome/chromeDebugAdapter.ts | 10 ++++++++-- src/debugAdapterInterfaces.d.ts | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/chrome/chromeDebugAdapter.ts b/src/chrome/chromeDebugAdapter.ts index 1d0f43ba7..31b82a205 100644 --- a/src/chrome/chromeDebugAdapter.ts +++ b/src/chrome/chromeDebugAdapter.ts @@ -1218,7 +1218,12 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter { // Only process at the requested number of frames, if 'levels' is specified let stack = this._currentPauseNotification.callFrames; - if (args.levels) { + const totalFrames = stack.length; + if (typeof args.startFrame === 'number') { + stack = stack.slice(args.startFrame); + } + + if (typeof args.levels === 'number') { stack = stack.filter((_, i) => i < args.levels); } @@ -1226,7 +1231,8 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter { .concat(this.asyncFrames(this._currentPauseNotification.asyncStackTrace)); const stackTraceResponse: IInternalStackTraceResponseBody = { - stackFrames + stackFrames, + totalFrames }; this._pathTransformer.stackTraceResponse(stackTraceResponse); this._sourceMapTransformer.stackTraceResponse(stackTraceResponse); diff --git a/src/debugAdapterInterfaces.d.ts b/src/debugAdapterInterfaces.d.ts index deaa01ad0..89dc61d6c 100644 --- a/src/debugAdapterInterfaces.d.ts +++ b/src/debugAdapterInterfaces.d.ts @@ -87,6 +87,7 @@ export interface IThreadsResponseBody { export interface IStackTraceResponseBody { stackFrames: DebugProtocol.StackFrame[]; + totalFrames?: number; } export interface IInternalStackFrame extends DebugProtocol.StackFrame {