diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-13 05:25:54 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-13 05:25:54 +0000 |
commit | 7ab8dcebbf93aef02602f70eb835b030702c0f4f (patch) | |
tree | cfef1c04ddd0a4584e61f77838b91ff9c6481f10 /eval.c | |
parent | d432839cbdefc792adce02f9ea759bb2bb3249fd (diff) |
error.c: redefined backtrace
* error.c (rb_get_backtrace): honor redefined Exception#backtrace
method. [ruby-core:78097] [Bug #12925]
* eval.c (setup_exception): rescue exceptions during backtrace
setup.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -507,13 +507,25 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause) rb_ivar_set(mesg, idBt_locations, at); } } - else if (NIL_P(rb_get_backtrace(mesg))) { - at = rb_vm_backtrace_object(); - if (OBJ_FROZEN(mesg)) { - mesg = rb_obj_dup(mesg); + else { + int status; + + TH_PUSH_TAG(th); + if ((status = EXEC_TAG()) == 0) { + VALUE bt; + if (rb_threadptr_set_raised(th)) goto fatal; + bt = rb_get_backtrace(mesg); + if (NIL_P(bt)) { + at = rb_vm_backtrace_object(); + if (OBJ_FROZEN(mesg)) { + mesg = rb_obj_dup(mesg); + } + rb_ivar_set(mesg, idBt_locations, at); + set_backtrace(mesg, at); + } + rb_threadptr_reset_raised(th); } - rb_ivar_set(mesg, idBt_locations, at); - set_backtrace(mesg, at); + TH_POP_TAG(); } } @@ -556,6 +568,7 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause) } if (rb_threadptr_set_raised(th)) { + fatal: th->errinfo = exception_error; rb_threadptr_reset_raised(th); TH_JUMP_TAG(th, TAG_FATAL); |