加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby调试器直接进入块?

发布时间:2020-12-16 22:28:30 所属栏目:百科 来源:网络整理
导读:在以下 Ruby代码中: #! /usr/bin/env rubyrequire '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 s
在以下 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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读