在以下Ruby代码中:
#! /usr/bin/env ruby
require 'debugger'
def hello
puts "hello"
if block_given?
yield
end
end
def main
debugger
puts "test begin..."
hello do # <= if you are here
puts "here!" #<= how to get here without setting bp here or step into hello?
end
end
main
Run Code Online (Sandbox Code Playgroud)
这在调试过程中很常见,我不关心产生块的函数的实现,我只是想直接进入块,而不需要在那里手动设置断点.
在ruby-debug19或调试器中是否存在对这种"步入块"的支持?
the*_*Man 13
您是否尝试过使用" c"命令进行" 继续 "?它可以选择一个行号,因此,根据您的代码示例尝试:
c 16
Run Code Online (Sandbox Code Playgroud)