Add optional two-level DAP protocol logging#16
Merged
Conversation
When diagnosing issues between the MCP server and a DAP debugger, it is valuable to see what each side thinks was sent and received. A single log cannot provide this because the MCP server's view may diverge from the debugger's view due to message corruption, buffering issues, or bugs in either side. Two levels of logging allow the logs to be diffed to pinpoint exactly where a problem occurs. Protocol-level logging (protocolLog parameter) records the DAP JSON messages as the MCP server's DAPClient sees them: what it marshaled for sending and what it unmarshaled after reading. This works with all debugger backends. Tool-level logging (toolLog parameter) enables the debugger's own native DAP logging. For GDB, this passes -iex 'set debug dap-log-file <path>' so GDB records what it actually received and sent. For Delve, a warning is logged since its DAP output already goes to the server log via stderr. Both parameters are optional on the debug tool and accept a file path. 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.
When diagnosing issues between the MCP server and a DAP debugger, it is valuable to see what each side thinks was sent and received. A single log cannot provide this because the MCP server's view may diverge from the debugger's view due to message corruption, buffering issues, or bugs in either side. Two levels of logging allow the logs to be diffed to pinpoint exactly where a problem occurs.
Protocol-level logging (protocolLog parameter) records the DAP JSON messages as the MCP server's DAPClient sees them: what it marshaled for sending and what it unmarshaled after reading. This works with all debugger backends.
Tool-level logging (toolLog parameter) enables the debugger's own native DAP logging. For GDB, this passes -iex 'set debug dap-log-file ' so GDB records what it actually received and sent. For Delve, a warning is logged since its DAP output already goes to the server log via stderr.
Both parameters are optional on the debug tool and accept a file path.