1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[EXPERIMENTAL]

* iseq.c: add following two methods.
* ISeq#line_trace_all returns all line traces (line numbers)
* ISeq#line_trace_specify(pos, set) set `pos'th line event to
  specified_line event (if set is true).
  These features are introduced for debuggers (mainly to make
  breakpoint).
* iseq.h: add decl. of C APIs.
* test/ruby/test_iseq.rb: add tests.
* vm_trace.c: add `specified_line' event.
* include/ruby/ruby.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2012-11-30 17:00:30 +00:00
parent 60317fa81d
commit 12f2f7371f
6 changed files with 154 additions and 0 deletions

View file

@ -25,4 +25,28 @@ class TestISeq < Test::Unit::TestCase
ensure
Encoding.default_internal = enc
end
def test_line_trace
iseq = ISeq.compile \
%q{ a = 1
b = 2
c = 3
# d = 4
e = 5
# f = 6
g = 7
}
assert_equal([1, 2, 3, 5, 7], iseq.line_trace_all)
iseq.line_trace_specify(1, true) # line 2
iseq.line_trace_specify(3, true) # line 5
result = []
TracePoint.new(:specified_line){|tp|
result << tp.lineno
}.enable{
iseq.eval
}
assert_equal([2, 5], result)
end
end