How to configure debugger with Ruby 1.9.3-p125

Hi,

I'm trying to use debugger with rspec with following version of software:
  rails 3.2.1
  rvm (stable 1.10.2)
  ruby 1.9.3-p125
  MacOS X 10.7.3, Xcode 4.3

Now, I figured out a configuration to run "rails console --debugger" with information I've gotten from:
  http://stackoverflow.com/questions/6438116/rails-with-ruby-debugger-throw-symbol-not-found-ruby-current-thread-loaderro
  (I used answer refer to this gist: https://gist.github.com/1331533 )

I set a break point, and run rspec.
Unfortunately, with this configuration, rspec stop with error.

/Users/shigeya/.rvm/rubies/ruby-1.9.3-p125/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) "/Applications/RubyMine 4.0.1.app/rb/testing/runner/specs_in_folder_runner.rb"
Testing started at 15:06 ...
/Users/shigeya/.rvm/rubies/ruby-1.9.3-p125/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/gems/ruby-debug-ide-0.4.17.beta8/bin/rdebug-ide --port 61575 -- /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/bin/rspec --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter
<< source paths here >>
Fast Debugger (ruby-debug-ide 0.4.17.beta8, ruby-debug-base 0.11.30.pre10) listens on 127.0.0.1:61575
Work directory: /Users/shigeya/work/aimm3/}
Searching files....
=========================================
<< rspec sources here..>>
47 files were found.
=========================================
RSpec script : /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/bin/rspec
Spec Options:
[]
=========================================
Running specs...
Command line:
["/Users/shigeya/.rvm/rubies/ruby-1.9.3-p125/bin/ruby", "-e", "at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)", "/Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/gems/ruby-debug-ide-0.4.17.beta8/bin/rdebug-ide", "--port", "61575", "--", "/Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/bin/rspec", "--require", "teamcity/spec/runner/formatter/teamcity/formatter", "--format", "Spec::Runner::Formatter::TeamcityFormatter",
<< SPEC PATHS >> ]
dyld: lazy symbol binding failed: Symbol not found: _rb_vm_get_sourceline
  Referenced from: /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/gems/ruby-debug-base19x-0.11.30.pre10/lib/ruby_debug.bundle
  Expected in: flat namespace
dyld: Symbol not found: _rb_vm_get_sourceline
  Referenced from: /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/gems/ruby-debug-base19x-0.11.30.pre10/lib/ruby_debug.bundle
  Expected in: flat namespace
