Rails Debugger - Notes

Menu

Random notes about the debugger Gem in Ruby

Debug a Gem

rdbg -c -- ruby -Ilib exe/log_sense -i log.log -o output.html

Watch a Variable

How does a specific variable look like?

rdbg -c -- ruby -Ilib exe/log_sense -i log.log -o output.html
(rdbg) watch @data
(rdbg) continue

Attach a debugger

Start an application with the possibility of attaching a debugger:

rdbg -c --open --host localhost --port 1234 -- rails s

Then, any time you want to connect and start debugging, you can invoke

bundle exec rdbg --attach --port 1234

Connecting the debugger moves the control flow to the debugger; quitting the debugger moves the control to the application; a new instance of the debugger can be launched at any time.