The AI Debug Assistant is an agentic debugging system built into CodeFusion Studio that actively participates in live debug sessions, autonomously investigating hardware faults, reading register and memory state, and coordinating across multiple cores — all in real time, using natural language.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/analogdevicesinc/codefusion-studio/llms.txt
Use this file to discover all available pages before exploring further.
What makes it different
Traditional AI code assistants work with static source. The AI Debug Assistant connects to a live debug session through the Model Context Protocol (MCP) — an open standard created by Anthropic for connecting AI models to external tools and data sources. This means the AI has access to actual hardware state: the contents of fault registers, live memory values, the call stack at the moment of a crash, and the execution state of every core in a multi-core system. When you ask “What caused this hard fault?”, the assistant does not guess from source code. It reads the ARM Cortex-M fault status registers (CFSR, HFSR, BFAR, MMFAR), decodes the exception type, inspects the faulting address against the memory map, and walks the call stack to the offending source line — all autonomously.Integration paths
CFS MCP Debug Server (Recommended)
CFS Debug Chat Participant
@cfs-debug participant. Works without starting the MCP server. Best for quick, single-step interactions within VS Code.What the assistant can do
| Capability | Description |
|---|---|
| Session control | Start, stop, restart, continue, pause, and step through debug sessions |
| Hardware state inspection | Read registers, memory, variables, stack traces, and thread lists directly from the target |
| Breakpoints and watchpoints | Set, list, and remove breakpoints — including conditional breakpoints — and hardware watchpoints |
| GDB command execution | Run GDB commands with built-in safety guards that block destructive operations |
| Fault decoding | Automatically parse ARM Cortex-M fault registers (CFSR, HFSR, BFAR, MMFAR) and RISC-V exception registers (mcause, mtval, mepc) |
| ELF binary analysis | Surface symbol sizes, stack usage, section layout, and the largest consumers of flash and RAM |
| Structured diagnostic prompts | Pre-built investigation sequences for crash diagnosis, memory corruption, peripheral misconfiguration, multi-core debugging, and more |
Getting started with the MCP debug server
Prerequisites
- CodeFusion Studio installed with an active project
- For GitHub Copilot Agent Mode: VS Code 1.96.0 or later and the GitHub Copilot extension installed and authenticated
- For Claude Code: Claude Code CLI installed
Start the MCP server
Ctrl+Shift+P / Cmd+Shift+P) and run:http://localhost:56448/mcp. Note the port number — you will need it to connect AI clients.The following commands manage the server:| Command | Description |
|---|---|
(CFS) MCP: Start Debug Server | Start the MCP server |
(CFS) MCP: Stop Debug Server | Stop the MCP server |
(CFS) MCP: Server Status | Check whether the server is running and which port it is using |
(Optional) Set a fixed port
- Go to Settings → Extensions → CodeFusion Studio → General, or search for
cfs.mcp.port. - Set Port to a specific value (for example,
3001). Set to0to restore OS-assigned behavior. - Restart the MCP server: run Stop Debug Server then Start Debug Server.
Connect GitHub Copilot Agent Mode
- Open GitHub Copilot Chat (
Ctrl+Alt+I/Cmd+Shift+I). - Click the mode selector dropdown in the chat input (defaults to Ask).
- Select Agent.
cfs.mcp.port setting.Connect Claude Code
(CFS) MCP: Server Status, then register the server:Start a debug session
Getting started with the chat participant
For quick interactions within VS Code without setting up the MCP server:Ensure prerequisites
Using the assistant during a live debug session
Natural language investigations (MCP server)
With the MCP server running and a debug session active, describe the problem in plain language. The assistant determines the investigation sequence autonomously:Chat participant commands (@cfs-debug)
- Session control
- Breakpoints
- Hardware state
- GDB commands
- AI analysis
Real-world examples
Diagnosing a hard fault
Diagnosing a hard fault
“What caused this hard fault?”The AI Debug Assistant:
- Reads the ARM Cortex-M fault status registers (CFSR, HFSR, BFAR, MMFAR)
- Decodes the exception type: bus fault, memory management fault, usage fault, or hard fault
- Inspects the faulting address against the memory map
- Walks the call stack to identify the offending function and source line
- Reports the root cause in plain language with the relevant file and line number
Tracking a multi-core shared memory race condition
Tracking a multi-core shared memory race condition
Tracing memory corruption with a watchpoint
Tracing memory corruption with a watchpoint
“Watch shared_buffer for writes and tell me what’s writing to it.”The AI Debug Assistant:
- Locates the variable in the ELF symbol table to get its address
- Sets a hardware watchpoint on that address
- Continues execution and waits for the watchpoint to fire
- Reads the call stack at the point of the write
- Disassembles the surrounding code to identify the root cause
- Reports the offending function, source line, and the value written
Analyzing firmware binary size
Analyzing firmware binary size
“Analyze the firmware binary and show me the largest consumers of flash and RAM.”The assistant reads the ELF binary, surfaces symbol sizes and section layout, ranks the largest contributors, and suggests optimization candidates — without requiring you to manually run
arm-none-eabi-nm and sort the output.MCP tools reference
The CFS MCP debug server exposes tools organized into six categories. All tools are available to any connected MCP-compatible client.- GDB commands
- Session lifecycle
- Execution control
- Breakpoints & watchpoints
- Memory
- Analysis
| Tool | Description | Parameters |
|---|---|---|
debug_execute_gdb_command | Execute a single GDB command. Destructive commands are blocked. | command |
debug_execute_gdb_sequence | Execute a sequence of GDB commands in order. Session must be halted. | commands (array, 1–20), stopOnError (optional) |
Diagnostic prompts reference
Pre-built diagnostic prompts encode systematic debugging methodologies. Invoke them by describing the task in natural language, or by name in any MCP-compatible client. In Claude Code, run/mcp to browse all available prompts.
| Prompt | What it does | Parameters |
|---|---|---|
basic-state-awareness | Reports execution state, program counter, and stack pointer | — |
crash-diagnosis | Waits for a crash, decodes fault registers, walks call stack, identifies offending function | — |
breakpoint-and-inspect | Sets a breakpoint, continues, reports local variables when hit | file, line |
source-search-and-debug | Finds code matching a description, sets a breakpoint, inspects registers | description |
conditional-breakpoint | Sets a conditional breakpoint, catches it twice, reads a variable each time | condition, variable (optional) |
step-and-disassemble | Steps N instructions, showing disassembly and a register value at each step | steps (optional), register (optional) |
watchpoint-trigger | Watches a variable for writes, reports what wrote to it with the full call stack | variable |
memory-inspection | Reads a memory region; identifies ASCII strings, structured data, or byte patterns | address, length (optional) |
autonomous-investigation | End-to-end memory corruption investigation: locates struct in ELF, sets watchpoint, traces root cause | variable |
timeout-handling | Sets a breakpoint on a function and reports what happens; useful for testing error paths | functionName |
Settings reference
| Setting | Description | Default |
|---|---|---|
cfs.mcp.runOnActivation | Automatically start the MCP server when the CFS extension activates | false |
cfs.mcp.port | Port for the MCP server. Set to 0 for OS-assigned port. | 0 |
Troubleshooting
MCP server port conflict
MCP server port conflict
- Open Settings and search for
cfs.mcp.port. - Set Port to a specific free port (for example,
3001). Use0for OS-assigned. - Run Stop Debug Server then Start Debug Server.
- Update your AI client registration to use the new port.
No active debug session
No active debug session
No Copilot model available
No Copilot model available
No Copilot model available. Please ensure GitHub Copilot is installed and authenticated:- Verify GitHub Copilot is installed and you are signed in.
- Confirm your GitHub Copilot plan includes access to Claude models (Claude Sonnet 4.5 or Claude Opus 4.6).
CFS Debug Assistant tools not appearing in GitHub Copilot Chat
CFS Debug Assistant tools not appearing in GitHub Copilot Chat
- Check that VS Code is version 1.96.0 or later (Help → About).
- Ensure GitHub Copilot is installed and authenticated.
- Confirm the CodeFusion Studio extension is installed and active.
- If MCP support is unavailable in your VS Code environment, use the
@cfs-debugchat participant or Claude Code instead.
Claude Code cannot connect to the MCP server
Claude Code cannot connect to the MCP server
-
Run
(CFS) MCP: Server Statusto confirm the server is running. -
Run
claude mcp listto verifycfs-debugis registered with the correct URL and port. -
If the port has changed since registration, re-register:
http://localhost:<port>/mcp. Browse all available tools and prompts to verify the server is working before involving an AI client.Agent Mode does not show CFS MCP server tools
Agent Mode does not show CFS MCP server tools
@cfs-debug chat participant or connect with Claude Code instead.