Skip to content

Commit 611f9bf

Browse files
authored
debug: preserve the top of stack when stepping in or at BP (microsoft#214902)
Refs microsoft#214433
1 parent 48748f9 commit 611f9bf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/vs/workbench/contrib/debug/common/debugModel.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,8 @@ export class StackFrame implements IStackFrame {
540540
}
541541
}
542542

543+
const KEEP_SUBTLE_FRAME_AT_TOP_REASONS: readonly string[] = ['breakpoint', 'step', 'function breakpoint'];
544+
543545
export class Thread implements IThread {
544546
private callStack: IStackFrame[];
545547
private staleCallStack: IStackFrame[];
@@ -578,10 +580,11 @@ export class Thread implements IThread {
578580

579581
getTopStackFrame(): IStackFrame | undefined {
580582
const callStack = this.getCallStack();
583+
const stopReason = this.stoppedDetails?.reason;
581584
// Allow stack frame without source and with instructionReferencePointer as top stack frame when using disassembly view.
582585
const firstAvailableStackFrame = callStack.find(sf => !!(
583-
((this.stoppedDetails?.reason === 'instruction breakpoint' || (this.stoppedDetails?.reason === 'step' && this.lastSteppingGranularity === 'instruction')) && sf.instructionPointerReference) ||
584-
(sf.source && sf.source.available && !isFrameDeemphasized(sf))));
586+
((stopReason === 'instruction breakpoint' || (stopReason === 'step' && this.lastSteppingGranularity === 'instruction')) && sf.instructionPointerReference) ||
587+
(sf.source && sf.source.available && (KEEP_SUBTLE_FRAME_AT_TOP_REASONS.includes(stopReason!) || !isFrameDeemphasized(sf)))));
585588
return firstAvailableStackFrame;
586589
}
587590

0 commit comments

Comments
 (0)