| 赞 | 72 |
| VIP | |
| 好人卡 | |
| 积分 | 23 |
| 经验 | |
| 最后登录 | 2022-3-9 |
| 在线时间 | 4033 小时 |
…あたしは天
- 梦石
- 0
- 星屑
- 2308
- 在线时间
- 4033 小时
- 注册时间
- 2010-10-4
- 回帖
- 10548
 
|
发表于 2015-5-23 17:31:56
|
显示全部楼层
本帖最后由 taroxd 于 2015-5-23 17:40 编辑
给你一个来自Ruby文档的例子。不过一般来说Ruby不怎么需要单步调试。有一些好用的调试gem但是放到RGSS就不太方便
[pre lang="ruby"]class Test
def test
a = 1
b = 2
end
end
set_trace_func proc { |event, file, line, id, binding, classname|
printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
}
t = Test.new
t.test
__END__
下面是输出:
c-return F:/Documents/test.rb:8 set_trace_func Kernel
line F:/Documents/test.rb:11
c-call F:/Documents/test.rb:11 new Class
c-call F:/Documents/test.rb:11 initialize BasicObject
c-return F:/Documents/test.rb:11 initialize BasicObject
c-return F:/Documents/test.rb:11 new Class
line F:/Documents/test.rb:12
call F:/Documents/test.rb:2 test Test
line F:/Documents/test.rb:3 test Test
line F:/Documents/test.rb:4 test Test
return F:/Documents/test.rb:5 test Test[/pre]
set_trace_func 的详细用法请参考 Ruby 文档(非 F1) |
评分
-
查看全部评分
|