Bug #1674: set_trace_func with 1line block
http://redmine.ruby-lang.org/issues/show/1674

起票者: _ wanabe
ステータス: Open, 優先度: Low
カテゴリ: core
ruby -v: ruby 1.9.2dev (2009-06-21 trunk 23809) [i386-mingw32]

内容が1行だけのブロックを実行すると
set_trace_funcで期待通りの行番号が得られません。

$ ruby -ve '
set_trace_func(proc{|type, file, line, *a|
  p [file, line] if type == "line"
})
iseq = RubyVM::InstructionSequence.compile("\n1.upto(2) {\n\np true\n\n}")
iseq.eval
puts iseq.disasm
'
ruby 1.9.2dev (2009-06-21 trunk 23809) [i386-mingw32]
["-e", 5]
["-e", 6]
["<compiled>", 2]
["<compiled>", 2]
true
["<compiled>", 2]
true
["-e", 7]
== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
== catch table
| catch type: break  st: 0002 ed: 0012 sp: 0000 cont: 0012
|------------------------------------------------------------------------
0000 trace            1                                               (   2)
0002 putobject        1
0004 putobject        2
0006 send             :upto, 1, block in <compiled>, 0, <ic>
0012 leave
== disasm: <RubyVM::InstructionSequence:block in <compiled>@<compiled>>=
== catch table
| catch type: redo   st: 0000 ed: 0011 sp: 0000 cont: 0000
| catch type: next   st: 0000 ed: 0011 sp: 0000 cont: 0011
|------------------------------------------------------------------------
0000 trace            1                                               (   2)
0002 putnil
0003 putobject        true                                            (   4)
0005 send             :p, 1, nil, 8, <ic>                             (   2)
0011 leave                                                            (   4)


----------------------------------------
http://redmine.ruby-lang.org