无法使用 Ruby 1.9.3 在 RubyMine 4.5 中进行调试 [英] Unable to debug in RubyMine 4.5 using Ruby 1.9.3

查看:53
本文介绍了无法使用 Ruby 1.9.3 在 RubyMine 4.5 中进行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于问题的长度我深表歉意,但我想明确表示我没有犯任何愚蠢的错误!

My apologies for the length of the question, but I want to make it clear I am not making any stupid mistakes!

因此,我正在努力使用 Ruby 1.9.3 在 RubyMine 4.5 中进行调试,我的步骤如下:

So, I am struggling to get debugging working in RubyMine 4.5 using Ruby 1.9.3, my steps are as follows:

全新(即已删除所有以前的 ruby​​ 和 gem 目录)安装 Ruby 1.9.3、Ruby Gems、DevKit 和 Rails(遵循 本指南) - 效果很好.

Fresh (i.e. having removed all previous ruby and gem directories) install of Ruby 1.9.3, Ruby Gems, DevKit and Rails (following this guide) - that works fine.

然后我尝试开始使用我团队的 ruby​​ 代码.我在 RubyMine 中打开目录(记住首先删除 .idea 目录)并提示我运行 bundle install ,我按要求执行(从控制台).这将成功完成.重新启动 RubyMine.

I then try to begin working with my team's ruby code. I open up the directory in RubyMine (remembering first to delete the .idea directory) and am prompted to run bundle install which I do (from console) as requested. This completes successfully. Restart RubyMine.

然后我确保 Ruby 正常工作:工具 > IRB 控制台 > puts "test" #test =>无 - 有效我现在尝试调试器 (SHIFT + F9) 并查看消息:

I then ensure Ruby is working: Tools > IRB Console > puts "test" #test => nil - Works I now try the debugger (SHIFT + F9) and see the message:

调试器需要的 gem ruby​​-debug-base19x 当前没有安装.您要安装它吗?"

我点击取消并检查我的 Gemfile,目前与调试相关的只有:

I click cancel and check my Gemfile, the only ones related to debugging present are:

# Debugging
gem 'debugger'
#gem 'ruby-debug-base19', :require => false
#gem 'ruby-debug19', :require => false
gem 'ruby-prof', :require => false #, :git => 'git://github.com/wycats/ruby-prof.git'

看起来我们有支持 ruby-debug 的调试器.阅读 here,但是,似乎 debugger 是不够.我需要安装 ruby-debug-base19x.因此,按照 SO, 我从 Gemfile 中注释掉调试器并运行

Looks like we have debugger in favour of ruby-debug. Reading here, however, it seems debugger is not sufficient. I need to install ruby-debug-base19x. So, following SO, I comment out debugger from Gemfile and run

gem install ruby-debug-base19x --pre
gem install ruby-debug-ide --pre

运行良好,所以我添加

gem 'ruby-debug-base19x', '0.11.30.pre10'
gem 'ruby-debug-ide', '0.4.17.beta14'

到我的 Gemfile,然后从控制台运行 bundle install.

to my Gemfile, and run a bundle install from the console.

最后,我在 RubyMine 中打开调试器(SHIFT + F9).并且 puts "test" #test =>nil 再次工作.所以我尝试双击我的脚本的装订线来创建一个断点,RubyMine 暂停一秒钟,然后我得到:

Finally, i open the debugger inside RubyMine (SHIFT + F9). And puts "test" #test => nil works again. So i try double clicking in the gutter of my script to create a breakpoint, RubyMine pauses for a second and then i get:

D:\Ruby\Ruby193\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/bin/rdebug-ide --dispatcher-port 55451 --port 55452 -- S:/code/account_groups/script/rails console
Fast Debugger (ruby-debug-ide 0.4.17.beta14, ruby-debug-base 0.11.30.pre10) listens on 127.0.0.1:55452
D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.1.4/lib/ruby_debug.so: warning: already initialized constant VERSION
5992: Exception in DebugThread loop: undefined method `errmsg' for #<Debugger::ControlState:0x2a2f3e8>
Backtrace:
D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.1.4/lib/ruby-debug/command.rb:160:in `errmsg'
  from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.1.4/lib/ruby-debug/commands/breakpoints.rb:81:in `execute'
  from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide/ide_processor.rb:89:in `block in process_commands'
  from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide/ide_processor.rb:86:in `catch'
  from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide/ide_processor.rb:86:in `process_commands'
  from: D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-debug-ide-0.4.17.beta14/lib/ruby-debug-ide.rb:160:in `block in start_control'

Process finished with exit code 0

我也尝试过使用代码的备份副本并按照相同的步骤进行操作,但在尝试加载调试器时也出现以下错误:

I have also tried using a backup copy of the code and following the same steps, i also get the following error when trying to load up the debugger:

Uncaught exception: cannot load such file -- ruby-debug
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    S:/code/account_groups_so/lib/systematic-online/r_spec_runner.rb:5:in `<top (required)>'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    S:/code/account_groups_so/config/environment.rb:12:in `block in <top (required)>'
    S:/code/account_groups_so/config/environment.rb:12:in `each'
    S:/code/account_groups_so/config/environment.rb:12:in `<top (required)>'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:103:in `require_environment!'
    D:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:40:in `<top (required)>'
    S:/code/account_groups_so/script/rails:6:in `require'
    S:/code/account_groups_so/script/rails:6:in `<top (required)>'

脚本没有任何问题(我之前用过它很好)并且跟踪似乎与 ruby-debug-ide 相关 - 发生了什么?

There is nothing wrong with the script (i have used it fine before) and the trace seems related to ruby-debug-ide - what's going on?

感谢您的帮助 - 这让我很生气!

Thanks for any help - this is driving me mad!

推荐答案

UPDATE:RubyMine 6+ 支持调试器 gem.

UPDATE: RubyMine 6+ supports debugger gem.

确保从您的 Gemfile 中删除 gem 'debugger',这是一个已知的冲突,会破坏 RubyMine 的调试.您只需要 2 个与调试器相关的 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.

删除 gem 后,您需要确保它没有在项目中的任何地方被引用.在这种特殊情况下,r_spec_runner.rbrequire 'ruby-debug' 语句导致 cannot load such file -- ruby​​-debug 尝试时出错运行 rails 控制台.

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.

这篇关于无法使用 Ruby 1.9.3 在 RubyMine 4.5 中进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