我寫了一個機架應用程序(here),每天鎖定一次或兩次,我需要調試應用程序。如何在運行時調試Rack應用程序?
所以,我試過下面這個: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」語句並寫入日誌,因爲我已經嘗試過了,而且非常受打擊或者很失敗。