summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-14 18:37:39 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-14 18:37:39 +0000
commit6140b395585d53ef2f02e81ef08ad58ac5e79e88 (patch)
tree3b1a3b7a4614c9f9156768b85af8880411293796 /eval.c
parent777cead59a6b620ffd55f92067a30a41e6b90672 (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_2@56786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/eval.c b/eval.c
index 65c604c3b2..9fb819ae84 100644
--- a/eval.c
+++ b/eval.c
@@ -519,13 +519,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();
}
}
@@ -567,6 +579,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);
@@ -1587,7 +1600,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;