mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm.c: pass exceptions while handling an exception
* vm.c (vm_exec): pass exceptions while handling an exception. * vm_trace.c (rb_threadptr_exec_event_hooks): propagate exceptions. revert r38293 partially. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8dafe8c88d
commit
63d0ea4c03
4 changed files with 15 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Dec 12 03:45:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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 <nobu@ruby-lang.org>
|
||||
|
||||
* sample/test.rb (Progress#initialize): add --verbose option and show
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
3
vm.c
3
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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue