diff options
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r-- | vm_backtrace.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/vm_backtrace.c b/vm_backtrace.c index f22e3f2944..fd34081667 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -31,7 +31,9 @@ id2str(ID id) inline static int calc_lineno(const rb_iseq_t *iseq, const VALUE *pc) { - return rb_iseq_line_no(iseq, pc - iseq->body->iseq_encoded); + size_t pos = (size_t)(pc - iseq->body->iseq_encoded); + /* use pos-1 because PC points next instruction at the beggining of instruction */ + return rb_iseq_line_no(iseq, pos - 1); } int |