Skip to content

Develop a PicoRuby debugger with remote debugging and OpenOCD integration #115

@yuuu

Description

@yuuu

Summary

Develop a debugger for PicoRuby (mruby VM) on R2P2-ESP32, comparable to mruby-bin-debugger, but with the following additional goals:

  1. Remote debugging between a host PC and the device.
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions