Repository navigation
fix(debugger): make completion markers unique per session - #137
Merged
Merged
Conversation
Markers were `COMMAND_COMPLETED_MARKER_<n>` from a counter that restarts at 1 in every session. Several clients attached to one shared `-remote` debug server see each other's output, so a marker from another client could complete the wrong command, and `_1` also matched inside `_10`. A random per-session nonce makes a foreign marker unrecognisable, and the completion test is now anchored at the end of the line rather than being a bare substring match. Deliberately still prompt-agnostic. Real cdb and kd write their prompt without a trailing newline, so the marker always arrives prefixed by it (`0:000> ...`, `8: kd> ...`, and `?:???> ...` on a remote target with no process yet). Any matcher that requires the marker to stand alone, or that parses the prompt and then meets a form it does not know, wedges every session of that kind. The rule that a line containing the marker base is ours and never the target's is what makes prompt knowledge unnecessary, and it stays as it was. The test fake emitted a bare marker, which no real debugger does. It now emits a prompt-prefixed one and can be given any of the real prompt forms, so the suite can no longer pass while the protocol is broken against a live debugger.
This was referenced Oct 8, 2026
Closed
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.
Addresses the marker-isolation half of #125, and supersedes #128.
The defect
Every session mints
COMMAND_COMPLETED_MARKER_<n>from a counter that starts at 1, so all sessions use the same marker names. Several clients attached to one shared-remotedebug server see each other's output, so another client's marker can complete the wrong command. The completion test was also a bare substring match, so_1matched inside_10.A random per-session nonce makes a foreign marker unrecognisable, and the match is now anchored at the end of the line.
Why it stays prompt-agnostic
Real
cdbandkdwrite their prompt without a trailing newline, so the completion marker always arrives prefixed by it. Measured here on SDK 10.0.26100 against the committed dumps:The processor number varies, a remote client with no current process shows
?:???>, and a busy engine prefixes*BUSY*. So two approaches both break:This takes neither. The existing rule that a line containing the marker base is ours and never the target's is what makes prompt knowledge unnecessary, and it is unchanged. Only the completion test moved from
into an end-anchored match, which also covers a marker glued onto a command's last output line.The test fake was certifying the bug
_FakeProcemitted a bare marker, which no real debugger does. It now emits a prompt-prefixed one and accepts any of the real prompt forms, so a matcher that fails against a live debugger can no longer pass the suite.Verification
Baseline before this change is 189 passed; the 9 added are the 8 real prompt forms plus nonce uniqueness across sessions. Live tests included, driving real
cdbandkd.Real-target acceptance, with the nonce in place:
Relationship to #128
#128 diagnosed this correctly and I have credited that in the commit trailer of the follow-up discussion on the issue. Its implementation required a standalone marker line, which rejects all of the real output above: measured,
developopens a dump in 0.2s where that branch times out after 15s on bothcdbandkd. It also carried a 1036-line module split that the fix does not need. This is the four-line equivalent, so #128 will be closed with the measurement rather than merged.