diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-25 13:24:17 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-25 13:24:17 +0000 |
commit | c2693f8bd61757e32d2f92010c041a79b21d074a (patch) | |
tree | 0d41dfc32ff961b7b1a6cf0d139779069de280c9 /vm_trace.c | |
parent | 0f63b60f23aea76e52a6f6fc0d073eb2defe58d8 (diff) | |
download | ruby-c2693f8bd61757e32d2f92010c041a79b21d074a.tar.gz |
* vm_trace.c (rb_threadptr_exec_event_hooks_and_pop_frame):
pop a frame before JUMP_TAG() if exception occurred.
This change fix bug of Ruby 1.9.
[ruby-core:51128] [ruby-trunk - Bug #7624]
* vm_core.h (EXEC_EVENT_HOOK_AND_POP_FRAME): add to use
`rb_threadptr_exec_event_hooks_and_pop_frame()'.
* vm.c (vm_exec): use EXEC_EVENT_HOOK_AND_POP_FRAME() while
exception handling. While exception hadnling, if an exception
is raised in hooks, need to pop current frame and raise this
raised exception by hook.
* test/ruby/test_settracefunc.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_trace.c')
-rw-r--r-- | vm_trace.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/vm_trace.c b/vm_trace.c index 743524b0b8..ad0fce0713 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -279,8 +279,8 @@ exec_hooks(rb_thread_t *th, rb_hook_list_t *list, const rb_trace_arg_t *trace_ar return state; } -void -rb_threadptr_exec_event_hooks(rb_trace_arg_t *trace_arg) +static void +rb_threadptr_exec_event_hooks_orig(rb_trace_arg_t *trace_arg, int pop_p) { rb_thread_t *th = trace_arg->th; if (th->trace_arg == 0 && @@ -316,12 +316,25 @@ rb_threadptr_exec_event_hooks(rb_trace_arg_t *trace_arg) th->vm->trace_running--; if (state) { + if (pop_p) th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp); TH_JUMP_TAG(th, state); } th->state = outer_state; } } +void +rb_threadptr_exec_event_hooks_and_pop_frame(rb_trace_arg_t *trace_arg) +{ + rb_threadptr_exec_event_hooks_orig(trace_arg, 1); +} + +void +rb_threadptr_exec_event_hooks(rb_trace_arg_t *trace_arg) +{ + rb_threadptr_exec_event_hooks_orig(trace_arg, 0); +} + VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg) { |