Ruby-Debug With Ruby 1.9.3

ruby-debug with Ruby 1.9.3?

Update (April 28, 2012)

Try the new debugger gem as a replacement for ruby-debug.

(credit to @ryanb)


Update (March 2, 2012)

Installation of linecache19 and ruby-debug-base19 can be easily done with:

bash < <(curl -L https://raw.github.com/gist/1333785)

(credit to @fredostarr)


Original answer

Have you looked at ruby-debug19 on ruby-1.9.3-preview1?

Here's a temporary solution:
http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug

Excerpt from the site:

First download linecache19-0.5.13.gem and
ruby-debug-base19-0.11.26.gem from
http://rubyforge.org/frs/?group_id=8883, then …

$ gem install linecache19-0.5.13.gem 
Building native extensions. This could take a while...
Successfully installed linecache19-0.5.13
1 gem installed
$ gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/Users/santiago/.rbenv/source/ruby-1.9.3-p0
Building native extensions. This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
$ irb
irb(main):001:0> require 'ruby-debug'
=> true

how do I install ruby-debug in ruby 1.9.3 / Rails 3.2.1

Thanks to @Marc Talbot's comment in the OP, I found a working recipe.

download linecache19 and ruby-debug-base19 from RubyForge:

% curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
% curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem

compile the two gems

% gem install linecache19-0.5.13.gem
Building native extensions. This could take a while...
Successfully installed linecache19-0.5.13
1 gem installed
...
% gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0
Building native extensions. This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
...

update your Gemfile

# file: Gemfile
...
group :development do
gem 'linecache19', '0.5.13'
gem 'ruby-debug-base19', '0.11.26'
gem 'ruby-debug19', :require => 'ruby-debug'
end

bundle install and test the debugger

% bundle install
Fetching source index for http://rubygems.org/
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
% irb
irb(main):001:0> require 'ruby-debug'
=> true
irb(main):002:0> debugger
$SANDBOX/usr/lib/ruby/1.9.1/irb/context.rb:166
@last_value = value
(rdb:1) p 'hooray'
"hooray"

Hopefully this will help others.

rails4 debugging breakpoints with ruby 1.9.3?

Use debugger. In general, do this

ruby-debug - for ruby 1.8
debugger - for ruby 1.9
byebug - for ruby 2.0

and things should be fine.

Using ruby-debug with rails 3.1.1 and ruby 1.9.3

Just put the line gem 'ruby-debug19', :require => 'ruby-debug' in your Gemfile should do. Then run bundle install

Unable to debug in RubyMine 4.5 using Ruby 1.9.3

UPDATE: RubyMine 6+ supports debugger gem.

Make sure to remove gem 'debugger' from your Gemfile, it's a known conflict that will break debugging from RubyMine. You need only 2 gems related to debugger, exactly as stated in my another answer linked in your question.

After removing the gem you need to ensure it's not referenced anywhere in the project. In this particular case r_spec_runner.rb had require 'ruby-debug' statement causing cannot load such file -- ruby-debug error when trying to run rails console.

Trying to use a debugger in rails 3 - ruby 1.9.3 [Refactoring]

If you want something flexible with the option of setting breakpoints and navigating through code I can recommend pry-debugger. If you want something with glitter and magic jazz_hands is the gem you are looking for.

Debug Not Working After Upgrade To Ruby 1.9.3 And Rails 3.2.2

I found the solution here.



Related Topics



Leave a reply



Submit