/Users/shigeya/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner': Command failed with status (): [/Users/shigeya/.rvm/rubies/ruby-1.9.3-p125...] (RuntimeError)
     from /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
     from /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
     from /Users/shigeya/.rvm/gems/ruby-1.9.3-p125@global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
     from /Applications/RubyMine 4.0.1.app/rb/testing/runner/specs_in_folder_runner.rb:139:in `<top (required)>'
     from -e:1:in `load'
     from -e:1:in `<main>'
Process finished with exit code 1


How I can make Rubymine happy?

Current Gemfile is here: https://gist.github.com/1955987

0
16 comments
Avatar
Permanently deleted user

Forgot to mention. I'm using Rubymine 4.0.1

0

It looks like your problem is caused by XCode 4.3. Please see rvm requirements output:

Xcode 4.2:
* is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
* it breaks gems with native extensions, especially DB drivers.

0
Avatar
Permanently deleted user

I haven't realized that. Will try to find workaround.

thank you.

0

For me even XCode 4.2 worked ok, but 4.3 doesn't :(

0
Avatar
Permanently deleted user

rvm requirements mentioned about osx-gcc-installer, so I tried it but no luck buidling Ruby 1.9.3-p125
(fails during building ruby itself.)

Installing Xcode 4.2.1 and trying..
at least, clang for Xcode 4.2.1 don't build Ruby 1.9.3-p125.
Thus, I have to set CC=gcc-4.2 before build anything..

At this moment, I don't progaram on iOS so no problem, but I need latest Xcode sometime in future.
So, I hope to have Xcode 4.3.x (or something new) to resolve this..

0
Avatar
Permanently deleted user

Looks like debug extension seems to be OK with Xcode 4.2.1.
I still have issues to be resolved but it's looks like ruby language level or configuration issue.
thanks.

0
Avatar
Permanently deleted user

It's working fine with Rails development environment.

Isn't it possible to debug in RSpec run?

0

Here's the corresponding issue is Ruby bugtracker. You may also want to check this guide on setting up XCode 4.3 to work with 1.9.3. I won't be able to check it until tomorrow, but it looks ok.

0

Yes, it is possible to debug rspec, but you should remove any references to CLI debug gem from your gemfile, because IDE debugger won't stop on breakpoints otherwise

0
Avatar
Permanently deleted user

Thanks for info. that's looks like exactly what happend to me.

Since I'm away from office/home for four days, I'll try that later this week.

Thanks!

0
Avatar
Permanently deleted user

Two quesitons... if possible.

1. I need to change require 'XXX' to require_relative '../../XXX' -- why this happen?
2. I'm using log4r for logging, and when starting rspec, I've gotten

/Users/shigeya/.rvm/gems/ruby-1.9.3-p125@aimm3/gems/log4r-1.1.10/lib/log4r/outputter/fileoutputter.rb:37:in `initialize': 'log' is not writable! (StandardError)
 from /Users/shigeya/Documents/work/aimm3/config/application.rb:84:in `new'


at application.rb:84:

        when "test"
          err_out = Log4r::FileOutputter.new("file", :filename=>"log/xxtest.log", :formatter=>formatter, :trunc=>false)
          err_out.only_at INFO, WARN, ERROR, FATAL
          err_log = Logger.new("AIMM3-XXCONSOLE")
          err_log.add(err_out)
          debug_out = Log4r::FileOutputter.new("file", :filename=>"log/debug-test.log", :formatter=>formatter, :trunc=>false)
          debug_out.only_at INFO, WARN, ERROR, FATAL, DEBUG
          debug_log = Logger.new("AIMM3-DEBUG")
          debug_log.add(debug_out)


It is just working fine other than rspec with debug enabled.

Any idea why this is happening?

The Log: https://gist.github.com/1982761

Current Gemfile: https://gist.github.com/1982768
0
Avatar
Permanently deleted user

Found the reason. I have no idea but working directory configuraiton was empty, cause log directory point to nowhere.

Now working fine. thanks!

0
Avatar
Permanently deleted user

Tried with latest Xcode with dynamic loader to Ruby fixed the issue.
# Xcode 4.3.1 (Apple clang version 3.1 (tags/Apple/clang-318.0.54) -- not gcc)

I added a patch to RVM repository, and sent pull request for that.

So, finally, I can debug on RubyMine with latest env. thank you

0
Avatar
Permanently deleted user

Would you be able to provide a little more detail on how you fixed the problem? I tried the Homebrew guide above with no luck. I have rvm 1.9.3-head selected and I tried installing ruby-debug-base19x by executing:

sudo gem install ruby-debug-base19x -- --with-ruby-include=/Users/USERNAME/.rvm/src/ruby-1.9.3-head/

but I still get:

make
compiling breakpoint.c
compiling ruby_debug.c
ruby_debug.c:24: error: conflicting types for ‘rb_iseq_compile_with_option’
/Users/USERNAME/.rvm/src/ruby-1.9.3-head/vm_core.h:505: error: previous declaration of ‘rb_iseq_compile_with_option’ was here
ruby_debug.c: In function ‘call_at_line_unprotected’:



Any ideas?
0
Avatar
Permanently deleted user

Please check my answer in this stackoverflow article: http://stackoverflow.com/questions/9651670/issue-updating-ruby-on-mac-with-xcode-4-3-1/9651747

WIth this setup, RubyMine will install debug related modules byitself. Working flowlessly.

My current Gemfile is like this: https://gist.github.com/2036163

I'm using RubyMine 4.0.2

0
Avatar
Permanently deleted user

Looks to be working. Thank you!

0

Please sign in to leave a comment.