summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-19 12:43:48 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-19 12:43:48 (GMT)
commitbef2e29aab53d2d15006fad7de9e56f2f44c7778 (patch)
treeae966a2db6bf86622ac22a033dc3a6d25a0bf23a /vm.c
parent370212a8ae39939979cf0651bd98108316a8e535 (diff)
* vm.c (rb_vm_rewind_cfp): add new function to rewind specified cfp
with invoking RUBY_EVENT_C_RETURN. [Bug #9961] * vm_core.h: ditto. * eval.c (rb_protect): use it. * eval.c (rb_rescue2): ditto. * vm_eval.c (rb_iterate): ditto. * test/ruby/test_settracefunc.rb: add a test. * vm_core.h (rb_name_err_mesg_new): git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index bf7cb20..8eb02f3 100644
--- a/vm.c
+++ b/vm.c
@@ -288,6 +288,23 @@ rb_vm_pop_cfunc_frame(void)
vm_pop_frame(th);
}
+void
+rb_vm_rewind_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
+{
+ /* check skipped frame */
+ while (th->cfp != cfp) {
+#if VMDEBUG
+ printf("skipped frame: %s\n", vm_frametype_name(th->cfp));
+#endif
+ if (VM_FRAME_TYPE(th->cfp) != VM_FRAME_MAGIC_CFUNC) {
+ vm_pop_frame(th);
+ }
+ else { /* unlikely path */
+ rb_vm_pop_cfunc_frame();
+ }
+ }
+}
+
/* obsolete */
void
rb_frame_pop(void)