ruby调试器直接进入块?

前端之家收集整理的这篇文章主要介绍了ruby调试器直接进入块?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在以下 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

这在调试过程中非常常见,我不关心对块产生的函数的实现,我只想直接进入块,而不需要手动设置断点.

在ruby-debug19或调试器中是否存在对这种“步入障碍”的任何支持

解决方法

您是否尝试使用“c”命令,“ continue”?它可以选择一个行号,所以,根据你的代码示例尝试:
c 16
原文链接:https://www.f2er.com/ruby/265984.html

猜你在找的Ruby相关文章