trace_tree 0.2.14 → 0.2.15
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/README.md +1 -0
- data/lib/trace_tree/point/omit.rb +22 -0
- data/lib/trace_tree/version.rb +1 -1
- data/lib/trace_tree.rb +42 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '049be0b5875c06742a76fbc283f9a124f20fd574d5bdc529e5f5094181997ebe'
|
4
|
+
data.tar.gz: 7e98c2c3cffc65244f69873d41a1925af401e5c02aee917046eef611f87b4aba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c297f28ffe610ddbf6e920350f9ba76f86ff1561b600775d59921d26e83abf1332a65d084be21252e7e93d71c58284738373b2051698404379951ee19916573
|
7
|
+
data.tar.gz: a35991a7ebd980020a5c82b42d2c0da53b9b4d25b6617d77979d148fff3d7257fed9b2fd3f264bf7fc19b3e5863b243960c3006878a198bbbaa933481d90d98b
|
data/README.md
CHANGED
@@ -55,6 +55,7 @@ end
|
|
55
55
|
* `:return => true` by default. It stores return values of functions in generated html. Hover function call and press `r` to print return value in console.
|
56
56
|
* `:args => false` by default. Set it true to puts arguments of `:call` functions into html. Since arguments are always return values of other functions, so this option is not necessary.
|
57
57
|
* `:in => //, :out => nil` by default. Give them regexp(s) to include/exclude methods defined in files match that regexp(s). Notice thread-calls and methods defined by `define_method` are always included. Also, once you set any of these two options, the code to trace should not be in same line with `binding.trace_tree() do`.
|
58
|
+
* `:no_methods => nil` by defalut. Give it regexp(s) to hide stack under matching methods. Useful when you want to dump stack of a rack middleware but lower middlewares.
|
58
59
|
* `:timer => nil` by default. Set it true if you want to know how much time spent in tracing and drawing tree. Notice the `file` should be appendable, otherwise the time will overwrite the tree.
|
59
60
|
* `:debug => nil` by default. Give it somthing like what for `:tmp` to output a whole list of TracePoints in file for debug.
|
60
61
|
|
data/lib/trace_tree/version.rb
CHANGED
data/lib/trace_tree.rb
CHANGED
@@ -96,21 +96,56 @@ class TraceTree
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def make_filter
|
99
|
-
|
99
|
+
filters = []
|
100
|
+
|
101
|
+
if opt.key?(:in)
|
102
|
+
@in = Array(opt[:in] || //)
|
103
|
+
filters << '@in.any?{ |pattern| pattern =~ point.path }'
|
104
|
+
end
|
105
|
+
|
106
|
+
if opt.key?(:out)
|
107
|
+
@out = Array(opt[:out])
|
108
|
+
filters << '@out.all?{ |pattern| pattern !~ point.path }'
|
109
|
+
end
|
110
|
+
|
111
|
+
if opt.key?(:no_methods)
|
112
|
+
@no_methods = Array(opt[:no_methods])
|
113
|
+
filters << 'outside_hidden_stack?(point)'
|
114
|
+
end
|
115
|
+
|
116
|
+
if filters.empty?
|
100
117
|
return @deal = -> point { trace_points << point_loader.create(point) }
|
101
118
|
end
|
102
|
-
|
119
|
+
|
120
|
+
self.singleton_class.class_eval <<-EOM
|
121
|
+
def wanted? point
|
122
|
+
return false if point.end_of_trace?
|
123
|
+
return true if native?(point) || point.thread_relative? || point.method_defined_by_define_method?
|
124
|
+
#{filters.join(' && ')}
|
125
|
+
end
|
126
|
+
EOM
|
127
|
+
|
103
128
|
@deal = -> point do
|
104
129
|
po = point_loader.create(point)
|
105
130
|
trace_points << po if wanted? po
|
106
131
|
end
|
107
132
|
end
|
108
133
|
|
109
|
-
def
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
134
|
+
def outside_hidden_stack? point
|
135
|
+
stack = (point.thread[:trace_tree_no_methods_stack] ||= [])
|
136
|
+
empty = stack.empty?
|
137
|
+
|
138
|
+
if @no_methods.any?{ |pattern| pattern =~ point.method_name }
|
139
|
+
if !empty && point.terminate?(stack.last)
|
140
|
+
stack.pop
|
141
|
+
else
|
142
|
+
stack << point
|
143
|
+
point << Point::Omitted.new
|
144
|
+
end
|
145
|
+
return true
|
146
|
+
end
|
147
|
+
|
148
|
+
empty
|
114
149
|
end
|
115
150
|
|
116
151
|
def native? point
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trace_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- lib/trace_tree/point/creturn_module_extendobject.rb
|
168
168
|
- lib/trace_tree/point/creturn_module_prependfeatures.rb
|
169
169
|
- lib/trace_tree/point/creturn_thread_initialize.rb
|
170
|
+
- lib/trace_tree/point/omit.rb
|
170
171
|
- lib/trace_tree/point/threadbegin.rb
|
171
172
|
- lib/trace_tree/point/threadend.rb
|
172
173
|
- lib/trace_tree/return_value.rb
|