Ruby Debug 0101 Broken on Windows
Since the old rails breakpointer quit working in versions of Ruby after 1.8.4, the preferred method for debugging rails has been to use ruby-debug. This is a separate gem, so to install you just do
gem install ruby-debug
However, the current version of ruby-debug (0.10.1) runs into problems on Windows, namely it doesn’t work and spews out an error message when you try to run it directly:
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- c:/ruby/
lib/ruby/gems/1.8/gems/linecache-0.42-x86-mswin32/lib/../ext/trace_nums (LoadError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/linecache-0.42-x86-mswin32/lib/tracelines.rb:8
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/linecache-0.42-x86-mswin32/lib/linecache.rb:63
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.1-mswin32/lib/ruby-debug-base.rb:3
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-0.10.1/cli/ruby-debug.rb:5
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/ruby-debug-0.10.1/bin/rdebug:7
from c:/ruby/bin/rdebug:19:in `load'
from c:/ruby/bin/rdebug:19
I’ve found two possible ways to fix this. The first is simply to revert back to ruby-debug version 0.10.0
gem uninstall ruby-debug
gem install ruby-debug --version "=0.10.0"
The other way to fix the problem I found on a ticket in Rails Trac
In the file ruby\lib\ruby\gems\1.8\gems\linecache-0.42-x86-mswin32\lib\tracelines.rb I changed the line from
require File.join(@@SRCDIR, '..', 'ext', 'tracenums')
to
require File.join(@@SRC_DIR, '..', 'ext', 'extconf.rb')
I suppose the advantage to this method is that you have the newer version of ruby-debug with all it’s fixes, although I don’t really know what those are.