标签: ruby-debug

如何为当前请求停止Rails调试器

假设我的代码中有一个循环调用rails调试器几次

def show
    animals = ['dog', 'cat', 'owl', 'tiger']
    for animal in animals
    debugger
    # do something else
end
Run Code Online (Sandbox Code Playgroud)

假设我使用该--debugger选项启动了我的服务器,当查看此页面时,调试器将在每次循环运行时停止.

我可以在cont每次停止时输入,因此请求仍在继续,但这很乏味,特别是如果我们不是在谈论它在这个示例中显示4次​​,而是400.有没有办法让调试器继续而不会暂停循环点?

我目前的解决方法是重新启动服务器,但这很耗时.

ruby debugging ruby-on-rails ruby-debug ruby-on-rails-3

15
推荐指数
3
解决办法
5136
查看次数

ruby_threadptr_data_type错误

我正在使用最新版本的rails(3.1.3)启动一个新的rails应用程序.当我尝试启动服务器时Rails崩溃.首先我修复了这个bug,现在我得到了这个

ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_threadptr_data_type 
Run Code Online (Sandbox Code Playgroud)

有一个关于这个事情的讨论在这里,但我不能让见识够了,把事情的工作.

UPDATE

我更新了ruby-debug的版本

gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
Run Code Online (Sandbox Code Playgroud)

现在又转向了这个错误

linecache19-0.5.12/lib/trace_nums19.so: undefined symbol: ruby_current_thread
Run Code Online (Sandbox Code Playgroud)

ruby-debug ruby-on-rails-3 ruby-1.9.3

15
推荐指数
1
解决办法
4661
查看次数

ruby-debug不会安装/构建本机扩展

我已经搜索了高低的解决方案.我有两个linecache19ruby_core_source安装.

这些命令都不起作用:

gem install ruby-debug19
gem install ruby-debug19 -- --with-ruby-include=/Users/benjohnson/.rvm/src/ruby-1.9.1-p378
Run Code Online (Sandbox Code Playgroud)

这是我一直得到的错误:

Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug19:
 ERROR: Failed to build gem native extension.

/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/bin/ruby extconf.rb
checking for rb_method_entry_t.body in method.h... no
checking for vm_core.h... no
checking for rb_method_entry_t.body in method.h... no
checking for vm_core.h... yes
checking for iseq.h... yes
checking for insns.inc... yes
checking for insns_info.inc... yes
checking for eval_intern.h... yes
creating Makefile

make
gcc -I. -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/i386-darwin10.4.0 -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/ruby/backward -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1 …
Run Code Online (Sandbox Code Playgroud)

ruby-debug

14
推荐指数
1
解决办法
9308
查看次数

如何在ruby 1.9.3/Rails 3.2.1中安装ruby-debug

可能重复:
Rails 3.1和Ruby 1.9.3p125:ruby-debug19仍然崩溃"未找到符号:_ruby_threadptr_data_type"

我已完成打印到控制台 - 我想升级到20世纪并开始使用调试器!但是如何安装ruby-debug?ruby-debug.c当我尝试安装ruby-debug19 gem时,本机编译失败.我查看了其他SO帖子,还没有找到答案......

  • 我使用的是Ruby 1.9.3-p0
  • 我正在使用Rails 3.2(当然还有Gemfile)
  • 我没有使用RVM - 相反,我有一个完整的沙盒目录,包含所有可执行文件,宝石,来源等.我将它称为$ SANDBOX下面的...

捆绑安装不起作用

如果我将ruby-debug19添加到我的Gemfile并执行bundle install,则在构建过程中失败conflicting types for 'rb_iseq_compile_with_option':

# file: Gemfile
...
group :development do
  gem 'ruby-debug19'
end
...

% bundle install
...
Installing ruby-debug-base19 (0.11.25) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
        /Users/r/Developer/Topaz/usr/bin/ruby extconf.rb 
...
ruby_debug.c:29: error: conflicting types for 'rb_iseq_compile_with_option'
$SANDBOX/usr/include/ruby-1.9.1/ruby-1.9.3-p0/vm_core.h:505: error: previous declaration of 'rb_iseq_compile_with_option' was here
...
make: *** [ruby_debug.o] Error 1 …
Run Code Online (Sandbox Code Playgroud)

ruby gem ruby-on-rails ruby-debug

14
推荐指数
1
解决办法
2万
查看次数

跳转到ruby-debug中*my code*的下一行

在ruby-debug中,下一个命令将带您进入下一行要执行的代码,无论该行是在您自己的代码中,还是在rails框架中,还是在gem中.

