How microsoft/debugpy works
Main Components
a. Core Components:
• Debug Adapter (src/debugpy/adapter/)
• Launcher (src/debugpy/launcher/)
• Server (src/debugpy/server/)
• Common Utilities (src/debugpy/common/)
b. External Interfaces:
• DAP Client (e.g., VS Code)
• Python Debuggee (Target Application)
• Debug Adapter Protocol
Component Relationships
Top Layer: Client Interface
Middle Layer: Debug Adapter Components
Bottom Layer: Target Python Application
Specific Elements
a. Client Layer:
• Protocol connection lines showing JSON communication
b. Debug Adapter Layer:
• Adapter Component (handles DAP communication)
• Server Component (manages debugging sessions)
• Launcher Component (controls debuggee process)
• PyDevd Integration (vendored debugging engine)
c. Target Layer:
• Python Application
• Subprocess handling
• Remote debugging support
Flow Directions
• Client ↔ Debug Adapter (DAP protocol)
• Debug Adapter ↔ Server (internal communication)
• Server ↔ Python Application (debugging operations)
Important Features to Highlight
• Remote debugging capability
• Subprocess debugging
• Multiple client support
• Breakpoint handling
• Variable inspection
• Step debugging
Additional Details
Notes for:
• Port configuration (default 5678)
• Support for different Python versions
• Integration with PyDevd
• Cross-platform compatibility
Attach mode (debugpy connects to running process)
This architecture should reflect debugpy's ability to handle both local and remote debugging scenarios, while maintaining a clean separation of concerns between protocol handling and debugging implementation.