From b85b10c11f9846908a319e72c92e779e46c2217f Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 23 Aug 2018 04:12:14 +0000 Subject: 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 --- iseq.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'iseq.c') diff --git a/iseq.c b/iseq.c index 04b55bba02..cbd216089e 100644 --- a/iseq.c +++ b/iseq.c @@ -504,6 +504,15 @@ rb_iseq_insns_info_decode_positions(const struct rb_iseq_constant_body *body) } #endif +void +iseq_init_trace(rb_iseq_t *iseq) +{ + iseq->aux.trace_events = 0; + if (ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS) { + rb_iseq_trace_set(iseq, ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS); + } +} + static VALUE finish_iseq_build(rb_iseq_t *iseq) { @@ -531,10 +540,7 @@ finish_iseq_build(rb_iseq_t *iseq) rb_exc_raise(err); } - iseq->aux.trace_events = 0; - if (ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS) { - rb_iseq_trace_set(iseq, ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS); - } + iseq_init_trace(iseq); return Qtrue; } -- cgit v1.2.3