diff --git a/ChangeLog b/ChangeLog index b1d554293d..d7fa2b553a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Dec 12 03:45:41 2012 Nobuyoshi Nakada + + * vm.c (vm_exec): pass exceptions while handling an exception. + + * vm_trace.c (rb_threadptr_exec_event_hooks): propagate exceptions. + revert r38293 partially. + Wed Dec 12 03:09:05 2012 Nobuyoshi Nakada * sample/test.rb (Progress#initialize): add --verbose option and show diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index c1d4970513..c6738494ae 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -801,7 +801,7 @@ class TestSetTraceFunc < Test::Unit::TestCase end def test_tracepoint_exception_at_line - assert_nothing_raised do + assert_raise(RuntimeError) do TracePoint.new(:line) {raise}.enable { 1 } diff --git a/vm.c b/vm.c index 118dd13ca8..da15fd2675 100644 --- a/vm.c +++ b/vm.c @@ -1162,6 +1162,7 @@ vm_exec(rb_thread_t *th) _tag.retval = Qnil; if ((state = EXEC_TAG()) == 0) { vm_loop_start: + _th->tag = &_tag; result = vm_exec_core(th, initial); if ((state = th->state) != 0) { err = result; @@ -1180,6 +1181,7 @@ vm_exec(rb_thread_t *th) err = th->errinfo; exception_handler: + TH_POP_TAG2(); cont_pc = cont_sp = catch_iseqval = 0; while (th->cfp->pc == 0 || th->cfp->iseq == 0) { @@ -1373,7 +1375,6 @@ vm_exec(rb_thread_t *th) if (VM_FRAME_TYPE_FINISH_P(th->cfp)) { vm_pop_frame(th); th->errinfo = err; - TH_POP_TAG2(); JUMP_TAG(state); } else { diff --git a/vm_trace.c b/vm_trace.c index 161c5d1528..717723c635 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -309,11 +309,15 @@ rb_threadptr_exec_event_hooks(rb_trace_arg_t *targ) state = exec_hooks(th, list, targ, !vm_tracing); if (state) goto terminate; } + th->errinfo = errinfo; } terminate: - th->errinfo = errinfo; th->trace_running = 0; th->vm->trace_running = vm_tracing; + + if (state) { + TH_JUMP_TAG(th, state); + } th->state = outer_state; } }