diff options
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r-- | vm_backtrace.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c index 8294d218a4..f2e9bed6ba 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -283,19 +283,16 @@ location_base_label_m(VALUE self) return location_base_label(location_ptr(self)); } -static VALUE -location_path(rb_backtrace_location_t *loc) +static const rb_iseq_t * +location_iseq(rb_backtrace_location_t *loc) { switch (loc->type) { case LOCATION_TYPE_ISEQ: - return rb_iseq_path(loc->iseq); + return loc->iseq; case LOCATION_TYPE_CFUNC: - if (loc->iseq) { - return rb_iseq_path(loc->iseq); - } - return Qnil; + return loc->iseq; default: - rb_bug("location_path: unreachable"); + rb_bug("location_iseq: unreachable"); UNREACHABLE; } } @@ -313,7 +310,8 @@ location_path(rb_backtrace_location_t *loc) static VALUE location_path_m(VALUE self) { - return location_path(location_ptr(self)); + const rb_iseq_t *iseq = location_iseq(location_ptr(self)); + return iseq ? rb_iseq_path(iseq) : Qnil; } #ifdef USE_ISEQ_NODE_ID @@ -336,11 +334,13 @@ location_node_id(rb_backtrace_location_t *loc) #endif void -rb_frame_info_get(VALUE obj, VALUE *path, int *node_id) +rb_frame_info_get(VALUE obj, VALUE *path, VALUE *script_lines, int *node_id) { #ifdef USE_ISEQ_NODE_ID rb_backtrace_location_t *loc = location_ptr(obj); - *path = location_path(loc); + const rb_iseq_t *iseq = location_iseq(loc); + *path = iseq ? rb_iseq_path(iseq) : Qnil; + *script_lines = iseq ? iseq->body->variable.script_lines : Qnil; *node_id = location_node_id(loc); #else *path = Qnil; |