Repository navigation
Return the frame for a new stop and track resumes without a response command (#201, #202) - #203
Open
Fekete Gábor (feketegabor) wants to merge 2 commits into
Conversation
The session tracker observes a DAP `stopped` event before VS Code has requested the call stack and selected a frame for it. A state read in that gap reported `paused: true` with no frame, stack trace or location, and a continue that stopped again at once returned the previous stop's frame ID with no frame name or location. An immediate second `get_debug_status` was correct. This is not specific to one adapter: it reproduces with the built-in Node debugger on 2.4.4 (first status after a breakpoint hit is empty; the state returned by continue carries the stale frame). The tracker now also observes `onDidChangeActiveStackItem` and records the stop for which a frame was selected. `getCurrentDebugState()` waits, bounded by a 2 s grace period, until the latest stop has its frame. A stop that never gets one (no readable stack, or a stop that keeps the existing focus) is waited for once and then reported as a frameless pause, as before. Trackers constructed without the event, and executors without a tracker, never wait. Fixes microsoft#201 Co-Authored-By: Claude Fable 5.2 <[email protected]>
…states
Found with a DAP trace of a live Business Central (AL) session. The AL adapter
answers `next` and `continue` with
{"type":"response","request_seq":14,"command":null,"success":true,"body":null}
The tracker required `command` to equal the request's command, so the
successful-response tracking from microsoft#177 never applied: the session stayed
marked as paused for the whole step. The handler's first poll therefore sent a
`stackTrace` request while the target was running; the adapter answered it
only when the step had finished, by which time the new stop had been
observed. The read was discarded as spanning a transition, but came back
carrying the new stop's sequence and no frame, which the handler took for the
completed step: every `step_over` returned `paused: true` with an empty stack.
- Match resume responses by `request_seq`. An empty (`null` or absent) or
differently cased `command` no longer rules a response out, and a `null`
body is treated as absent. A command naming another request still does.
- When a state read is overtaken by an execution transition and the session
is stopped again, read again (at most three times) instead of returning the
new stop without a frame.
`continue_execution` against such a session now returns as soon as the target
is running, like every other adapter, instead of blocking until the next stop
or the operation timeout.
Fixes microsoft#202
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes for the state DebugMCP returns right after the debuggee stops in VS Code. Fixes #201 and #202.
The first state after a stop is read before VS Code has selected a frame (#201)
DebugSessionTrackersees the DAPstoppedevent before VS Code has fetched the call stack and updatedvscode.debug.activeStackItem. A state read in that gap waspaused: truewith no frame, stack or location, or carried the previous stop's frame ID.onDidChangeActiveStackItemand remembers for which stop a frame was selected.getCurrentDebugState()waits, bounded by 2 s, until the latest stop has its frame.A successful resume response with
"command": nullwas ignored (#202)nextandcontinuewith{"command": null, "success": true, "body": null}and sends nocontinuedevent, so the tracking added for A successful continue or step response should clear the tracked paused state (adapters need not send a continued event) #177 never applied: the session stayed marked as paused during a step.request_seq. An empty or differently casedcommandno longer rules a response out, and anullbody is treated as absent. A command that names another request is still rejected, as the existing test expects.One visible change:
continue_executionagainst such an adapter now returns as soon as the target is running, like other adapters, instead of blocking until the next stop or the operation timeout.Validation
npm run check-types,npm run lint,npm run bundle: clean.CLI adapter configuration › expands a compiled adapter launch target, which also fails onmainon macOS (it expects a\path separator) and is not touched here.src/test/frameSelection.test.ts(first status after a stop, a stop right after a continue, a read overtaken by a step, a frameless stop) and three response cases insrc/test/debugSessionTracker.test.ts."command": nullis not recognized (follow-up to #177) #202 verified against a live Business Central sandbox attach session, in a build that also contains Support breakpoints in virtual source documents such as AL .dal files #137: everystep_overreturns the frame, line and source text of the stop it ends on.🤖 Generated with Claude Code