6

I am getting following error while remote debugging through RubyMine IDE.

$ bundle exec rdebug-ide --port 1234 -- script/rails server
Fast Debugger (ruby-debug-ide 0.4.9) listens on :1234
    /home/amit/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-ide19-0.4.12/lib/ruby-debug-ide.rb:123:in `debug_load'
    /home/amit/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-ide19-0.4.12/lib/ruby-debug-ide.rb:123:in `debug_program'
    /home/amit/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-ide19-0.4.12/bin/rdebug-ide:87:in `<top (required)>'
    /home/amit/.rvm/gems/ruby-1.9.3-p125/bin/rdebug-ide:19:in `load'
    /home/amit/.rvm/gems/ruby-1.9.3-p125/bin/rdebug-ide:19:in `<main>'
Uncaught exception: cannot load such file -- script/rails

I followed this link to install require gems for remote debug.

Here is Gemfile configuration for remote debug

#To Debug
  gem 'linecache19', '0.5.13', :path => "~/.rvm/gems/ruby-1.9.3-p125/gems/linecache19-0.5.13/"
  gem 'ruby-debug-base19', '0.11.26', :path => "~/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-base19-0.11.26/"
  gem 'ruby-debug19', :require => 'ruby-debug'
  gem 'ruby-debug-ide19'

The application is running with Ruby 1.9.3 and Rails 3.0.11.

Makoto
  • 96,408
  • 24
  • 164
  • 210
Amit Patel
  • 14,288
  • 17
  • 61
  • 100

2 Answers2

18

You are using some weird debug gems, only the following are needed:

  • ruby-debug-base19x
  • ruby-debug-ide

First, remove all the ruby-debug* gems, then install the required gems using the following commands:

gem install ruby-debug-base19x --pre
gem install ruby-debug-ide --pre

You should get the following (or newer) versions:

ruby-debug-base19x (0.11.30.pre10)
ruby-debug-ide (0.4.17.beta9)

Adjust your Gemfile to include only these two gems (except the app specific gems).

If you are getting linecache19 related errors, install it as follows:

curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
gem install linecache19-0.5.13.gem

@Anjan has contributed the complete Gemfile changes for debugging:

gem 'linecache19', '>= 0.5.13', :git => 'https://github.com/robmathews/linecache19-0.5.13.git'
gem 'ruby-debug-base19x', '>= 0.11.30.pre10'
gem 'ruby-debug-ide', '>= 0.4.17.beta14'

Don't forget to update the bundle.

CrazyCoder
  • 350,772
  • 137
  • 894
  • 800
  • Thanks a lot @CrazyCoder. It worked like a charm. Without `linecache19-0.5.13.gem` I got `undefined symbol: ruby_current_thread - /home/amit/.rvm/gems/ruby-1.9.3-p125@global/gems/linecache19-0.5.12/lib/trace_nums19.so (LoadError)` It is surprising as I had uninstalled `linecache19-0.5.12`. Anyway, I installed `linecache19-0.5.13.gem` by following your steps and error gone. – Amit Patel Apr 26 '12 at 05:28
  • @CrayzyCode, RubyMine Event Log window prompt to install missing plugin. Should I install with above Gemfile configuration? However without installing I could not find any issue so far while debugging. – Amit Patel Apr 26 '12 at 06:37
  • @AmitPatel, deleting `Gemfile.lock` and running `bundle install` should also help. – CrazyCoder Apr 26 '12 at 09:32
  • What does the --pre mean? I tried on any possible guide but I didn't find it – Edmondo1984 Jul 31 '12 at 13:15
  • It means pre-release version (beta, preXX, etc). – CrazyCoder Jul 31 '12 at 13:26
  • This is what I used in my Gemfile to install the required gems through bundler: `gem 'linecache19', '>= 0.5.13', :git => 'https://github.com/robmathews/linecache19-0.5.13.git'; gem 'ruby-debug-base19x', '>= 0.11.30.pre10'; gem 'ruby-debug-ide', '>= 0.4.17.beta14'` – Anjan Sep 04 '12 at 18:15
3

I already resolved this issue with help of @CrazyCoder by following all instructions he mentioned above in his answer.

I am answering here just to account what worked for me so might be useful to community.

Here is final entry of my Gem file

gem 'linecache19', '0.5.13', :path => "~/.rvm/gems/ruby-1.9.3-p125/gems/linecache19-0.5.13"
gem 'ruby-debug-base19x', '0.11.30.pre10'
gem 'ruby-debug-ide', '0.4.17.beta9'

Without :path for linecache19 I was getting following error.

You have requested:
  linecache19 = 0.5.13

The bundle currently has linecache19 locked at 0.5.12.
Try running `bundle update linecache19`
Community
  • 1
  • 1
Amit Patel
  • 14,288
  • 17
  • 61
  • 100