summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-11 14:20:25 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-11 14:20:25 +0000
commitc1034574aa7e6f47843b5533411c75d8196b29d8 (patch)
treea61969cdbaff9194f0c3f7a28eec2b313d7be006 /test
parentea15ceddbef2cc4c459c1ad5796e43ae9fa2cbf1 (diff)
merge revision(s) 64514: [Backport #14702]
check trace flags at loading [Bug #14702] * iseq.c (iseq_init_trace): at ISeq loading time, we need to check `ruby_vm_event_enabled_flags` to turn on trace instructions. Seprate this checking code from `finish_iseq_build()` and make new function. `iseq_ibf_load()` calls this funcation after loading. * test/ruby/test_iseq.rb: add a test for this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@64997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_iseq.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 92340bd8fd..404539ed7f 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -390,4 +390,18 @@ class TestISeq < Test::Unit::TestCase
end
}
end
+
+ def test_to_binary_tracepoint
+ filename = "#{File.basename(__FILE__)}_#{__LINE__}"
+ iseq = RubyVM::InstructionSequence.compile("x = 1\n y = 2", filename)
+ iseq_bin = iseq.to_binary
+ ary = []
+ TracePoint.new(:line){|tp|
+ next unless tp.path == filename
+ ary << [tp.path, tp.lineno]
+ }.enable{
+ ISeq.load_from_binary(iseq_bin).eval
+ }
+ assert_equal [[filename, 1], [filename, 2]], ary, '[Bug #14702]'
+ end
end