diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-14 17:36:10 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-14 17:36:10 +0000 |
commit | 61b9d4a288361bd055df346cdde4bb970c7406a3 (patch) | |
tree | 1dd2fcc743a3e70bea0b37855b36f63dbe5c9f42 /eval.c | |
parent | 627eec87257d22022d0c67fad697be8daaafef5a (diff) |
merge revision(s) 56766,56767: [Backport #12925]
error.c: rb_get_backtrace
* error.c (rb_get_backtrace): move from eval_error.c to call
exc_backtrace directly. [ruby-core:78097] [Bug #12925]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 27 |
1 files changed, 20 insertions, 7 deletions
@@ -509,13 +509,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(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(); } } @@ -557,6 +569,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); JUMP_TAG(TAG_FATAL); @@ -1525,7 +1538,7 @@ errat_getter(ID id) { VALUE err = get_errinfo(); if (!NIL_P(err)) { - return get_backtrace(err); + return rb_get_backtrace(err); } else { return Qnil; |