What do you guys use for debugging in ruby 1.9? rdebug doesn't seem to be compatible.. is there anything out there?
相关问题
- Pass custom debug information to Microsoft bot fra
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
- reference to a method?
- ruby 1.9 wrong file encoding on windows
相关文章
- Ruby using wrong version of openssl
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
- Segmentation fault with ruby 2.0.0p247 leading to
- How to detect if an element exists in Watir
- uninitialized constant Mysql2::Client::SECURE_CONN
- How do I get to see DbgPrint output from my kernel
See my answer here : Ruby-debug not working - Stack Overflow
It's about getting Ruby debugging to work with the following setup
Using rvm, in my project working directory I have a .rvmrc stating:
I hope this helps!
-- Freddy
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
UPDATE FOR RUBY 2.0+ and FOLLOWING
byebug is the currently recommended debugger for Ruby 2.0+
This issue has been documented here, and cldwalker, the author of debugger, notes that debugger will be scoped to Ruby 1.9.2 and 1.9.3.
UPDATE 2
It is true that ruby-debug is not actively maintained even if I can't find anywhere that is not maintained any longer.
You can use the new debugger gem if you need a help to start with the new gem you can see Ryan Bates rails cast.
In your Gemfile put:
You can then add a breakpoint anywhere in your code using the
debugger
keyword.YOU CAN STILL USE
linecache19 and ruby-debug-base19 with:
bash < <(curl -L https://raw.github.com/gist/1333785)
OLD ANSWERS
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:
This solves the problem for me.
OLD UPDATE
If you are having problems with ruby 1.9.2 and Rails 3 debugging putting:
In your Gemfile and doing a
Will make you a happy debugger again.
Note: this answer was correct but is now out of date. See the below correct answer. TL;DR: use 'debugger' now.
ruby-debug is now available with Ruby 1.9.x. See http://www.github.com/mark-moseley
To install (using gem on 1.9 Ruby installation):
(with perhaps the necessary 'sudo' in front of it).
ruby-debug19
is not maintained anymore. All the other answers are outdated.But there's an alternative:
debugger
to the rescue!Put this in your
Gemfile
:It just works. - And it is included in the rails Gemfile since 3.2.something to replace
ruby-debug19
. It has the exact same functionality and is actively maintained.Latest features are available in ruby-debug-ide19 gem.