Permalink
Browse files

fix bug in Parrot_sub_get_line_from_pc

It used to compare the op against the size of the debug segment, not
against the size of the code segment.
Patch courtesy by mls++
  • Loading branch information...
1 parent 4e204ad commit 64522d5702c490c1cbc536553a06e09ac988870f @moritz moritz committed Sep 6, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/sub.c
View
@@ -221,7 +221,7 @@ Parrot_sub_get_line_from_pc(PARROT_INTERP, ARGIN_NULLOK(PMC *subpmc), ARGIN_NULL
ASSERT_ARGS(Parrot_sub_get_line_from_pc)
Parrot_Sub_attributes *sub;
opcode_t *base_pc, *debug_ops;
- size_t i, op, current_annotation, debug_size;
+ size_t i, op, current_annotation, debug_size, code_size;
if (!subpmc || !pc)
return -1;
@@ -230,13 +230,14 @@ Parrot_sub_get_line_from_pc(PARROT_INTERP, ARGIN_NULLOK(PMC *subpmc), ARGIN_NULL
debug_ops = sub->seg->debugs->base.data;
debug_size = sub->seg->debugs->base.size;
+ code_size = sub->seg->base.size;
base_pc = sub->seg->base.data;
current_annotation = pc - base_pc;
/* assert pc is in correct segment */
- PARROT_ASSERT(base_pc <= pc && pc <= base_pc + sub->seg->base.size);
+ PARROT_ASSERT(base_pc <= pc && pc <= base_pc + code_size);
- for (i = op = 0; op < debug_size; ++i) {
+ for (i = op = 0; op < code_size; ++i) {
op_info_t * const op_info = sub->seg->op_info_table[*base_pc];
opcode_t var_args = 0;

0 comments on commit 64522d5

Please sign in to comment.