debase 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43a4f24d6fce6507d60290b847788017aa52866c
4
- data.tar.gz: 7084bcf2ed640eb218d87161ba11ab98f08513e1
3
+ metadata.gz: 352d91f43143f540d4574637d8947567878edd3b
4
+ data.tar.gz: be678b9761b4652414433eb43848eaf807542e5b
5
5
  SHA512:
6
- metadata.gz: 2f73422c127107fe46b5228cd1160bc177127daaeceb867faf6659f1f96dc96a5ded6189b42a31337674f212a84c162d686b51c20b34b0c89ab19fc7195eb3a9
7
- data.tar.gz: 68d80847171e6fe8be394c6820adece959a5fe275f127d74c970cf2a718375466f8d6be2d2d8b72ae6854911f595a5277e6368cdb5ce1e70916d83eacc1d43e0
6
+ metadata.gz: 2da8fa606defb081abae519eda7d36c016a33eb01435b4c0c0a64b5add87d548d12cec3ba3d52923b464a13477464027a245c85aa8ddbb4110ed7b310366da19
7
+ data.tar.gz: 5c90a828b055619460d88f991c80f6c2d46f52608066ad03251b39c2e472ddd65c71feb4b4fd7bdddb74a69b8ebc760d5000b3c545fe0362cb1112109f4b837e
@@ -45,7 +45,7 @@ fill_stack(debug_context_t *context, const rb_debug_inspector_t *inspector) {
45
45
  int i;
46
46
 
47
47
  locations = rb_debug_inspector_backtrace_locations(inspector);
48
- stack_size = (int)RARRAY_LEN(locations);
48
+ stack_size = locations == Qnil ? 0 : (int)RARRAY_LEN(locations);
49
49
  context->stack_size = stack_size;
50
50
 
51
51
  for (i = 0; i < stack_size; i++) {
@@ -53,7 +53,7 @@ fill_stack(debug_context_t *context, const rb_debug_inspector_t *inspector) {
53
53
  location = rb_ary_entry(locations, i);
54
54
  path = rb_funcall(location, rb_intern("path"), 0);
55
55
  lineno = rb_funcall(location, rb_intern("lineno"), 0);
56
- file = RSTRING_PTR(path);
56
+ file = path != Qnil ? RSTRING_PTR(path) : "";
57
57
  line = FIX2INT(lineno);
58
58
  fill_frame(frame, file, line, rb_debug_inspector_frame_binding_get(inspector, i), rb_debug_inspector_frame_self_get(inspector, i));
59
59
  frame->prev = context->stack;
@@ -129,16 +129,30 @@ print_event(rb_trace_point_t *tp, debug_context_t *context)
129
129
  VALUE line;
130
130
  VALUE event;
131
131
  VALUE mid;
132
+ VALUE rb_cl;
133
+ VALUE rb_cl_name;
134
+ const char *defined_class;
132
135
 
133
136
  if (debug == Qtrue) {
134
137
  path = rb_tracearg_path(tp);
135
138
  line = rb_tracearg_lineno(tp);
136
139
  event = rb_tracearg_event(tp);
137
140
  mid = rb_tracearg_method_id(tp);
138
- fprintf(stderr, "%s: file=%s, line=%d, mid=%s\n", symbol2str(event), RSTRING_PTR(path), FIX2INT(line), symbol2str(mid));
141
+ rb_cl = rb_tracearg_defined_class(tp);
142
+ rb_cl_name = NIL_P(rb_cl) ? rb_cl : rb_mod_name(rb_cl);
143
+ defined_class = NIL_P(rb_cl_name) ? "" : RSTRING_PTR(rb_cl_name);
144
+
145
+ fprintf(stderr, "[#%d] %s@%s:%d %s#%s\n",
146
+ context->thnum,
147
+ symbol2str(event),
148
+ path == Qnil ? "" : RSTRING_PTR(path),
149
+ FIX2INT(line),
150
+ defined_class,
151
+ mid == Qnil ? "(top level)" : symbol2str(mid)
152
+ );
139
153
  locations = rb_funcall(context->thread, rb_intern("backtrace_locations"), 1, INT2FIX(1));
140
- fprintf(stderr, " calced_stack_size=%d, stack_size=%d, thread=%d, real_stack_size=%d\n",
141
- context->calced_stack_size, context->stack_size, context->thnum,
154
+ fprintf(stderr, " calced_stack_size=%d, stack_size=%d, real_stack_size=%d\n",
155
+ context->calced_stack_size, context->stack_size,
142
156
  locations != Qnil ? (int)RARRAY_LEN(locations) : 0);
143
157
  }
144
158
  }
@@ -294,7 +308,7 @@ process_call_event(VALUE trace_point, void *data)
294
308
 
295
309
  ++context->calced_stack_size;
296
310
  update_stack_size(context);
297
- print_event(TRACE_POINT, context);
311
+ print_event(TRACE_POINT, context);
298
312
  cleanup(context);
299
313
  }
300
314
 
@@ -1,3 +1,3 @@
1
1
  module Debase
2
- VERSION = "0.1.4" unless defined? VERSION
2
+ VERSION = "0.1.5" 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.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Ushakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-21 00:00:00.000000000 Z
11
+ date: 2015-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase-ruby_core_source