繁体   English   中英

如何在Rack应用程序运行时调试它?

[英]How can I debug my Rack app while it's running?

我写了一个机架应用程序( 这里 )每天锁定大约一到两次,我需要调试应用程序。

所以,我试着这样做: http//robots.thoughtbot.com/using-gdb-to-inspect-a-running-ruby-process 我尝试对一个简单的测试脚本进行调试:

class MyTest
  def initialize
    @a ||= 1
  end

  def something
    @a += 1
    puts @a
  end
end

test = MyTest.new

while true do
  sleep 3
  test.something
end

但是,我明白了:

(gdb) redirect_stdout
No symbol "rb_eval_string" in current context.
(gdb) ruby_eval('Kernel.caller')
No symbol "rb_p" in current context.

知道我需要做什么不同吗? 或者有另一种调试方法吗? 我想避免使用“puts”语句并写入日志,因为我已经尝试过了,而且非常受欢迎。

看起来它没有正确附加到过程。 在root模式下运行让我附加和调试。 我运行了call rb_backtrace() ,这给了一些有用的输出。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM