From c127dfaefe34d8d26edca8d102e3dcb7ac0dcc90 Mon Sep 17 00:00:00 2001 From: ViugiNick Date: Mon, 27 Nov 2017 20:43:55 +0300 Subject: [PATCH] ignore duplicate line-events only if there are two in a row --- ext/ruby_debug/ruby_debug.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/ruby_debug/ruby_debug.c b/ext/ruby_debug/ruby_debug.c index 7a59a11..6309a65 100644 --- a/ext/ruby_debug/ruby_debug.c +++ b/ext/ruby_debug/ruby_debug.c @@ -86,6 +86,7 @@ typedef struct locked_thread_t { static locked_thread_t *locked_head = NULL; static locked_thread_t *locked_tail = NULL; +static rb_event_flag_t last_hook_event = RUBY_EVENT_NONE; /* "Step", "Next" and "Finish" do their work by saving information 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 if (CTX_FL_TEST(debug_context, CTX_FL_SKIPPED)) goto cleanup; - if ((event == RUBY_EVENT_LINE) && (debug_context->stack_size > 0) && + if ((event == RUBY_EVENT_LINE) && (last_hook_event == RUBY_EVENT_LINE) && (debug_context->stack_size > 0) && (get_top_frame(debug_context)->line == line) && (get_top_frame(debug_context)->info.runtime.cfp->iseq == iseq) && !CTX_FL_TEST(debug_context, CTX_FL_CATCHING)) { @@ -886,6 +887,8 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl } } + last_hook_event = event; + if(debug == Qtrue) fprintf(stderr, "%s:%d [%s] %s\n", file, line, get_event_name(event), rb_id2name(mid));