Skip to content

Commit

Permalink
use rb_iseq_line_no() if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Sep 15, 2011
1 parent 4990f6d commit 4453c34
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ext/ruby_debug/ruby_debug.c
Expand Up @@ -751,6 +751,10 @@ set_thread_event_flag_i(st_data_t key, st_data_t val, st_data_t flag)
static int
find_prev_line_start(rb_control_frame_t *cfp)
{
#if defined HAVE_TYPE_STRUCT_ISEQ_LINE_INFO_ENTRY
const rb_iseq_t *iseq = cfp->iseq;
return rb_iseq_line_no(iseq, cfp->pc - iseq->iseq_encoded - 1);
#else
int i, pos, line_no;
pos = cfp->pc - cfp->iseq->iseq_encoded;
for (i = 0; i < cfp->iseq->insn_info_size; i++)
Expand All @@ -773,6 +777,7 @@ find_prev_line_start(rb_control_frame_t *cfp)
return(pos);
}
return(-1);
#endif
}

static rb_control_frame_t *
Expand Down

0 comments on commit 4453c34

Please sign in to comment.