aboutsummaryrefslogtreecommitdiffstats
path: root/vm_backtrace.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-10 05:26:52 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-10 05:26:52 +0000
commite3477b7c58a30f384b45bb0882ae5c8134f483ef (patch)
tree6f313b2a2d4767a8e316f2522e8e59e4e57329f0 /vm_backtrace.c
parentdde9a8755fd40c3e7053da21de68a241bba4ef54 (diff)
downloadruby-e3477b7c58a30f384b45bb0882ae5c8134f483ef.tar.gz
refactoring about source line.
* iseq.c (find_line_no): renamed to rb_iseq_line_no(). * vm_backtrace.c (calc_lineno): add a comment why we need to use "pos-1". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_backtrace.c')
-rw-r--r--vm_backtrace.c4
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