是否有某种方法可以强制ruby-debug(1.9)跳转到它在代码中遇到的下一行而不停止它必须在路上执行的所有其他行?

ruby-on-rails ruby-debug

11
推荐指数
1
解决办法
2485
查看次数

无法在安装了ruby 1.9.2和1.9.3的win7上安装gem ruby​​-debug19

我尝试了很多解决方案,但似乎没有任何效果!我使用Ruby 1.9.3和Rails 3.1.3,我想安装ruby-debug19 gem.这是我从PowerShell获得的:

PS C:\Users\**\**\**> gem install ruby-debug19
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug19:
        ERROR: Failed to build gem native extension.

        C:/Ruby193/bin/ruby.exe extconf.rb
checking for rb_method_entry_t.body in method.h... no
checking for vm_core.h... no
C:/Ruby193/lib/ruby/gems/1.9.1/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:39: Use RbConfig instead of obsolete and deprecated Config.
checking for rb_method_entry_t.body in method.h... no
checking for vm_core.h... yes
checking for iseq.h... yes
checking for insns.inc... yes
checking for insns_info.inc... yes
checking for eval_intern.h... …
Run Code Online (Sandbox Code Playgroud)

ruby-debug ruby-1.9.3

9
推荐指数
1
解决办法
5775
查看次数

Rails 3.1和Ruby 1.9.3p125:ruby-debug19仍然崩溃,"未找到符号:_ruby_threadptr_data_type"

可能重复:
使用Ruby 1.9.3进行ruby-debug?

我听说有关ruby 1.9.3p125有解决ruby-debug19问题的传言,所以根据RVM网站上的说明,我重新安装了1.9.3:

$ rvm reinstall 1.9.3 --patch debug --force-autoconf
$ ruby -v
  ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.2.0]
Run Code Online (Sandbox Code Playgroud)

然后:

gem install ruby-debug19
Run Code Online (Sandbox Code Playgroud)

在我的Gemfile中添加了这个条目:

gem 'ruby-debug19'
Run Code Online (Sandbox Code Playgroud)

然后:

$ rails server -u         
=> Booting WEBrick
=> Rails 3.1.3 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
Run Code Online (Sandbox Code Playgroud)

为了解决这个错误,我将我的Gemfile条目更改为:

gem 'ruby-debug19', :require => …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails ruby-debug ruby-1.9.3

9
推荐指数
1
解决办法
3552
查看次数

确定程序是否在调试模式下运行

我使用RubyMine编写和调试我的Ruby 2.0代码.它为此目的使用ruby-debug-ide.我想知道程序是否在调试模式下运行.

我知道有Ruby $DEBUG全局变量,但据我所知,ruby-debug-ide没有改变它,因为它没有使用-druby标志.

如果我使用Rubymine调试我的文件,执行的命令如下所示:

/home/user/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/user/.rvm/gems/ruby-2.0.0-p353/gems/ruby-debug-ide-0.4.22/bin/rdebug-ide --disable-int-handler --port 37737 --dispatcher-port 47992 -- /home/user/file.rb
Run Code Online (Sandbox Code Playgroud)

我试图使用ARGV$0,以确定命令行是否包含字符串,'rdebug-ide'但是ARGV是一个空数组,$0只是'/home/user/file.rb',我如何获得RubyMine执行的完整命令行?

ruby ruby-debug

9
推荐指数
1
解决办法
802
查看次数

无法在Windows上安装ruby-debug gem

我在Windows上安装Ruby-Debug Gem时遇到问题.这个错误是什么意思?我怎样才能解决这个问题?谢谢

C:\Users\Steve>gem install ruby-debug
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.
C:/Ruby19/bin/ruby.exe extconf.rb
Can't handle 1.9.x yet
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby19/bin/ruby
Gem files will remain installed …
Run Code Online (Sandbox Code Playgroud)

windows rubygems ruby-on-rails ruby-debug

8
推荐指数
3
解决办法
1万
查看次数

ruby-debug和黄瓜

我有一个黄瓜失败的情况,我想使用ruby-debug调试我的rails控制器.但是,如果我将"调试器"添加到我想要破解的位置,它就不会停止.

我尝试将features of ruby​​-debug和rubygems添加到features/support/env.rb但是然后它告诉我它无法加载ruby-debug,尽管ruby-debug在gem列表中我可以加载它IRB.

那么......我该怎么办才能让它发挥作用?

谢谢!

ruby-on-rails cucumber ruby-debug

8
推荐指数
2
解决办法
3863
查看次数