Debug support for mruby executables used with a native debugger.
mruby-debug installs an mruby code_fetch_hook. The hook records the current
mruby source filename and line and calls mrb_debug_breakpoint_function, which
provides a stable location for a native debugger breakpoint.
It also exposes helper functions used to inspect mruby execution state,
including local, global, and instance variables. These functions are consumed
by mruby-bin-dap-proxy
through a native debug adapter.
This gem is not a DAP client and does not start LLDB or another external debugger.
The hook is invoked from mruby's instruction fetch path. Enabling this gem adds work while Ruby code is executing, even when execution does not stop at a breakpoint. The effect is particularly visible in a large interactive program such as mrbmacs.
The target executable must include debug information and enable the mruby debug hook:
MRuby::Build.new do |conf|
conf.enable_debug
conf.cc.defines << 'MRB_ENABLE_DEBUG_HOOK'
conf.gem github: 'masahino/mruby-debug'
endThe gem itself also adds MRB_USE_DEBUG_HOOK to the build definitions.
MIT. See LICENSE.