Skip to content

Repository files navigation

mruby-debug

build

Debug support for mruby executables used with a native debugger.

Responsibility

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.

Performance

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.

Build requirements

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'
end

The gem itself also adds MRB_USE_DEBUG_HOOK to the build definitions.

License

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages