Skip to content

Commit

Permalink
Revert "use rb_iseq_line_no()."
Browse files Browse the repository at this point in the history
This reverts commit f4b590a.
  • Loading branch information
nobu committed Sep 15, 2011
1 parent cbec7ca commit 4990f6d
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions ext/ruby_debug/ruby_debug.c
Expand Up @@ -751,8 +751,28 @@ 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)
{
const rb_iseq_t *iseq = cfp->iseq;
return rb_iseq_line_no(iseq, cfp->pc - iseq->iseq_encoded - 1);
int i, pos, line_no;
pos = cfp->pc - cfp->iseq->iseq_encoded;
for (i = 0; i < cfp->iseq->insn_info_size; i++)
{
if (cfp->iseq->insn_info_table[i].position != pos)
continue;

if (i == 0) return(0); // TODO

pos = -1;
line_no = cfp->iseq->insn_info_table[--i].line_no;
do {
if (cfp->iseq->insn_info_table[i].line_no == line_no)
pos = cfp->iseq->insn_info_table[i].position;
else
break;
i--;
} while (i >= 0);

return(pos);
}
return(-1);
}

static rb_control_frame_t *
Expand Down

0 comments on commit 4990f6d

Please sign in to comment.