debase 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 192953529f5362c8aa127aba048b1ed762a7d28d
4
- data.tar.gz: 1521b4c597910505981f471fb58c79b99451d787
3
+ metadata.gz: 06e75fc48a88bfcfad884d59e6050959aa4cdb7c
4
+ data.tar.gz: af560cc09d27d0576772ff203c3e70c780f25c7c
5
5
  SHA512:
6
- metadata.gz: 295ffcb8a64b4952e4878ad126f77b171318f7cceba924349dbfa2e3ce6c7fee85e87f018b8f8931bf4b8418628d6fbe7f5b137df25be78826436e9719bc68f2
7
- data.tar.gz: cdbe9f4bfe9ec41364306f52714a1368c480b04d731e4de23828421d2bc975ae3e2b2406f2802c03b431a932ee1b6c3e2fd766c657b9eda2efa445e3ec6aa8ea
6
+ metadata.gz: dba74eaed514dc5e96c5264b09f9dd1b20c3e36ab1d283dd22ef7a621dcf4c0b58f3ef1c48f78db89e243eda997b068d2026f5ef8c0548489dcdb8d5101965f4
7
+ data.tar.gz: 92b07150601593a8f34012a3f625cc2739f70978fd38cae398e63295ae7c372d4a3fdb1c7c6c04db29e23bc4c4df6f0f5178386bca2b7668f8422bb3bfb69ca1
@@ -46,6 +46,7 @@ fill_stack(debug_context_t *context, const rb_debug_inspector_t *inspector) {
46
46
 
47
47
  locations = rb_debug_inspector_backtrace_locations(inspector);
48
48
  stack_size = (int)RARRAY_LEN(locations);
49
+ context->stack_size = stack_size;
49
50
 
50
51
  for (i = 0; i < stack_size; i++) {
51
52
  frame = ALLOC(debug_frame_t);
@@ -142,6 +143,7 @@ context_create(VALUE thread, VALUE cDebugThread) {
142
143
  context->last_file = NULL;
143
144
  context->last_line = -1;
144
145
  context->stop_frame = -1;
146
+ context->thread_pause = 0;
145
147
  reset_stepping_stop_points(context);
146
148
  if(rb_obj_class(thread) == cDebugThread) CTX_FL_SET(context, CTX_FL_IGNORE);
147
149
  return Data_Wrap_Struct(cContext, Context_mark, Context_free, context);
@@ -255,6 +257,22 @@ Context_stop_reason(VALUE self)
255
257
  return ID2SYM(rb_intern(symbol));
256
258
  }
257
259
 
260
+ static VALUE
261
+ Context_pause(VALUE self)
262
+ {
263
+ debug_context_t *context;
264
+
265
+ Data_Get_Struct(self, debug_context_t, context);
266
+
267
+ if (context->thread == rb_thread_current())
268
+ {
269
+ return Qfalse;
270
+ }
271
+
272
+ context->thread_pause = 1;
273
+ return Qtrue;
274
+ }
275
+
258
276
  static VALUE
259
277
  Context_stop_next(int argc, VALUE *argv, VALUE self)
260
278
  {
@@ -344,6 +362,7 @@ Init_context(VALUE mDebase)
344
362
  rb_define_method(cContext, "step", Context_stop_next, -1);
345
363
  rb_define_method(cContext, "step_over", Context_step_over, -1);
346
364
  rb_define_method(cContext, "stop_frame=", Context_stop_frame, 1);
365
+ rb_define_method(cContext, "pause", Context_pause, 0);
347
366
 
348
367
  idAlive = rb_intern("alive?");
349
368
 
@@ -151,9 +151,21 @@ stop_inspector(VALUE data)
151
151
  return Qnil;
152
152
  }
153
153
 
154
+ static int
155
+ remove_pause_flag(VALUE thread, VALUE context_object, VALUE ignored)
156
+ {
157
+ debug_context_t *context;
158
+
159
+ Data_Get_Struct(context_object, debug_context_t, context);
160
+ context->thread_pause = 0;
161
+
162
+ return ST_CONTINUE;
163
+ }
164
+
154
165
  static void
155
166
  call_at_line(debug_context_t *context, char *file, int line, VALUE context_object)
156
167
  {
168
+ rb_hash_foreach(contexts, remove_pause_flag, 0);
157
169
  CTX_FL_UNSET(context, CTX_FL_STEPPED);
158
170
  CTX_FL_UNSET(context, CTX_FL_FORCE_MOVE);
159
171
  context->last_file = file;
@@ -187,8 +199,17 @@ process_line_event(VALUE trace_point, void *data)
187
199
  update_stack_size(context);
188
200
  print_event(tp, context);
189
201
 
190
- moved = context->last_line != line || context->last_file == NULL ||
191
- strcmp(context->last_file, file) != 0;
202
+ if (context->thread_pause)
203
+ {
204
+ context->stop_next = 1;
205
+ context->dest_frame = -1;
206
+ moved = 1;
207
+ }
208
+ else
209
+ {
210
+ moved = context->last_line != line || context->last_file == NULL ||
211
+ strcmp(context->last_file, file) != 0;
212
+ }
192
213
 
193
214
  if(context->dest_frame == -1 || context->stack_size == context->dest_frame)
194
215
  {
@@ -52,6 +52,7 @@ typedef struct debug_context {
52
52
  int dest_frame;
53
53
  int stop_line;
54
54
  int stop_frame;
55
+ int thread_pause;
55
56
 
56
57
  char *last_file;
57
58
  int last_line;
@@ -1,3 +1,3 @@
1
1
  module Debase
2
- VERSION = "0.0.7" unless defined? VERSION
2
+ VERSION = "0.0.8" unless defined? VERSION
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Ushakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-29 00:00:00.000000000 Z
11
+ date: 2013-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debugger-ruby_core_source