使用 Ruby 1.9.3 进行 ruby 调试?
我刚刚更新到 Ruby 1.9.3p0 和 Rails 3.1.1。现在,当我尝试启动服务器时,它抱怨我应该安装 ruby-debug,即使它已经安装了。
% rails server --environment=development --debug
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting
在我的 Gemfile 中,我
# see: http://stackoverflow.com/questions/1083451/debugging-in-ruby-1-9
gem 'ruby-debug-base19', "0.11.24"
gem 'ruby-debug19', "0.11.6"
可以使用最新版本的 Ruby 运行调试吗?
I just updated to Ruby 1.9.3p0 and Rails 3.1.1. Now when I try to launch the server, it complains that I should install ruby-debug
, even though it's already installed.
% rails server --environment=development --debug
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting
In my Gemfile I have
# see: http://stackoverflow.com/questions/1083451/debugging-in-ruby-1-9
gem 'ruby-debug-base19', "0.11.24"
gem 'ruby-debug19', "0.11.6"
Is it possible to run debug with the latest version of Ruby?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
如果你没有rvm并且假设你的ruby安装在/usr/local/ruby-1.9.3-po中,你可以使用这个命令:
curl -L https://raw.github.com/gist/1533750 |须藤 /bin/bash
If you don't have rvm and assuming you ruby installation is in /usr/local/ruby-1.9.3-po your can use this command:
curl -L https://raw.github.com/gist/1533750 | sudo /bin/bash
您还需要检查 gem 'ruby_source_code' 是否已安装。
检查:http://bugs.ruby-lang.org/issues/1857#note -8
Also you need to check if the gem 'ruby_source_code' is already installed.
Check: http://bugs.ruby-lang.org/issues/1857#note-8
在这里查看我的答案:
Ruby-debug 无法工作 - Stack Overflow
它是关于让 Ruby 调试与以下设置
使用rvm,在我的项目工作目录中我有一个.rvmrc说明:
基本上,我必须使用:
请注意,我没有使用 ruby-debug-base19,而是使用 ruby-debug-base19x
我希望这有帮助!
——弗雷迪
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:
Basically, I had to use :
Note that I'm not using ruby-debug-base19 but ruby-debug-base19x
I hope this helps!
-- Freddy
顺便说一句,如果您使用 ruby1.9.3 的最新补丁(falcon,https://gist.github.com/1688857< /a>),使用以下命令
BTW, if you use the newest patch for ruby1.9.3 (falcon, https://gist.github.com/1688857), use following commands
对于 Windows 用户:
首先下载:linecache19-0.5.13.gem 和 ruby-debug-base19-0.11.26.gem
来自: http://rubyforge.org/frs/?group_id=8883&release_id= 46303
假设:Ruby在c:\Ruby1.93
把下载的gem文件放到c:\temp
(linecache19-0.5.13.gem 和 ruby-debug-base19-0.11.26.gem)
然后从命令行执行:
For Windows Users:
First Download :linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem
From : http://rubyforge.org/frs/?group_id=8883&release_id=46303
Assumption: Ruby is in c:\Ruby1.93
put the gem files downloaded to c:\temp
(linecache19-0.5.13.gem and ruby-debug-base19-0.11.26.gem)
then execute from command line:
也许不是这个问题的明确答案,但我是被一系列封闭的重复项引导到这里的。
对我来说,问题是我在 ruby 1.8 和 ruby 1.9 中运行一个项目,而我的 Gemfile 需要进行此更改:
现在它适用于这两种 ruby。
有关更多信息,请参见此处:http://gembundler.com/man/gemfile。 5.html#PLATFORMS-平台-
Maybe not the definitive answer to this question, but I was lead here by a chain of closed duplicates.
For me the problem was that I run a project in both ruby 1.8 and ruby 1.9, and my Gemfile needed this change:
Now it works for both rubies.
For more info see here: http://gembundler.com/man/gemfile.5.html#PLATFORMS-platforms-
其他人在评论中发帖尝试 Pry,这就是我所做的。这是 Rails 所必需的:
安装后我立即注意到我的
.irbrc
没有加载,所以我没有得到漂亮的控制台输出。我还将这个添加到我的 '~/.pryrc'Pry 有一些我想要检查的好功能,一旦有一种简单的方法将其集成到 Ruby 1.9 的 Rails 项目中,我可能还会返回 ruby-debug .3.我可以从其他答案中运行curl命令,但这是我必须向我的队友指出我们的Rails项目的东西,所以在我看来它不能很好地扩展。
Someone else posted in a comment to try Pry, which is what I did. This is what's necessary for Rails:
Immediately after installing I notice my
.irbrc
doesn't load, so I don't get pretty console output. I also added this to my '~/.pryrc'Pry has some nice features that I've wanted to check out, and I may yet return to ruby-debug once there's a simple way to integrate it into a Rails project for Ruby 1.9.3. I can run the curl command from the other answers, but this is something I'll have to point my teammates to for our Rails project, so it doesn't scale well IMO.
linecache19 和 ruby-debug-base19 的安装可以轻松完成:
Installation of linecache19 and ruby-debug-base19 can be easily done with:
更新(2012 年 4 月 28 日)
尝试使用新的 debugger gem 作为 ruby-debug 的替代品。
(感谢@ryanb)
更新(2012 年 3 月 2 日)
linecache19 和 ruby-debug-base19 的安装可以轻松完成:
(归功于@fredostarr)
原始答案
您看过ruby-debug19 上ruby-1.9.3-preview1?
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:
(credit to @fredostarr)
Original answer
Have you looked at ruby-debug19 on ruby-1.9.3-preview1?