| 53 | const MAX_SILENT_AUTO_STEPS = 10000; |
| 54 | |
| 55 | export class StalkerBreakpointDebugger { |
| 56 | readonly breakpoints = new BreakpointStore((breakpoint, _args, context) => { |
| 57 | this.startStalkerForHit(breakpoint, context); |
| 58 | }); |
| 59 | |
| 60 | private readonly sessions = new Map<ThreadId, StalkerSession>(); |
| 61 | private currentThreadId: ThreadId | null = null; |
| 62 | private disposed = false; |
| 63 | |
| 64 | step(count = 1): void { |
| 65 | const session = this.getSession(this.currentThreadId); |
| 66 | if (session === null) { |
| 67 | return; |
| 68 | } |
| 69 | |
| 70 | if (!session.paused) { |
| 71 | log(`[stalker] thread ${session.threadId} is not paused yet`); |
| 72 | return; |
| 73 | } |
| 74 | |
| 75 | const stepCount = this.normalizeCount(count, 1); |
| 76 | session.runMode = "count"; |
| 77 | session.pendingSteps = stepCount; |
| 78 | session.baseLr = null; |
| 79 | session.targetLr = null; |
| 80 | session.targetPc = null; |
| 81 | log(`[stalker] step thread ${session.threadId} count=${stepCount}`, "green"); |
| 82 | session.semaphore.post(); |
| 83 | } |
| 84 | |
| 85 | stepIn(): void { |
| 86 | const session = this.getPausedSession(); |
| 87 | if (session === null || session.context === null) { |
| 88 | return; |
| 89 | } |
| 90 | |
| 91 | const lr = this.getLinkRegister(session.context); |
| 92 | if (lr === null) { |
| 93 | log("[stalker] step-in requires lr", "yellow"); |
| 94 | return; |
| 95 | } |
| 96 | |
| 97 | if (!this.isCallInstruction(session.instruction)) { |
| 98 | log("[stalker] current instruction is not call-like; step-in falls back to s(1)", "yellow"); |
| 99 | this.step(1); |
| 100 | return; |
| 101 | } |
| 102 | |
| 103 | session.runMode = "step-in"; |
| 104 | session.baseLr = lr; |
| 105 | session.targetLr = null; |
| 106 | session.targetPc = null; |
| 107 | session.autoBudget = MAX_SILENT_AUTO_STEPS; |
| 108 | session.autoStopReason = null; |
| 109 | log(`[stalker] step-in thread ${session.threadId} base-lr=${lr}`, "green"); |
| 110 | session.semaphore.post(); |
| 111 | } |
| 112 |
nothing calls this directly
no test coverage detected