summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-14 17:36:10 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-14 17:36:10 +0000
commit61b9d4a288361bd055df346cdde4bb970c7406a3 (patch)
tree1dd2fcc743a3e70bea0b37855b36f63dbe5c9f42 /error.c
parent627eec87257d22022d0c67fad697be8daaafef5a (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 'error.c')
-rw-r--r--error.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/error.c b/error.c
index f2c86448e7..46ae322ebe 100644
--- a/error.c
+++ b/error.c
@@ -862,6 +862,25 @@ exc_backtrace(VALUE exc)
return obj;
}
+VALUE
+rb_get_backtrace(VALUE exc)
+{
+ ID mid = id_backtrace;
+ if (rb_method_basic_definition_p(CLASS_OF(exc), id_backtrace)) {
+ VALUE info, klass = rb_eException;
+ rb_thread_t *th = GET_THREAD();
+ if (NIL_P(exc))
+ return Qnil;
+ EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, exc, mid, klass, Qundef);
+ info = exc_backtrace(exc);
+ EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, exc, mid, klass, info);
+ if (NIL_P(info))
+ return Qnil;
+ return rb_check_backtrace(info);
+ }
+ return rb_funcall(exc, mid, 0, 0);
+}
+
/*
* call-seq:
* exception.backtrace_locations -> array