VibeDbg is a conversational, LLM-powered AI assistant for WinDbg that transforms live debugging into a natural-language, interactive experience. This document describes the architecture, component interactions, and design decisions that make this system work.
VibeDbg follows a client-server architecture with two main components:
- WinDbg Extension (C++) - Native extension that integrates with WinDbg
- MCP Server (Python) - Model Context Protocol server that provides AI integration
The system enables natural language debugging by bridging traditional WinDbg commands with modern AI assistance through a robust communication layer.
graph TB
subgraph "User Interface Layer"
LLM[LLM Assistant<br/>Claude/GPT/etc.]
VSCode[VS Code<br/>with MCP Client]
end
subgraph "MCP Server Layer"
MCPServer[VibeDbg MCP Server<br/>Python]
Tools[Debugging Tools<br/>Core Tools]
Router[Command Router<br/>Pattern Matching]
Executor[Command Executor<br/>Execution Engine]
end
subgraph "Communication Layer"
NamedPipe[Named Pipe<br/>Communication]
Protocol[Message Protocol<br/>JSON]
end
subgraph "WinDbg Extension Layer"
Extension[VibeDbg Extension<br/>C++]
SessionMgr[Session Manager<br/>State Management]
CommandHandlers[Command Handlers<br/>WinDbg Integration]
PipeServer[Named Pipe Server<br/>Client Management]
end
subgraph "WinDbg Layer"
WinDbg[WinDbg Debugger<br/>Native Debugger]
DebugAPIs[Debug APIs<br/>IDebugClient, etc.]
end
subgraph "Target Process Layer"
TargetProcess[Target Process<br/>Being Debugged]
end
%% User Interface to MCP Server
LLM -->|Natural Language| VSCode
VSCode -->|MCP Protocol| MCPServer
%% MCP Server Internal
MCPServer --> Tools
MCPServer --> Router
Router --> Executor
%% MCP Server to Extension
Executor -->|Command Requests| NamedPipe
NamedPipe -->|JSON Messages| Protocol
Protocol --> Extension
%% Extension Internal
Extension --> SessionMgr
Extension --> CommandHandlers
Extension --> PipeServer
%% Extension to WinDbg
CommandHandlers -->|WinDbg Commands| WinDbg
WinDbg -->|Debug APIs| DebugAPIs
DebugAPIs --> TargetProcess
%% Response Flow
TargetProcess -->|Debug Info| DebugAPIs
DebugAPIs -->|Results| WinDbg
WinDbg -->|Command Output| CommandHandlers
CommandHandlers -->|Response| Extension
Extension -->|JSON Response| Protocol
Protocol -->|Response Data| NamedPipe
NamedPipe -->|Results| Executor
Executor -->|Formatted Output| MCPServer
MCPServer -->|Structured Response| VSCode
VSCode -->|Natural Language| LLM
classDef userLayer fill:#2196f3,stroke:#1976d2,stroke-width:2px,color:#ffffff
classDef mcpLayer fill:#9c27b0,stroke:#7b1fa2,stroke-width:2px,color:#ffffff
classDef commLayer fill:#ff9800,stroke:#f57c00,stroke-width:2px,color:#ffffff
classDef extLayer fill:#4caf50,stroke:#388e3c,stroke-width:2px,color:#ffffff
classDef windbgLayer fill:#f44336,stroke:#d32f2f,stroke-width:2px,color:#ffffff
classDef targetLayer fill:#8bc34a,stroke:#689f38,stroke-width:2px,color:#ffffff
class LLM,VSCode userLayer
class MCPServer,Tools,Router,Executor mcpLayer
class NamedPipe,Protocol commLayer
class Extension,SessionMgr,CommandHandlers,PipeServer extLayer
class WinDbg,DebugAPIs windbgLayer
class TargetProcess targetLayer
sequenceDiagram
participant User
participant VSCode
participant MCPServer
participant Extension
participant WinDbg
User->>VSCode: Start debugging session
VSCode->>MCPServer: Initialize MCP connection
MCPServer->>MCPServer: Load tools and setup routing
MCPServer->>Extension: Establish named pipe connection
Extension->>Extension: Initialize session manager
Extension->>WinDbg: Register extension commands
WinDbg->>Extension: Confirm registration
Extension->>MCPServer: Connection established
MCPServer->>VSCode: Ready for commands
VSCode->>User: Debugging session ready
sequenceDiagram
participant LLM
participant VSCode
participant MCPServer
participant Router
participant Executor
participant Extension
participant WinDbg
participant Target
LLM->>VSCode: Natural language request
VSCode->>MCPServer: Call tool with parameters
MCPServer->>Router: Route command to handler
Router->>Executor: Execute WinDbg command
Executor->>Extension: Send command via named pipe
Extension->>WinDbg: Execute WinDbg command
WinDbg->>Target: Debug target process
Target->>WinDbg: Return debug information
WinDbg->>Extension: Return command output
Extension->>Executor: Send response via named pipe
Executor->>Router: Process and format results
Router->>MCPServer: Return structured data
MCPServer->>VSCode: Tool result
VSCode->>LLM: Formatted response
The extension is built as a native WinDbg extension DLL with the following key components:
graph TB
subgraph "Extension Entry Points"
DllMain[DllMain<br/>DLL Entry Point]
Init[DebugExtensionInitialize<br/>Extension Setup]
Unload[DebugExtensionUnload<br/>Cleanup]
end
subgraph "Core Extension"
ExtensionImpl[ExtensionImpl<br/>Main Controller]
SessionMgr[SessionManager<br/>State Management]
CommandExec[CommandExecutor<br/>Command Processing]
PipeServer[NamedPipeServer<br/>Communication]
end
subgraph "Command Handlers"
CoreHandlers[Core Command Handlers<br/>!vibedbg_*]
WinDbgHandlers[WinDbg Command Handlers<br/>Standard Commands]
CustomHandlers[Custom Handlers<br/>Specialized Logic]
end
subgraph "Utilities"
Logger[Logger<br/>Dual Logging System]
ErrorHandler[ErrorHandler<br/>Exception Management]
Utils[Utilities<br/>Helper Functions]
end
subgraph "WinDbg Integration"
DebugClient[IDebugClient<br/>Debug Client Interface]
DebugControl[IDebugControl<br/>Control Interface]
DebugData[IDebugDataSpaces<br/>Data Access]
end
%% Entry points to core
DllMain --> ExtensionImpl
Init --> ExtensionImpl
Unload --> ExtensionImpl
%% Core extension relationships
ExtensionImpl --> SessionMgr
ExtensionImpl --> CommandExec
ExtensionImpl --> PipeServer
%% Command execution flow
CommandExec --> CoreHandlers
CommandExec --> WinDbgHandlers
CommandExec --> CustomHandlers
%% Utility dependencies
ExtensionImpl --> Logger
ExtensionImpl --> ErrorHandler
ExtensionImpl --> Utils
%% WinDbg integration
ExtensionImpl --> DebugClient
ExtensionImpl --> DebugControl
ExtensionImpl --> DebugData
classDef entryPoint fill:#f44336,stroke:#d32f2f,stroke-width:2px,color:#ffffff
classDef core fill:#4caf50,stroke:#388e3c,stroke-width:2px,color:#ffffff
classDef handlers fill:#ff9800,stroke:#f57c00,stroke-width:2px,color:#ffffff
classDef utils fill:#9c27b0,stroke:#7b1fa2,stroke-width:2px,color:#ffffff
classDef windbg fill:#2196f3,stroke:#1976d2,stroke-width:2px,color:#ffffff
class DllMain,Init,Unload entryPoint
class ExtensionImpl,SessionMgr,CommandExec,PipeServer core
class CoreHandlers,WinDbgHandlers,CustomHandlers handlers
class Logger,ErrorHandler,Utils utils
class DebugClient,DebugControl,DebugData windbg
The MCP server provides the AI integration layer with comprehensive tool management:
graph TB
subgraph "MCP Server Entry"
ServerMain[Server Main<br/>Entry Point]
MCPServer[VibeDbgMCPServer<br/>Main Server Class]
Config[ServerConfig<br/>Configuration]
end
subgraph "Core Components"
CommandExec[CommandExecutor<br/>Execution Engine]
Router[CommandRouter<br/>Pattern Matching]
CommMgr[CommunicationManager<br/>Named Pipe Client]
ToolMgr[Tool Manager<br/>Tool Registration]
end
subgraph "Tool Categories"
CoreTools[Core Tools<br/>Basic Debugging]
AnalysisTools[Analysis Tools<br/>Advanced Analysis]
PerfTools[Performance Tools<br/>Profiling]
SessionTools[Session Tools<br/>Session Management]
SupportTools[Support Tools<br/>Utilities]
end
subgraph "Communication Layer"
NamedPipe[Named Pipe Client<br/>Connection Pooling]
Protocol[Message Protocol<br/>JSON Serialization]
Retry[Retry Logic<br/>Error Recovery]
end
subgraph "Error Handling"
Exceptions[Exception Framework<br/>Categorized Errors]
Logging[Structured Logging<br/>Severity Levels]
Monitoring[Health Monitoring<br/>Connection Status]
end
%% Server initialization
ServerMain --> MCPServer
MCPServer --> Config
%% Core component relationships
MCPServer --> CommandExec
MCPServer --> Router
MCPServer --> CommMgr
MCPServer --> ToolMgr
%% Tool management
ToolMgr --> CoreTools
ToolMgr --> AnalysisTools
ToolMgr --> PerfTools
ToolMgr --> SessionTools
ToolMgr --> SupportTools
%% Communication flow
CommandExec --> Router
Router --> CommMgr
CommMgr --> NamedPipe
NamedPipe --> Protocol
NamedPipe --> Retry
%% Error handling
MCPServer --> Exceptions
MCPServer --> Logging
CommMgr --> Monitoring
classDef entry fill:#f44336,stroke:#d32f2f,stroke-width:2px,color:#ffffff
classDef core fill:#4caf50,stroke:#388e3c,stroke-width:2px,color:#ffffff
classDef tools fill:#ff9800,stroke:#f57c00,stroke-width:2px,color:#ffffff
classDef comm fill:#9c27b0,stroke:#7b1fa2,stroke-width:2px,color:#ffffff
classDef error fill:#2196f3,stroke:#1976d2,stroke-width:2px,color:#ffffff
class ServerMain,MCPServer,Config entry
class CommandExec,Router,CommMgr,ToolMgr core
class CoreTools,AnalysisTools,PerfTools,SessionTools,SupportTools tools
class NamedPipe,Protocol,Retry comm
class Exceptions,Logging,Monitoring error
graph LR
subgraph "MCP Server Side"
MCPClient[MCP Client<br/>Tool Call]
Serializer[Message Serializer<br/>JSON]
PipeClient[Named Pipe Client<br/>Connection Pool]
end
subgraph "Transport Layer"
NamedPipe[Named Pipe<br/>Windows IPC]
Protocol[Message Protocol<br/>Request/Response]
end
subgraph "Extension Side"
PipeServer[Named Pipe Server<br/>Multi-threaded]
Deserializer[Message Deserializer<br/>JSON]
CommandHandler[Command Handler<br/>WinDbg Integration]
end
MCPClient --> Serializer
Serializer --> PipeClient
PipeClient --> NamedPipe
NamedPipe --> PipeServer
PipeServer --> Deserializer
Deserializer --> CommandHandler
%% Response flow
CommandHandler --> Deserializer
Deserializer --> PipeServer
PipeServer --> NamedPipe
NamedPipe --> PipeClient
PipeClient --> Serializer
Serializer --> MCPClient
classDef mcpSide fill:#9c27b0,stroke:#7b1fa2,stroke-width:2px,color:#ffffff
classDef transport fill:#ff9800,stroke:#f57c00,stroke-width:2px,color:#ffffff
classDef extSide fill:#4caf50,stroke:#388e3c,stroke-width:2px,color:#ffffff
class MCPClient,Serializer,PipeClient mcpSide
class NamedPipe,Protocol transport
class PipeServer,Deserializer,CommandHandler extSide
graph TB
subgraph "Request Messages"
CommandReq[CommandRequest<br/>Execute WinDbg Command]
StatusReq[StatusRequest<br/>Get Extension Status]
ConnectReq[ConnectRequest<br/>Establish Connection]
HeartbeatReq[HeartbeatRequest<br/>Connection Health]
end
subgraph "Response Messages"
CommandResp[CommandResponse<br/>Command Results]
StatusResp[StatusResponse<br/>Status Information]
ConnectResp[ConnectResponse<br/>Connection Status]
HeartbeatResp[HeartbeatResponse<br/>Health Status]
end
subgraph "Error Messages"
ErrorMsg[ErrorMessage<br/>Error Information]
TimeoutMsg[TimeoutError<br/>Operation Timeout]
ValidationMsg[ValidationError<br/>Invalid Input]
end
%% Request to Response mapping
CommandReq --> CommandResp
StatusReq --> StatusResp
ConnectReq --> ConnectResp
HeartbeatReq --> HeartbeatResp
%% Error conditions
CommandReq --> ErrorMsg
CommandReq --> TimeoutMsg
CommandReq --> ValidationMsg
classDef request fill:#f44336,stroke:#d32f2f,stroke-width:2px,color:#ffffff
classDef response fill:#4caf50,stroke:#388e3c,stroke-width:2px,color:#ffffff
classDef error fill:#ff9800,stroke:#f57c00,stroke-width:2px,color:#ffffff
class CommandReq,StatusReq,ConnectReq,HeartbeatReq request
class CommandResp,StatusResp,ConnectResp,HeartbeatResp response
class ErrorMsg,TimeoutMsg,ValidationMsg error
graph TB
subgraph "Base Exceptions"
BaseException[Exception<br/>Python Base]
CommunicationError[CommunicationError<br/>Base Comm Error]
ValidationError[ValidationError<br/>Input Validation]
ExecutionError[ExecutionError<br/>Command Execution]
end
subgraph "Communication Exceptions"
PipeTimeoutError[PipeTimeoutError<br/>Named Pipe Timeout]
ConnectionError[ConnectionError<br/>Connection Failure]
NetworkDebuggingError[NetworkDebuggingError<br/>Network Issues]
end
subgraph "Validation Exceptions"
InvalidCommandError[InvalidCommandError<br/>Bad Command]
ParameterError[ParameterError<br/>Invalid Parameters]
ConfigurationError[ConfigurationError<br/>Config Issues]
end
subgraph "Execution Exceptions"
CommandExecutionError[CommandExecutionError<br/>Command Failed]
TimeoutError[TimeoutError<br/>Operation Timeout]
ResourceError[ResourceError<br/>Resource Issues]
end
%% Inheritance relationships
BaseException --> CommunicationError
BaseException --> ValidationError
BaseException --> ExecutionError
CommunicationError --> PipeTimeoutError
CommunicationError --> ConnectionError
CommunicationError --> NetworkDebuggingError
ValidationError --> InvalidCommandError
ValidationError --> ParameterError
ValidationError --> ConfigurationError
ExecutionError --> CommandExecutionError
ExecutionError --> TimeoutError
ExecutionError --> ResourceError
classDef base fill:#2196f3,stroke:#1976d2,stroke-width:2px,color:#ffffff
classDef comm fill:#f44336,stroke:#d32f2f,stroke-width:2px,color:#ffffff
classDef validation fill:#ff9800,stroke:#f57c00,stroke-width:2px,color:#ffffff
classDef execution fill:#4caf50,stroke:#388e3c,stroke-width:2px,color:#ffffff
class BaseException,CommunicationError,ValidationError,ExecutionError base
class PipeTimeoutError,ConnectionError,NetworkDebuggingError comm
class InvalidCommandError,ParameterError,ConfigurationError validation
class CommandExecutionError,TimeoutError,ResourceError execution
stateDiagram-v2
[*] --> Uninitialized
Uninitialized --> Initializing : Extension Loaded
Initializing --> Connected : MCP Server Connected
Connected --> Active : First Command
Active --> Connected : Command Complete
Active --> Disconnected : Connection Lost
Disconnected --> Reconnecting : Retry Attempt
Reconnecting --> Connected : Reconnection Success
Reconnecting --> Failed : Max Retries Exceeded
Connected --> ShuttingDown : Extension Unload
Active --> ShuttingDown : Extension Unload
ShuttingDown --> [*] : Cleanup Complete
Failed --> [*] : Manual Reset
graph TB
subgraph "Connection Pool"
Pool[Connection Pool Manager<br/>Thread-Safe]
Conn1[Connection 1<br/>Handle + Metadata]
Conn2[Connection 2<br/>Handle + Metadata]
Conn3[Connection 3<br/>Handle + Metadata]
ConnN[Connection N<br/>Handle + Metadata]
end
subgraph "Pool Operations"
Acquire[Acquire Connection<br/>Get Available Handle]
Release[Release Connection<br/>Return to Pool]
Health[Health Check<br/>Validate Connection]
Cleanup[Cleanup Dead<br/>Remove Invalid]
end
subgraph "Thread Safety"
Lock[Thread Lock<br/>Synchronization]
Queue[Request Queue<br/>Pending Operations]
end
Pool --> Conn1
Pool --> Conn2
Pool --> Conn3
Pool --> ConnN
Acquire --> Pool
Release --> Pool
Health --> Pool
Cleanup --> Pool
Pool --> Lock
Pool --> Queue
classDef pool fill:#2196f3,stroke:#1976d2,stroke-width:2px,color:#ffffff
classDef operations fill:#ff9800,stroke:#f57c00,stroke-width:2px,color:#ffffff
classDef safety fill:#4caf50,stroke:#388e3c,stroke-width:2px,color:#ffffff
class Pool,Conn1,Conn2,Conn3,ConnN pool
class Acquire,Release,Health,Cleanup operations
class Lock,Queue safety
graph TB
subgraph "Input Sources"
LLMInput[LLM Input<br/>Natural Language]
ToolInput[Tool Parameters<br/>Structured Data]
ConfigInput[Configuration<br/>Settings]
end
subgraph "Validation Layers"
SyntaxValidation[Syntax Validation<br/>Format Checking]
SemanticValidation[Semantic Validation<br/>Meaning Checking]
SecurityValidation[Security Validation<br/>Safety Checking]
end
subgraph "Sanitization"
CommandSanitize[Command Sanitization<br/>WinDbg Commands]
ParameterSanitize[Parameter Sanitization<br/>Input Parameters]
OutputSanitize[Output Sanitization<br/>Response Data]
end
subgraph "Execution Context"
Sandbox[Execution Sandbox<br/>Isolated Environment]
Permissions[Permission Checks<br/>Access Control]
Logging[Security Logging<br/>Audit Trail]
end
%% Input flow
LLMInput --> SyntaxValidation
ToolInput --> SyntaxValidation
ConfigInput --> SyntaxValidation
%% Validation flow
SyntaxValidation --> SemanticValidation
SemanticValidation --> SecurityValidation
%% Sanitization flow
SecurityValidation --> CommandSanitize
SecurityValidation --> ParameterSanitize
%% Execution flow
CommandSanitize --> Sandbox
ParameterSanitize --> Sandbox
Sandbox --> Permissions
Permissions --> Logging
%% Output flow
Logging --> OutputSanitize
classDef input fill:#f44336,stroke:#d32f2f,stroke-width:2px,color:#ffffff
classDef validation fill:#ff9800,stroke:#f57c00,stroke-width:2px,color:#ffffff
classDef sanitization fill:#4caf50,stroke:#388e3c,stroke-width:2px,color:#ffffff
classDef security fill:#9c27b0,stroke:#7b1fa2,stroke-width:2px,color:#ffffff
class LLMInput,ToolInput,ConfigInput input
class SyntaxValidation,SemanticValidation,SecurityValidation validation
class CommandSanitize,ParameterSanitize,OutputSanitize sanitization
class Sandbox,Permissions,Logging security
graph TB
subgraph "Development"
Code[Code Changes<br/>C++/Python]
Tests[Unit Tests<br/>pytest/Catch2]
Lint[Code Quality<br/>black/flake8/mypy]
end
subgraph "Build Process"
BuildExt[Build Extension<br/>Visual Studio]
BuildMCP[Build MCP Server<br/>uv/pip]
Package[Package Distribution<br/>DLL/Python Package]
end
subgraph "Testing"
UnitTest[Unit Tests<br/>Component Testing]
IntegrationTest[Integration Tests<br/>End-to-End]
ManualTest[Manual Testing<br/>WinDbg Integration]
end
subgraph "Deployment"
Deploy[Deploy to Target<br/>Development Environment]
Validate[Validate Functionality<br/>Real Debugging]
Monitor[Monitor Performance<br/>Logs and Metrics]
end
%% Development flow
Code --> Tests
Tests --> Lint
%% Build flow
Lint --> BuildExt
Lint --> BuildMCP
BuildExt --> Package
BuildMCP --> Package
%% Testing flow
Package --> UnitTest
UnitTest --> IntegrationTest
IntegrationTest --> ManualTest
%% Deployment flow
ManualTest --> Deploy
Deploy --> Validate
Validate --> Monitor
classDef dev fill:#2196f3,stroke:#1976d2,stroke-width:2px,color:#ffffff
classDef build fill:#ff9800,stroke:#f57c00,stroke-width:2px,color:#ffffff
classDef test fill:#4caf50,stroke:#388e3c,stroke-width:2px,color:#ffffff
classDef deploy fill:#9c27b0,stroke:#7b1fa2,stroke-width:2px,color:#ffffff
class Code,Tests,Lint dev
class BuildExt,BuildMCP,Package build
class UnitTest,IntegrationTest,ManualTest test
class Deploy,Validate,Monitor deploy
- Decision: Use Windows Named Pipes for IPC between extension and MCP server
- Rationale: Native Windows IPC mechanism, reliable, supports both local and remote communication
- Benefits: Low latency, built-in security, automatic cleanup
- Decision: Implement Model Context Protocol for LLM integration
- Rationale: Standard protocol for AI tool integration, vendor-agnostic
- Benefits: Compatible with multiple LLM providers, structured tool definitions
- Decision: Implement logging to both WinDbg UI and DebugView
- Rationale: Different audiences need different logging levels
- Benefits: User-friendly output in WinDbg, detailed debugging in DebugView
- Decision: Implement connection pooling for named pipe communication
- Rationale: Avoid connection overhead for frequent commands
- Benefits: Improved performance, better resource utilization
- Decision: Categorized exception framework with severity levels
- Rationale: Different error types require different handling strategies
- Benefits: Better debugging, graceful degradation, user-friendly error messages
- Decision: Separate concerns between extension and MCP server
- Rationale: Different technologies, different responsibilities
- Benefits: Easier maintenance, independent development, better testing
VibeDbg represents a modern approach to Windows debugging by combining the power of traditional WinDbg with the intelligence of AI assistance. The architecture is designed for reliability, performance, and extensibility, providing a solid foundation for future enhancements while maintaining compatibility with existing debugging workflows.
The modular design allows for independent development of components while the robust communication layer ensures reliable operation. The comprehensive error handling and logging systems provide excellent debugging capabilities for the debugger itself, making development and troubleshooting straightforward.
This design document serves as a reference for understanding the system architecture and can be used to guide future development efforts.