get_debug_status tool returns the wrong status when already stopped at a breakpoint
This is actually two issues that might be related:
I am using Cortex-Debug extension to debug code running in a Microcontroller (if that matters for the issue).
When the code stops at a breakpoint and the agent requests the current debug status via get_debug_status tool, the response is always 'running':
However, VSCode debug controls shows the correct state:
Then (this is the second issue), when the agent calls pause_execution tool, it hangs forever (the session is already stopped at the breakpoint).
Additional information: while the agent is waiting for the pause_execution to finish, if I click the step into button, the pause_execution command succeeds and the agent continues.
This is pretty annoying because you cannot automate the process.
I assume this is not an issue in the Cortex-Debug extension because VSCode debug buttons show the correct state.
The fix is implemented in PR #158: https://github.com/microsoft/DebugMCP/pull/158
DebugMCP now tracks stopped/continued adapter events independently of source and stack availability. Calling pause_execution when already stopped returns the current state without issuing another pause or waiting for a step.
We reproduced both the source-less-frame failure and the distinctive empty-stack sequence in an isolated VS Code/MCP environment: status reported running, and pause remained pending until manual Step Into supplied a frame. The fixed implementation reports paused even with no frame and needs no manual step. The empty-stack reproduction uses a controlled adapter matching a verified Cortex-Debug code path, not physical microcontroller hardware.
Closing at the maintainer's request with implementation tracked in #158. The PR remains open for review; the fix is not yet merged or published. It includes an extension version bump to 2.4.1.
Thanks for the quick fix!
I confirm that the reported issue was solved (tested with the vsix from the PR).
Now get_debug_status returns the correct status.
However, there are still some cases where a command hangs:
Sometimes, step_over hangs when the debugger is stopped at a breakpoint.
Clicking 'step into' button releases it.
I also saw cases when a restart was requested, the action was executed, but the restart command never returns to the agent.
The debug control buttons shows the correct state of the debugger:
Sorry but I don't have more concrete information on how to reproduce this.
Not sure if I should report these as new issue (?)
@rhobison Thanks for confirming that the original paused-status issue is fixed!
We also reproduced the step_over hang in an isolated VS Code/MCP session using a controlled DAP adapter (not physical microcontroller hardware). A fresh stop with unchanged frame/location information, or an empty stack, could leave the command waiting until a manual Step Into or the operation timeout.
PR #158 now includes a fix for this follow-up in commit 959ac10: stepping recognizes a fresh stopped event rather than requiring a different frame or source location. Please try the updated VSIX from the latest PR extension build (extension-vsix artifact). The PR is still open; these changes are not yet merged or published.
We could not reproduce the separate case where restart executes but restart_debugging never returns to the agent. Please open a new issue for that restart hang, with reproduction steps and as much of the following as possible:
- The exact tool/UI sequence leading to the hang, including whether execution was running or stopped before restart, how long you waited, and whether a manual action releases it.
- A minimal sample and sanitized
launch.json, if shareable, plus the target/probe and GDB server used. - DebugMCP build, VS Code, Cortex-Debug, GDB, and OS versions, and the AI client being used.
- Sanitized DebugMCP output and Cortex-Debug/DAP logs covering the restart request and the subsequent stop. Please remove secrets and private paths/data before posting.
If it is intermittent, an observed sequence and approximate frequency are still useful even without a fully deterministic reproduction. Please link the new issue back to #157.
@ozzafar I did test the latest PR extension build vsix and apparently, the issue about step_over is fixed.
I'll run more tests tomorrow and I'll let you know if I find anything.
During the tests, I saw the restart_debugging hanging again, but I still don't have a good way to describe what are the conditions that make it happen. I'll keep testing and I'll try to see a pattern when it happens.
I'll report back tomorrow.
Thanks again for looking into this!
I did more testing and apparently all issues are gone, except for the restart_debugging hanging.
This very simple sequence below if enough to make it hang every time:
- send
start_debugging - wait 5 secs (time not relevant, just to have some interval between the tool calls)
- send
restart_debugging
I can see the session is restarted, but the call to restart_debugging never returns.
I created another issue to track this: #160