summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-09 00:21:51 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-09 00:21:51 +0000
commitb753b9606e6329c62d385512ea173171c7c07146 (patch)
treef61b8818e59fe469f837f751d24c1e7e03e0b5d8 /vm_backtrace.c
parent21e858e518c4cec31f4c56caa37682db38bac6a3 (diff)
* include/ruby/debug.h,
vm_backtrace.c (rb_profile_frame_full_label): add new C API rb_profile_frame_full_label() which returns label with qualified method name. Note that in future version of Ruby label() may return same return value of full_label(). * ext/-test-/debug/profile_frames.c, test/-ext-/debug/test_profile_frames.rb: fix a test for this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c
index 1f2e8c3..74a9df2 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -1343,3 +1343,22 @@ rb_profile_frame_qualified_method_name(VALUE frame)
return Qnil;
}
}
+
+VALUE
+rb_profile_frame_full_label(VALUE frame)
+{
+ VALUE label = rb_profile_frame_label(frame);
+ VALUE base_label = rb_profile_frame_base_label(frame);
+ VALUE qualified_method_name = rb_profile_frame_qualified_method_name(frame);
+
+ if (NIL_P(qualified_method_name) || base_label == qualified_method_name) {
+ return label;
+ }
+ else {
+ long label_length = RSTRING_LEN(label);
+ long base_label_length = RSTRING_LEN(base_label);
+ VALUE prefix = rb_str_new(RSTRING_PTR(label), label_length - base_label_length);
+
+ return rb_sprintf("%"PRIsVALUE"%"PRIsVALUE, prefix, qualified_method_name);
+ }
+}