ruby-debug-base 0.10.5.rc7-java → 0.10.5.rc8-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -373,6 +373,7 @@ debug_context_create(VALUE thread)
373
373
  debug_context->stop_frame = -1;
374
374
  debug_context->stop_reason = CTX_STOP_NONE;
375
375
  debug_context->stack_len = STACK_SIZE_INCREMENT;
376
+ debug_context->thread_pause = 0;
376
377
  debug_context->frames = ALLOC_N(debug_frame_t, STACK_SIZE_INCREMENT);
377
378
  debug_context->stack_size = 0;
378
379
  debug_context->thread_id = ref2id(thread);
@@ -396,6 +397,7 @@ debug_context_dup(debug_context_t *debug_context)
396
397
  new_debug_context->stop_line = -1;
397
398
  new_debug_context->stop_frame = -1;
398
399
  new_debug_context->breakpoint = Qnil;
400
+ new_debug_context->thread_pause = 0;
399
401
  CTX_FL_SET(new_debug_context, CTX_FL_DEAD);
400
402
  new_debug_context->frames = ALLOC_N(debug_frame_t, debug_context->stack_size);
401
403
  new_debug_context->stack_len = debug_context->stack_size;
@@ -452,6 +454,33 @@ call_at_line_unprotected(VALUE args)
452
454
  return rb_funcall2(context, idAtLine, RARRAY(args)->len - 1, RARRAY(args)->ptr + 1);
453
455
  }
454
456
 
457
+ static int
458
+ remove_pause_flag_i(st_data_t key, st_data_t value, st_data_t dummy)
459
+ {
460
+ VALUE context;
461
+ debug_context_t *debug_context;
462
+
463
+ context = (VALUE)value;
464
+ if (!context)
465
+ {
466
+ return ST_CONTINUE;
467
+ }
468
+
469
+ Data_Get_Struct((VALUE)value, debug_context_t, debug_context);
470
+ debug_context->thread_pause = 0;
471
+
472
+ return ST_CONTINUE;
473
+ }
474
+
475
+ static void
476
+ remove_pause_flag(void)
477
+ {
478
+ threads_table_t *threads_table;
479
+
480
+ Data_Get_Struct(rdebug_threads_tbl, threads_table_t, threads_table);
481
+ st_foreach(threads_table->tbl, remove_pause_flag_i, 0);
482
+ }
483
+
455
484
  static VALUE
456
485
  call_at_line(VALUE context, debug_context_t *debug_context, VALUE file, VALUE line)
457
486
  {
@@ -459,6 +488,7 @@ call_at_line(VALUE context, debug_context_t *debug_context, VALUE file, VALUE li
459
488
 
460
489
  last_debugged_thnum = debug_context->thnum;
461
490
  save_current_position(debug_context);
491
+ remove_pause_flag();
462
492
 
463
493
  args = rb_ary_new3(3, context, file, line);
464
494
  return rb_protect(call_at_line_unprotected, args, 0);
@@ -687,6 +717,7 @@ debug_event_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass)
687
717
  /* only the current thread can proceed */
688
718
  locker = thread;
689
719
 
720
+
690
721
  /* ignore a skipped section of code */
691
722
  if(CTX_FL_TEST(debug_context, CTX_FL_SKIPPED)) goto cleanup;
692
723
 
@@ -698,9 +729,15 @@ debug_event_hook(rb_event_t event, NODE *node, VALUE self, ID mid, VALUE klass)
698
729
  if(debug == Qtrue)
699
730
  fprintf(stderr, "%s:%d [%s] %s\n", file, line, get_event_name(event), rb_id2name(mid));
700
731
 
732
+ if (debug_context->thread_pause)
733
+ {
734
+ debug_context->stop_next = 1;
735
+ debug_context->dest_frame = -1;
736
+ moved = 1;
737
+ }
701
738
  /* There can be many event calls per line, but we only want
702
739
  *one* breakpoint per line. */
703
- if(debug_context->last_line != line || debug_context->last_file == NULL ||
740
+ else if(debug_context->last_line != line || debug_context->last_file == NULL ||
704
741
  strcmp(debug_context->last_file, file) != 0)
705
742
  {
706
743
  CTX_FL_SET(debug_context, CTX_FL_ENABLE_BKPT);
@@ -2167,6 +2204,30 @@ context_stop_reason(VALUE self)
2167
2204
  return ID2SYM(rb_intern(sym_name));
2168
2205
  }
2169
2206
 
2207
+ /*
2208
+ * call-seq:
2209
+ * context.break -> bool
2210
+ *
2211
+ * Returns +true+ if context is currently running and set flag to break it at next line
2212
+ */
2213
+ static VALUE
2214
+ context_pause(VALUE self)
2215
+ {
2216
+ debug_context_t *debug_context;
2217
+ VALUE thread;
2218
+
2219
+ debug_check_started();
2220
+
2221
+ Data_Get_Struct(self, debug_context_t, debug_context);
2222
+ if (CTX_FL_TEST(debug_context, CTX_FL_DEAD))
2223
+ return(Qfalse);
2224
+
2225
+ if (context_thread_0(debug_context) == rb_thread_current())
2226
+ return(Qfalse);
2227
+
2228
+ debug_context->thread_pause = 1;
2229
+ return(Qtrue);
2230
+ }
2170
2231
 
2171
2232
  /*
2172
2233
  * Document-class: Context
@@ -2208,7 +2269,8 @@ Init_context()
2208
2269
  rb_define_method(cContext, "breakpoint",
2209
2270
  context_breakpoint, 0); /* in breakpoint.c */
2210
2271
  rb_define_method(cContext, "set_breakpoint",
2211
- context_set_breakpoint, -1); /* in breakpoint.c */
2272
+ context_set_breakpoint, -1); /* in breakpoint.c */
2273
+ rb_define_method(cContext, "pause", context_pause, 0);
2212
2274
  }
2213
2275
 
2214
2276
  /*
@@ -57,6 +57,7 @@ typedef struct {
57
57
  const char * last_file;
58
58
  int last_line;
59
59
  VALUE breakpoint;
60
+ volatile int thread_pause;
60
61
  } debug_context_t;
61
62
 
62
63
  /* variables in ruby_debug.c */
@@ -1,3 +1,3 @@
1
1
  module Debugger
2
- VERSION = "0.10.5.rc7"
2
+ VERSION = "0.10.5.rc8"
3
3
  end
Binary file
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: ruby-debug-base
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 7
5
- version: 0.10.5.rc7
5
+ version: 0.10.5.rc8
6
6
  platform: java
7
7
  authors:
8
8
  - Kent Sibilev
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-28 00:00:00.000000000 Z
12
+ date: 2013-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: linecache