Ruby debug: Difference between revisions

From wikinotes
 
No edit summary
 
Line 1: Line 1:
Builtin ruby module, that provides an interactive debugger.
Builtin ruby module, that provides an interactive debugger.


= Documentation =
<blockquote>
{| class="wikitable"
| cli commands || https://github.com/ruby/debug#debug-command-on-the-debug-console
|}
</blockquote><!-- documentation -->


= Usage =
= Usage =

Latest revision as of 15:22, 23 November 2023

Builtin ruby module, that provides an interactive debugger.


Documentation

cli commands https://github.com/ruby/debug#debug-command-on-the-debug-console

Usage

Run the ruby interpreter in debugger mode. Stops before first line is run, presents debugging prompt.

ruby -r debug yourmodule.rb

Commands

Very similar to gdb and pdb.
These commands are issued at the debugger prompt.

# standard commands
h[elp]       # print available commands
l[ist]       # list lines of code
c[ontinue]   # continue running normally (until next breakpoint)
s[tep]       # run next line (go inside function)
n[ext]       # run next line (skip inside function)

# new commands
w[here]      # print stacktrace
p <variable> # print variable value