diff --git a/src/vs/workbench/contrib/debug/common/debugModel.ts b/src/vs/workbench/contrib/debug/common/debugModel.ts index 13f7d1d902dc3..7a89fef9383da 100644 --- a/src/vs/workbench/contrib/debug/common/debugModel.ts +++ b/src/vs/workbench/contrib/debug/common/debugModel.ts @@ -540,6 +540,8 @@ export class StackFrame implements IStackFrame { } } +const KEEP_SUBTLE_FRAME_AT_TOP_REASONS: readonly string[] = ['breakpoint', 'step', 'function breakpoint']; + export class Thread implements IThread { private callStack: IStackFrame[]; private staleCallStack: IStackFrame[]; @@ -578,10 +580,11 @@ export class Thread implements IThread { getTopStackFrame(): IStackFrame | undefined { const callStack = this.getCallStack(); + const stopReason = this.stoppedDetails?.reason; // Allow stack frame without source and with instructionReferencePointer as top stack frame when using disassembly view. const firstAvailableStackFrame = callStack.find(sf => !!( - ((this.stoppedDetails?.reason === 'instruction breakpoint' || (this.stoppedDetails?.reason === 'step' && this.lastSteppingGranularity === 'instruction')) && sf.instructionPointerReference) || - (sf.source && sf.source.available && !isFrameDeemphasized(sf)))); + ((stopReason === 'instruction breakpoint' || (stopReason === 'step' && this.lastSteppingGranularity === 'instruction')) && sf.instructionPointerReference) || + (sf.source && sf.source.available && (KEEP_SUBTLE_FRAME_AT_TOP_REASONS.includes(stopReason!) || !isFrameDeemphasized(sf))))); return firstAvailableStackFrame; }