Running arbitrary scripts

Useful for running small changes that you want to run with your miniruby or whatever, without having to write an actual test. This is also tied into the debuggers and stuff.

Make sure that a test.rb file exists inside your ruby checkout directory and then after you’ve build.

Running code inside a debugger

You can run your test.rb with inside lldb. This will dump you inside an lldb repl. If you want to integrate this with the VSCode debugger see [setting-up-vscode-for-mri].

make lldb
make lldb-ruby

Running a specific test and attaching lldb

You can add RUNRUBYOPT to any test run command (see [running-tests]). An example:

make test-all TESTS='test/ruby/test_gc_compact.rb -n test_complex_hash_keys' RUNRUBYOPT=--debugger=lldb

Then when you get the lldb prompt type process launch or run to start debugging

also see [lldb-tips] and [ruby-inspecting-structs-lldb] for information about how to use lldb effectively in CRuby