aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-23 04:12:14 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-23 04:12:14 +0000
commitb85b10c11f9846908a319e72c92e779e46c2217f (patch)
treef3ad93ed725d32547b318360d1064a8e2f4b84a7 /test/ruby
parent870af862452adb5418eea8cb830fa06a9fe8270f (diff)
downloadruby-b85b10c11f9846908a319e72c92e779e46c2217f.tar.gz
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/trunk@64514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-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 86aad2da69..d193f41c6e 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -438,4 +438,18 @@ class TestISeq < Test::Unit::TestCase
end
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