aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--vm_backtrace.c7
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d5d1af45f1..25fadc70d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat Dec 1 21:06:58 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c (location_inspect_m): add
+ Thread::Backtrace::Location#inspect.
+ It same as loc_obj.to_s.inspect.
+
Sat Dec 1 19:24:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (rb_io_puts): recurse for the argument itself, not converted
diff --git a/vm_backtrace.c b/vm_backtrace.c
index 9dcb76de1e..8e10d6eb73 100644
--- a/vm_backtrace.c
+++ b/vm_backtrace.c
@@ -300,6 +300,12 @@ location_to_str_m(VALUE self)
return location_to_str(location_ptr(self));
}
+static VALUE
+location_inspect_m(VALUE self)
+{
+ return rb_str_inspect(location_to_str(location_ptr(self)));
+}
+
typedef struct rb_backtrace_struct {
rb_backtrace_location_t *backtrace;
rb_backtrace_location_t *backtrace_base;
@@ -860,6 +866,7 @@ Init_vm_backtrace(void)
rb_define_method(rb_cBacktraceLocation, "path", location_path_m, 0);
rb_define_method(rb_cBacktraceLocation, "absolute_path", location_absolute_path_m, 0);
rb_define_method(rb_cBacktraceLocation, "to_s", location_to_str_m, 0);
+ rb_define_method(rb_cBacktraceLocation, "inspect", location_inspect_m, 0);
rb_define_global_function("caller", rb_f_caller, -1);
rb_define_global_function("caller_locations", rb_f_caller_locations, -1);