如何在Ruby 2.0中使用调试器?

[英]How to use the debugger with Ruby 2.0?


I know the debugger gem is not and never will be compatible with ruby 2.0 per "officially support ruby 2.X".

我知道调试器gem不是,并且永远不会与ruby 2.0兼容,每个“官方支持ruby 2.X”。

In the changelog of Ruby 2.0 is:

在Ruby 2.0的更新日志中是:

Debug support

调试支持

DTrace support, which enables run-time diagnosis in

DTrace支持,支持运行时诊断

production TracePoint, which is an improved tracing API

生产TracePoint,它是一种改进的跟踪API

Is there something out of the box for debugging with Ruby 2.0? Can somebody explain this to me?

是否有开箱即用的东西用于调试Ruby 2.0?有人可以向我解释一下吗?

3 个解决方案

#1


55  

The debugger gem can be used but it still has issues.

可以使用调试器gem,但它仍然存在问题。

Install byebug which was written for Ruby 2.0 debugging.

安装为Ruby 2.0调试编写的byebug。

For breakpoints, use the byebug command in your code instead of debugger.

对于断点,请在代码中使用byebug命令而不是调试器。

#2


7  

Version 1.4.0 of the debugger gem now installs without problems. There are still some issues but this should be fixed soon.

调试器gem的1.4.0版现在安装没有问题。仍有一些问题,但应尽快修复。

The debugger gem does not play well with Ruby 2. Instead, install the Byebug gem that is fully compatible with Ruby 2.

调试器gem与Ruby 2不兼容。相反,安装与Ruby 2完全兼容的Byebug gem。

#3


0  

Use pry:

使用撬:

gem install pry  
gem install pry-debugger

See "Debugging Ruby With Pry".

请参阅“使用Pry调试Ruby”。

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2013/03/04/7697fa1e4bed50c809f4d1b7df39be15.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告