debase 0.2.4 → 0.2.4.1

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
  SHA256:
3
- metadata.gz: 1a53e6b86e56f57d21d91907d79bd117a55131fceb5eb5ae7e263b9fdbb4b2ab
4
- data.tar.gz: 9cc31bcb8a81cd41b74af0c9479767f61a6b95b24a1dd6a0f876f7be4c25d008
3
+ metadata.gz: 107e62228760d4c312c185830e9b6c152814c02b2f85d94a094c44e6687402b8
4
+ data.tar.gz: 740ccb46f3bb6e97d60afd38e90c6d9cb3be58f0a29c66efc44f0e06d18acec8
5
5
  SHA512:
6
- metadata.gz: bd7ca6c0415ec28cc249877f951d57de3d6bebfd47488c89e2747d7c3d63e88bcd8cc45bdaf67f78c81a03d75339898811dc588d715c9eaf704e3e94818842e7
7
- data.tar.gz: 81a02f4068082f139cfaafa0d2825fc88f1ef56be0531e4da831ef8ae2d18c0f23736de09efdb685dcbf7297e0cfabce8a6437a07f5ac10f8c601abd86cf6eb2
6
+ metadata.gz: 6ade635981299fee6a15e4e353c66db86f6afe14ae5c1a3e6f364a7936cec11f21f32ce4527d249d89738a573106a80be861b63ff334d591ef29adf6bdbcc5f0
7
+ data.tar.gz: a9c840b6868a842f94f4402a4161115b703522c9a29ff5bb3b09ab2025fcff451b3bb912858d413bfb673eb2a994c989498fe08cef062cd04db44c68f4d5ad54
@@ -313,6 +313,35 @@ call_at_line(debug_context_t *context, char *file, int line, VALUE context_objec
313
313
  rb_funcall(context_object, idAtLine, 2, rb_str_new2(file), INT2FIX(line));
314
314
  }
315
315
 
316
+ int count_stack_size() {
317
+ rb_thread_t *thread = ruby_current_thread;
318
+ rb_control_frame_t *last_cfp = TH_CFP(thread);
319
+ rb_control_frame_t *start_cfp = RUBY_VM_END_CONTROL_FRAME(TH_INFO(thread));
320
+ rb_control_frame_t *cfp;
321
+
322
+ ptrdiff_t size, i;
323
+
324
+ start_cfp =
325
+ RUBY_VM_NEXT_CONTROL_FRAME(
326
+ RUBY_VM_NEXT_CONTROL_FRAME(start_cfp)); /* skip top frames */
327
+
328
+ if (start_cfp < last_cfp) {
329
+ size = 0;
330
+ }
331
+ else {
332
+ size = start_cfp - last_cfp + 1;
333
+ }
334
+
335
+ int stack_size = 0;
336
+ for (i=0, cfp = start_cfp; i<size; i++, cfp = RUBY_VM_NEXT_CONTROL_FRAME(cfp)) {
337
+ if (cfp->iseq && cfp->pc) {
338
+ stack_size++;
339
+ }
340
+ }
341
+
342
+ return stack_size;
343
+ }
344
+
316
345
  static void
317
346
  process_line_event(VALUE trace_point, void *data)
318
347
  {
@@ -343,7 +372,8 @@ process_line_event(VALUE trace_point, void *data)
343
372
  print_event(tp, context);
344
373
 
345
374
  if(context->init_stack_size == -1) {
346
- context->init_stack_size = context->stack_size;
375
+ context->stack_size = count_stack_size();
376
+ context->init_stack_size = context->stack_size;
347
377
  }
348
378
 
349
379
  if (context->thread_pause) {
@@ -1,3 +1,3 @@
1
1
  module Debase
2
- VERSION = "0.2.4" unless defined? VERSION
2
+ VERSION = "0.2.4.1" 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.2.4
4
+ version: 0.2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Ushakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-07 00:00:00.000000000 Z
11
+ date: 2019-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase-ruby_core_source