Browse Source

Fix breakpoint trigger condition

The breakpoint trigger condition included a check that if prev_line was zero,
no line transition would ever be detected.  This means that if a breakpoint
is set on the first line of a function, it would never get triggered - not
even after execution had proceeded beyond it.

Change the condition so that prev_line can be zero, and a transition 0->1 is
generated.  This allows breakpoints at line 1 to match.
pull/113/head
Sami Vaarala 10 years ago
parent
commit
9d9daf1d2b
  1. 2
      src/duk_js_executor.c

2
src/duk_js_executor.c

@ -1400,7 +1400,7 @@ DUK_LOCAL void duk__interrupt_handle_debugger(duk_hthread *thr, duk_bool_t *out_
break;
}
DUK_ASSERT(bp->filename != NULL);
if (act->prev_line != 0 && act->prev_line < bp->line && line >= bp->line) {
if (act->prev_line < bp->line && line >= bp->line) {
DUK_D(DUK_DPRINT("BREAKPOINT TRIGGERED at %!O:%ld",
(duk_heaphdr *) bp->filename, (long) bp->line));

Loading…
Cancel
Save