diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-14 18:37:39 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-14 18:37:39 +0000 |
commit | 6140b395585d53ef2f02e81ef08ad58ac5e79e88 (patch) | |
tree | 3b1a3b7a4614c9f9156768b85af8880411293796 /error.c | |
parent | 777cead59a6b620ffd55f92067a30a41e6b90672 (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 'error.c')
-rw-r--r-- | error.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -819,6 +819,26 @@ exc_backtrace(VALUE exc) return obj; } +VALUE +rb_get_backtrace(VALUE exc) +{ + ID mid; + CONST_ID(mid, "backtrace"); + if (rb_method_basic_definition_p(CLASS_OF(exc), mid)) { + 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 |