From 88101695ab516ce30f930513150c1247ebc6c36d Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 5 Feb 2013 06:04:59 +0000 Subject: * proc.c (rb_binding_new_with_cfp): permit to create binding object of IFUNC frame. When `rb_binding_new_with_cfp()' is called, VM finds out the first normal (has iseq) frame and create a binding object of this frame and create Env objects. `ep's of related frames are updated (`ep's point Env object managed spaces). However, `ep' of skipped IFUNC frame was not updated and old invalid `ep' was remained. It causes serious problems. To solve this issue, permit IFUNC to create binding. (Maybe there is no problem on it) [ruby-dev:46908] [ruby-trunk - Bug #7774] * test/ruby/test_settracefunc.rb: add a test. * vm.c (rb_vm_get_binding_creatable_next_cfp), vm_core.h: added. * vm_trace.c: fix to use `rb_vm_get_binding_creatable_next_cfp()'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- proc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'proc.c') diff --git a/proc.c b/proc.c index 07c43dfe00..47c565134a 100644 --- a/proc.c +++ b/proc.c @@ -313,19 +313,21 @@ binding_clone(VALUE self) VALUE rb_binding_new_with_cfp(rb_thread_t *th, const rb_control_frame_t *src_cfp) { - rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, src_cfp); + rb_control_frame_t *cfp = rb_vm_get_binding_creatable_next_cfp(th, src_cfp); + rb_control_frame_t *ruby_level_cfp = rb_vm_get_ruby_level_next_cfp(th, src_cfp); VALUE bindval; rb_binding_t *bind; - if (cfp == 0) { + if (cfp == 0 || ruby_level_cfp == 0) { rb_raise(rb_eRuntimeError, "Can't create Binding Object on top of Fiber."); } bindval = binding_alloc(rb_cBinding); GetBindingPtr(bindval, bind); bind->env = rb_vm_make_env_object(th, cfp); - bind->path = cfp->iseq->location.path; - bind->first_lineno = rb_vm_get_sourceline(cfp); + bind->path = ruby_level_cfp->iseq->location.path; + bind->first_lineno = rb_vm_get_sourceline(ruby_level_cfp); + return bindval; } -- cgit v1.2.3