Fix several bugs with native GDB DAP#12
Merged
Merged
Conversation
Two bugs caused expression evaluation to fail with GDB's native DAP: 1. Default evaluate context was "repl", which GDB interprets as a GDB command rather than a language expression. Changed default to "watch" per DAP spec semantics. 2. go-dap's EvaluateArguments uses omitempty on FrameId, which drops frameId=0 from the JSON. GDB uses 0-based frame IDs, so this caused evaluation in global scope where local variables aren't visible. Fixed by building evaluate arguments as raw JSON. Also fixed FrameID parameter to use *FlexInt (pointer) so we can distinguish "user sent frameId=0" from "frameId not provided", and changed lastFrameID sentinel from 0 to -1 since 0 is a valid GDB frame ID. Adds regression tests for bare expressions, pointer dereference, address-of, casts, and register access with GDB backend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Guide AI models to use valid language expressions (not GDB commands like /x) in the default watch context, and document how to use repl context for GDB-specific commands. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
GDB's native DAP distinguishes between stopOnEntry (starti, first instruction in dynamic linker) and stopAtBeginningOfMainSubprogram (start, main function). The latter is almost always the desired behavior, matching what users expect from "stop on entry". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MCP clients can make concurrent tool calls, but the DAP connection has a single reader. Without serialization, concurrent calls race on the reader and receive each other's responses (e.g., info(threads) gets a ScopesResponse from a concurrent context call). Add a sync.Mutex to debuggerSession that each tool handler acquires before sending DAP requests, preventing interleaved reads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace single-reader architecture docs with serialized mutex docs now that concurrent tool calls are properly serialized. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Fix an issue around serialization of certain requests where the frameID gets lost due to the go-dap extension thinking the
inthas its zero value and omitting it.Rely more heavily on request / response sequencing to ensure we are waiting for and receiving the correct response.