2 ms·
You can do all this in any decent scripting language too. In ruby: require 'rubygems' require 'ruby-debug' Debugger.start Signal.trap('INT') {
by JonnieCache 16y ago
You can do all this in any decent scripting language too. In ruby:
require 'rubygems'
require 'ruby-debug'
Debugger.start
Signal.trap('INT') { debugger } # this line makes the debugger run when you hit ctrl-c
# YOUR CODE HERE INSTEAD!
loop {}
Simply hit ctrl-C (sometimes twice) when your code is hung or whatever and then issue the `where` command to rdb. Just make sure you have the ruby-debug gem installed.
It's actually easier, as you obviously don't have to worry about debugging symbols. You can also attach rdb to running interpreter processes and all that good stuff.
http://bashdb.sourceforge.net/ruby-debug.html http://bashdb.sourceforge.net/ruby-debug.html
EDIT: I've just realised that this will obviously only catch bugs in ruby code. For bugs in the ruby interpreter itself, like the php bug under discussion, you will need to use gdb on the interpreter binary like jrockway showed. Still the point is that you shouldn't consider this stuff over your head just because you only hack dynamic languages :)