Skip to content

Instantly share code, notes, and snippets.

@brendon9x
Created August 11, 2015 08:05
Show Gist options
  • Save brendon9x/642199f63dff297c749e to your computer and use it in GitHub Desktop.
Save brendon9x/642199f63dff297c749e to your computer and use it in GitHub Desktop.
Ruby stack dump
define redirect_stdout
call rb_eval_string("$_old_stdout, $stdout = $stdout, File.open('/tmp/ruby-debug.' + Process.pid.to_s, 'a'); $stdout.sync = true")
end
define ruby_eval
call(rb_p(rb_eval_string_protect($arg0,(int*)0)))
end
redirect_stdout
ruby_eval("Thread.list.each { |t| puts t.backtrace.join(%Q[\n]) }")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment