diver_down 0.0.1.alpha9 → 0.0.1.alpha11
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 +4 -4
- data/lib/diver_down/trace/session.rb +25 -1
- data/lib/diver_down/trace/tracer.rb +10 -1
- data/lib/diver_down/trace.rb +1 -5
- data/lib/diver_down/version.rb +1 -1
- data/web/assets/bundle.js +77 -78
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daf9083c911966538705b30bf44a609d38623c14f10bba3fc48782194d6bdba2
|
4
|
+
data.tar.gz: '0596dffb7428713e3daad2102f756d9b2396ca53b7c4200e8a873998493f4291'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39c405fc2f3a6c73f3e818275f42f16b938cbc7342fcf22a2391827268c8d3b395b3734686a6e0da3854936ac4b9c938c8ac11b1f050abc668fbbe36373865d1
|
7
|
+
data.tar.gz: 98e7070abeaa7f74a3c18c6e6528d23afd5fec87779378d8afc7cf0558b7a7e04dca8bdec7284658aff8884e4f99f9d79bbff22673af9e6cd2111eb1e55a1f50
|
@@ -46,6 +46,10 @@ module DiverDown
|
|
46
46
|
next if TracePoint == tp.defined_class
|
47
47
|
|
48
48
|
case tp.event
|
49
|
+
when :b_call
|
50
|
+
call_stack.push
|
51
|
+
when :b_return
|
52
|
+
call_stack.pop
|
49
53
|
when :call, :c_call
|
50
54
|
# puts "#{tp.method_id} #{tp.path}:#{tp.lineno}"
|
51
55
|
if call_stack.ignored?
|
@@ -66,7 +70,8 @@ module DiverDown
|
|
66
70
|
next
|
67
71
|
end
|
68
72
|
|
69
|
-
source_name =
|
73
|
+
source_name = normalize_module_name(mod, tp)
|
74
|
+
|
70
75
|
pushed = false
|
71
76
|
|
72
77
|
unless source_name.nil?
|
@@ -136,6 +141,25 @@ module DiverDown
|
|
136
141
|
|
137
142
|
nil
|
138
143
|
end
|
144
|
+
|
145
|
+
# Return nil if resolved module do not exist.
|
146
|
+
# Like an AnonymousController in rspec-rails.
|
147
|
+
def normalize_module_name(mod, tp)
|
148
|
+
normalized = nil
|
149
|
+
normalized ||= constantizable_source_name(DiverDown::Helper.normalize_module_name(mod)) if @module_set.include?(mod)
|
150
|
+
|
151
|
+
# NOTE: Only one anonymous class is traced back to support `AnonymousController` in rspec-rails, but it can be traced back further
|
152
|
+
normalized ||= constantizable_source_name(DiverDown::Helper.normalize_module_name(mod.superclass)) if DiverDown::Helper.class?(mod) && mod != DiverDown::Helper.resolve_module(tp.defined_class) && @module_set.include?(mod.superclass)
|
153
|
+
|
154
|
+
normalized
|
155
|
+
end
|
156
|
+
|
157
|
+
def constantizable_source_name(source_name)
|
158
|
+
DiverDown::Helper.constantize(source_name)
|
159
|
+
source_name
|
160
|
+
rescue NameError
|
161
|
+
nil
|
162
|
+
end
|
139
163
|
end
|
140
164
|
end
|
141
165
|
end
|
@@ -3,9 +3,18 @@
|
|
3
3
|
module DiverDown
|
4
4
|
module Trace
|
5
5
|
class Tracer
|
6
|
+
DEFAULT_TRACE_EVENTS = %i[
|
7
|
+
call
|
8
|
+
return
|
9
|
+
c_call
|
10
|
+
c_return
|
11
|
+
b_call
|
12
|
+
b_return
|
13
|
+
].freeze
|
14
|
+
|
6
15
|
# @return [Array<Symbol>]
|
7
16
|
def self.trace_events
|
8
|
-
@trace_events ||
|
17
|
+
@trace_events || DEFAULT_TRACE_EVENTS
|
9
18
|
end
|
10
19
|
|
11
20
|
# @param events [Array<Symbol>]
|
data/lib/diver_down/trace.rb
CHANGED
@@ -11,16 +11,12 @@ module DiverDown
|
|
11
11
|
require 'diver_down/trace/redefine_ruby_methods'
|
12
12
|
require 'diver_down/trace/ignored_method_ids'
|
13
13
|
|
14
|
-
@trace_events = %i[
|
15
|
-
call c_call return c_return
|
16
|
-
]
|
17
|
-
|
18
14
|
# Trace only Ruby-implemented methods because tracing C-implemented methods is very slow
|
19
15
|
# Override Ruby only with the minimal set of methods needed to trace dependencies.
|
20
16
|
#
|
21
17
|
# @return [void]
|
22
18
|
def self.trace_only_ruby_world!(map = DiverDown::Trace::RedefineRubyMethods::DEFAULT_METHODS)
|
23
|
-
DiverDown::Trace::Tracer.trace_events = %i[
|
19
|
+
DiverDown::Trace::Tracer.trace_events = DiverDown::Trace::Tracer::DEFAULT_TRACE_EVENTS - %i[c_call c_return]
|
24
20
|
DiverDown::Trace::RedefineRubyMethods.redefine_c_methods(map)
|
25
21
|
end
|
26
22
|
end
|
data/lib/diver_down/version.rb
CHANGED