Attach the process to a gdb session.
sudo gdb $(rbenv which ruby) $(pgrep thin)
Enter this on the gdb
prompt.
set $ary = (int)backtrace(-1)
set $count = *($ary+8)
set $index = 0
while $index < $count
x/1s *((int)rb_ary_entry($ary, $index)+12)
set $index = $index + 1
end
You will see the output at the console running the thin
command.
Taken from http://weblog.jamisbuck.org/2006/9/22/inspecting-a-live-ruby-process.html