Project

General

Profile

Actions

Bug #1674

closed

set_trace_func with 1line block

Added by wanabe (_ wanabe) over 15 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-06-21 trunk 23809) [i386-mingw32]
Backport:
[ruby-dev:38698]

Description

=begin
内容が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]
["", 2]
["", 2]
true
["", 2]
true
["-e", 7]
== disasm: <RubyVM::InstructionSequence:@>==========
== 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 , 0,
0012 leave
== disasm: <RubyVM::InstructionSequence:block in @>=
== 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, ( 2)
0011 leave ( 4)
=end
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0