IntelliJ IDEA 12不会在rails / ruby​​中的断点处停止

时间:2023-01-18 09:08:32

I have IDEA 12 and cannot properly use debugger in Rails/Ruby [a similar question is this one Idea 11 breakpoints & ruby]. When I pressed DEBUG the first time on a rails/ruby app it correctly installed the ruby-debug-base19x and ruby-debug-ide. Issuing a gem list | grep debug shows these gems:

我有IDEA 12并且无法在Rails / Ruby中正确使用调试器[类似的问题是这一个Idea 11断点和ruby]。当我第一次在rails / ruby​​应用程序上按下DEBUG时,它正确安装了ruby-debug-base19x和ruby-debug-ide。发行宝石清单| grep debug显示这些宝石:

debugger-ruby_core_source (1.2.2)
ruby-debug-base19x (0.11.30.pre12)
ruby-debug-ide (0.4.17.beta16)

The debug [local debug] is starting successfully and I have this in the console:

debug [本地调试]正在成功启动,我在控制台中有这个:

/home/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/user/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug-ide-0.4.17.beta16/bin/rdebug-ide --port 55940 --dispatcher-port 37293 -- /home/user/work/IdeaProjects/rails/xtrade/script/rails server -b 0.0.0.0 -p 3000 -e development
Fast Debugger (ruby-debug-ide 0.4.17.beta16, ruby-debug-base19x 0.11.30.pre12) listens on 127.0.0.1:55940
=> Booting WEBrick
=> Rails 3.2.11 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-06-26 20:53:32] INFO  WEBrick 1.3.1
[2013-06-26 20:53:32] INFO  ruby 1.9.3 (2012-04-20) [x86_64-linux]
[2013-06-26 20:53:32] INFO  WEBrick::HTTPServer#start: pid=32688 port=3000

The only thing is that the breakpoints are never hit. I tried to put breakpoints in Controllers and Views but nothing changed. I tried plenty of times to install uninstall gems but I never managed to have the debugger working in Rails/Ruby. Tried also with the remote debugging but nothing as well.

唯一的问题是断点永远不会被击中。我试图在控制器和视图中放置断点,但没有任何改变。我尝试了很多次来安装卸载宝石,但我从未设法让调试器在Rails / Ruby中运行。尝试了远程调试,但也没有。

2 个解决方案

#1


2  

The problems was due a usage of a symlink in the project structure [see also this Symlinks confuse debugger for related issue happening in the debugger in Rubymine]

问题是由于在项目结构中使用了符号链接[另请参阅此符号链接将调试器中的相关问题混淆为Rubymine中的调试器]

By removing the symlink and using the full path to the files, it fixed the debugger and now Idea12 is stopping correctly in Ruby / Rails code.

通过删除符号链接并使用文件的完整路径,它修复了调试器,现在Idea12在Ruby / Rails代码中正确停止。

#2


-3  

I'm not sure about debuggers you're using, but I've got a solution for you. Try using pry. Add it to your Gemfile and then put binding.pry in the place you want to make a breakpoint.

我不确定你正在使用的调试器,但我已经为你找到了解决方案。尝试使用撬。将它添加到Gemfile中,然后将binding.pry放在要创建断点的位置。

#1


2  

The problems was due a usage of a symlink in the project structure [see also this Symlinks confuse debugger for related issue happening in the debugger in Rubymine]

问题是由于在项目结构中使用了符号链接[另请参阅此符号链接将调试器中的相关问题混淆为Rubymine中的调试器]

By removing the symlink and using the full path to the files, it fixed the debugger and now Idea12 is stopping correctly in Ruby / Rails code.

通过删除符号链接并使用文件的完整路径,它修复了调试器,现在Idea12在Ruby / Rails代码中正确停止。

#2


-3  

I'm not sure about debuggers you're using, but I've got a solution for you. Try using pry. Add it to your Gemfile and then put binding.pry in the place you want to make a breakpoint.

我不确定你正在使用的调试器,但我已经为你找到了解决方案。尝试使用撬。将它添加到Gemfile中,然后将binding.pry放在要创建断点的位置。