summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-08 12:08:20 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-08 12:08:20 +0000
commitcff2b2b66626e5aee5598f98b1f855249ca2f282 (patch)
treed2eac53c4065e0ddc4dc7c135eb512b1d47c0a25 /vm_backtrace.c
parent377758fdcba8c3655da6fd45808a69ac3c4bab82 (diff)
* vm_backtrace.c, include/ruby/debug.h: add new APIs
* VALUE rb_profile_frame_method_name(VALUE frame) * VALUE rb_profile_frame_qualified_method_name(VALUE frame) * iseq.c (rb_iseq_klass), internal.h: add new internal function rb_iseq_method_name(). * ext/-test-/debug/profile_frames.c (profile_frames), test/-ext-/debug/test_profile_frames.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c
index b4f16f6..8155c85 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -1287,3 +1287,30 @@ rb_profile_frame_singleton_method_p(VALUE frame)
return Qfalse;
}
}
+
+VALUE
+rb_profile_frame_method_name(VALUE frame)
+{
+ return rb_iseq_method_name(frame2iseq(frame));
+}
+
+VALUE
+rb_profile_frame_qualified_method_name(VALUE frame)
+{
+ VALUE method_name = rb_iseq_method_name(frame2iseq(frame));
+ if (method_name != Qnil) {
+ VALUE classpath = rb_profile_frame_classpath(frame);
+ VALUE singleton_p = rb_profile_frame_singleton_method_p(frame);
+
+ if (classpath != Qnil) {
+ return rb_sprintf("%"PRIsVALUE"%s%"PRIsVALUE,
+ classpath, singleton_p == Qtrue ? "." : "#", method_name);
+ }
+ else {
+ return method_name;
+ }
+ }
+ else {
+ return Qnil;
+ }
+}