Wykres commitów

2 Commity (b376e745f90c43dfc046b4560f0230ce5420d0d0)

Autor SHA1 Wiadomość Data
Andrew Leech 5d491e0227 debugpy: Fix VS Code path mapping to prevent read-only file copies.
When breakpoints are hit, VS Code was opening read-only copies of source
files instead of the original workspace files due to path mismatches between
VS Code's absolute paths and MicroPython's runtime paths.

Changes:
- Add path mapping dictionary to track VS Code path <-> runtime path relationships
- Enhance breakpoint matching to handle relative paths and basename matches
- Update stack trace reporting to use mapped VS Code paths
- Add debug logging for path mapping diagnostics
- Fix VS Code launch configuration (debugpy -> python, enable logging)

This ensures VS Code correctly opens the original editable source files
when debugging, rather than creating read-only temporary copies.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2025-06-16 12:12:30 +10:00
Andrew Leech c98b355ef4 python-ecosys/debugpy: Add VS Code debugging support for MicroPython.
This implementation provides a Debug Adapter Protocol (DAP) server that enables
VS Code to debug MicroPython code with full breakpoint, stepping, and variable
inspection capabilities.

Features:
- Manual breakpoints via debugpy.breakpoint()
- Line breakpoints set from VS Code
- Stack trace inspection
- Variable scopes (locals/globals)
- Source code viewing
- Stepping (into/over/out)
- Non-blocking architecture for MicroPython's single-threaded environment
- Conditional debug logging based on VS Code's logToFile setting

Implementation highlights:
- Uses MicroPython's sys.settrace() for execution monitoring
- Handles path mapping between VS Code and MicroPython
- Efficient O(n) fibonacci demo (was O(2^n) recursive)
- Compatible with MicroPython's limited frame object attributes
- Comprehensive DAP protocol support

Files:
- debugpy/: Core debugging implementation
- test_vscode.py: VS Code integration test
- VSCODE_TESTING_GUIDE.md: Setup and usage instructions
- dap_monitor.py: Protocol debugging utility

Usage:
```python
import debugpy
debugpy.listen()          # Start debug server
debugpy.debug_this_thread()  # Enable tracing
debugpy.breakpoint()      # Manual breakpoint
```

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-11 15:09:40 +10:00