Skip to content

Commit c127dfa

Browse files
committed
ignore duplicate line-events only if there are two in a row
1 parent 768689b commit c127dfa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/ruby_debug/ruby_debug.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ typedef struct locked_thread_t {
8686

8787
static locked_thread_t *locked_head = NULL;
8888
static locked_thread_t *locked_tail = NULL;
89+
static rb_event_flag_t last_hook_event = RUBY_EVENT_NONE;
8990

9091
/* "Step", "Next" and "Finish" do their work by saving information
9192
about where to stop next. reset_stopping_points removes/resets this
@@ -876,7 +877,7 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
876877
if (CTX_FL_TEST(debug_context, CTX_FL_SKIPPED))
877878
goto cleanup;
878879

879-
if ((event == RUBY_EVENT_LINE) && (debug_context->stack_size > 0) &&
880+
if ((event == RUBY_EVENT_LINE) && (last_hook_event == RUBY_EVENT_LINE) && (debug_context->stack_size > 0) &&
880881
(get_top_frame(debug_context)->line == line) && (get_top_frame(debug_context)->info.runtime.cfp->iseq == iseq) &&
881882
!CTX_FL_TEST(debug_context, CTX_FL_CATCHING))
882883
{
@@ -886,6 +887,8 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
886887
}
887888
}
888889

890+
last_hook_event = event;
891+
889892
if(debug == Qtrue)
890893
fprintf(stderr, "%s:%d [%s] %s\n", file, line, get_event_name(event), rb_id2name(mid));
891894

0 commit comments

Comments
 (0)