Skip to content

Commit 2f01918

Browse files
committed
better pause support
1 parent 332b010 commit 2f01918

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

ext/ruby_debug/ruby_debug.c

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <insns_info.inc>
1010
#include "ruby_debug.h"
1111

12-
#define DEBUG_VERSION "0.11.30.pre14"
12+
#define DEBUG_VERSION "0.11.30.pre15"
1313

1414
#define FRAME_N(n) (&debug_context->frames[debug_context->stack_size-(n)-1])
1515
#define GET_FRAME (FRAME_N(check_frame_number(debug_context, frame)))
@@ -675,6 +675,34 @@ c_call_new_frame_p(VALUE klass, ID mid)
675675
return 0;
676676
}
677677

678+
static int
679+
remove_pause_flag_i(st_data_t key, st_data_t value, st_data_t dummy)
680+
{
681+
VALUE context;
682+
debug_context_t *debug_context;
683+
684+
context = (VALUE)value;
685+
if (!context)
686+
{
687+
return ST_CONTINUE;
688+
}
689+
690+
Data_Get_Struct((VALUE)value, debug_context_t, debug_context);
691+
debug_context->thread_pause = 0;
692+
693+
return ST_CONTINUE;
694+
}
695+
696+
static void
697+
remove_pause_flag(void)
698+
{
699+
threads_table_t *threads_table;
700+
701+
Data_Get_Struct(rdebug_threads_tbl, threads_table_t, threads_table);
702+
st_foreach(threads_table->tbl, remove_pause_flag_i, 0);
703+
}
704+
705+
678706
static void
679707
call_at_line_check(VALUE self, debug_context_t *debug_context, VALUE breakpoint, VALUE context, char *file, int line)
680708
{
@@ -700,6 +728,7 @@ call_at_line_check(VALUE self, debug_context_t *debug_context, VALUE breakpoint,
700728
}
701729

702730
reset_stepping_stop_points(debug_context);
731+
remove_pause_flag();
703732
call_at_line(context, debug_context, rb_str_new2(file), INT2FIX(line));
704733
}
705734

@@ -837,7 +866,6 @@ debug_event_hook(rb_event_flag_t event, VALUE data, VALUE self, ID mid, VALUE kl
837866

838867
if (debug_context->thread_pause)
839868
{
840-
debug_context->thread_pause = 0;
841869
debug_context->stop_next = 1;
842870
debug_context->dest_frame = -1;
843871
moved = 1;

0 commit comments

Comments
 (0)