Summary
Develop a debugger for PicoRuby (mruby VM) on R2P2-ESP32, comparable to mruby-bin-debugger, but with the following additional goals:
- Remote debugging between a host PC and the device.
- Seamless switching to C-level debugging via OpenOCD, so a developer can step from a Ruby frame down into the underlying C frame and back.
Goals
- Set/clear breakpoints, single-step, inspect variables, take backtraces, and evaluate expressions in PicoRuby code running on R2P2-ESP32.
- Allow a developer to investigate a problem at the Ruby level and, when needed, drop down into C source without leaving the same debugging workflow.
- Support DAP (Debug Adapter Protocol) so that mainstream editors (VS Code, etc.) can be used as the front end.
Proposed architecture
Transports
- Ruby-side (PicoRuby <-> host): serial as the primary transport. TCP over Wi-Fi is an attractive alternative on ESP32 and may be added later; an internal transport abstraction would make this easier.
- C-side (host <-> device): JTAG to the device, OpenOCD on the host, TCP between OpenOCD's gdbserver and the host-side debug adapter.
Host-side adapter
A host-side DAP adapter/proxy that:
- Talks to PicoRuby over serial (Ruby debug protocol).
- Talks to OpenOCD over TCP (gdb remote protocol) for C debug.
- Exposes a single DAP endpoint (or a VS Code "compound" configuration) so the editor can step across Ruby and C frames.
Open questions
- Should the Ruby-side debug protocol be a custom one tailored to PicoRuby, or should the device implement DAP directly? (A custom on-device protocol with DAP translation on the host is likely simpler and lighter for the MCU.)
- How to multiplex the existing serial console with the debug channel (separate USB CDC endpoint, in-band escape, or a dedicated UART)?
- Scope of debugger features beyond the basics (watch expressions, conditional breakpoints, etc.) - to be decided.
Non-goals (for the initial milestone)
- Profiling / tracing tools.
- Production / over-the-air debugging.
References
Summary
Develop a debugger for PicoRuby (mruby VM) on R2P2-ESP32, comparable to mruby-bin-debugger, but with the following additional goals:
Goals
Proposed architecture
Transports
Host-side adapter
A host-side DAP adapter/proxy that:
Open questions
Non-goals (for the initial milestone)
References