views:

2753

answers:

8

What do you guys use for debugging in ruby 1.9? rdebug doesn't seem to be compatible.. is there anything out there?

+1  A: 

Some things you could try

1) run it with ruby’s normal debugger -rdebug [1] kind of slow

2) run it with unroller gem [kind of stinks, way slow]

3) use a lot of print statements fast, kind of less introspection possible

4) drop to an irb prompt and run some code from there.

you could list the code by creating your own “drop to irb prompt” that listed the code around itself [use caller to discover where you where] then drop to a normal irb prompt.

5) maybe jruby in 1.9 compat mode has a debugger?

[1] http://beaver.net/rdebug/index-0.html

VP
+1  A: 

Netbeans is a good IDE for RoR. Good debugger too.

Zepplock
Correct me if I'm wrong, but I don't believe the debugger works for Ruby 1.9.1 (C implementation) yet. At least, I have not been successful in getting it to work.
JP
@JP: I use NetBeans 6.7 and debug works for Ruby 1.9.1.
JRL
+12  A: 

ruby-debug is now available with Ruby 1.9.x. See http://www.github.com/mark-moseley

Mark Moseley
Does this mean that ruby-debug-ide will now work?
JP
I made a cursory attempt and it didn't work. Need some more time to look at this.
Mark Moseley
ruby-debug-ide is working now - you can get the new gem at http://cloud.github.com/downloads/mark-moseley/ruby-debug/ruby-debug-ide-0.4.7.gem
Mark Moseley
This is GREAT news! Thank you!
andi
A: 

The ruby 1.9.1-p243 version is out and compitable ruby-debug-ide is also working properly. Install ruby-debug-ide using the following command:

gem install ruby-debug-ide

This will install the ruby-debug-base19 and ruby-debug-ide gems. But before this make sure you install the mingw successfully by following the Development kit docs available from RubyForge.

A: 

Latest features are available in ruby-debug-ide19 gem.

Mark Moseley
+7  A: 

Just an add on about this with rvm, ruby 1.9.1-p378. True story is that even if ruby-debug is 1.9.x ready, linecache-0.43 is not. The solution is to install:

gem install ruby-debug19

This solves the problem for me.

tommasop
Thanks, to me that was the more appropriate answer. But maybe this is because you replied almost a year later and things changed for good in that regard.
mark
+3  A: 

If you still have a problem after installing ruby-debug19 try updating ruby-debug-base19. I had errors and couldn't run WEBrick in debug mode until I did that.

gem update ruby-debug-base19

Oh, and thanks Mr. Moseley for all your hard work!

Mike Bethany
A: 

What about stand alone passenger? Have anyone succeeded in running passenger 3.0 (standalone) with ruby-debug(19) and ruby1.9?

I get this error message: "Your version of ruby-debug is too old. Please upgrade to the latest version."

And this is because of this code in passenger / utils.rb:

if !Debugger.respond_to?(:ctrl_port)
  raise "Your version of ruby-debug is too old. Please upgrade to the latest version."
end

Any ideas how this could be solved?

p.s. it works with WEBrick

Stanislav