trace_tree 0.1.5 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +308 -114
- data/lib/trace_tree/point/call_activesupportconcern_appendfeatures.rb +17 -0
- data/lib/trace_tree/point/call_modulemutexm_extendobject.rb +17 -0
- data/lib/trace_tree/point/ccall_classthread_new.rb +11 -0
- data/lib/trace_tree/point/ccall_kernel_extend.rb +14 -0
- data/lib/trace_tree/point/ccall_module_appendfeatures.rb +15 -0
- data/lib/trace_tree/point/ccall_module_extendobject.rb +15 -0
- data/lib/trace_tree/point/ccall_module_include.rb +15 -0
- data/lib/trace_tree/point/ccall_module_prepend.rb +15 -0
- data/lib/trace_tree/point/ccall_module_prependfeatures.rb +15 -0
- data/lib/trace_tree/point/ccall_thread_initialize.rb +15 -0
- data/lib/trace_tree/point/common.rb +10 -0
- data/lib/trace_tree/point/creturn_classthread_new.rb +11 -0
- data/lib/trace_tree/point/creturn_module_appendfeatures.rb +11 -0
- data/lib/trace_tree/point/creturn_module_extendobject.rb +18 -0
- data/lib/trace_tree/point/creturn_module_prependfeatures.rb +11 -0
- data/lib/trace_tree/point/creturn_thread_initialize.rb +12 -0
- data/lib/trace_tree/point/threadbegin.rb +23 -0
- data/lib/trace_tree/point/threadend.rb +22 -0
- data/lib/trace_tree/point.rb +168 -0
- data/lib/trace_tree/short_gem_path.rb +3 -1
- data/lib/trace_tree/tree_graphable.rb +2 -0
- data/lib/trace_tree/version.rb +1 -1
- data/lib/trace_tree.rb +70 -32
- data/trace_tree.gemspec +3 -1
- metadata +51 -5
- data/lib/trace_tree/node.rb +0 -85
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.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,34 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.1.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activesupport
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 5.0.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 5.0.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: terminal-tableofhashes
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.1.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.1.0
|
97
125
|
description:
|
98
126
|
email:
|
99
127
|
- block24block@gmail.com
|
@@ -113,7 +141,25 @@ files:
|
|
113
141
|
- lib/trace_tree.rb
|
114
142
|
- lib/trace_tree/color.rb
|
115
143
|
- lib/trace_tree/gem_paths.rb
|
116
|
-
- lib/trace_tree/
|
144
|
+
- lib/trace_tree/point.rb
|
145
|
+
- lib/trace_tree/point/call_activesupportconcern_appendfeatures.rb
|
146
|
+
- lib/trace_tree/point/call_modulemutexm_extendobject.rb
|
147
|
+
- lib/trace_tree/point/ccall_classthread_new.rb
|
148
|
+
- lib/trace_tree/point/ccall_kernel_extend.rb
|
149
|
+
- lib/trace_tree/point/ccall_module_appendfeatures.rb
|
150
|
+
- lib/trace_tree/point/ccall_module_extendobject.rb
|
151
|
+
- lib/trace_tree/point/ccall_module_include.rb
|
152
|
+
- lib/trace_tree/point/ccall_module_prepend.rb
|
153
|
+
- lib/trace_tree/point/ccall_module_prependfeatures.rb
|
154
|
+
- lib/trace_tree/point/ccall_thread_initialize.rb
|
155
|
+
- lib/trace_tree/point/common.rb
|
156
|
+
- lib/trace_tree/point/creturn_classthread_new.rb
|
157
|
+
- lib/trace_tree/point/creturn_module_appendfeatures.rb
|
158
|
+
- lib/trace_tree/point/creturn_module_extendobject.rb
|
159
|
+
- lib/trace_tree/point/creturn_module_prependfeatures.rb
|
160
|
+
- lib/trace_tree/point/creturn_thread_initialize.rb
|
161
|
+
- lib/trace_tree/point/threadbegin.rb
|
162
|
+
- lib/trace_tree/point/threadend.rb
|
117
163
|
- lib/trace_tree/short_gem_path.rb
|
118
164
|
- lib/trace_tree/timer.rb
|
119
165
|
- lib/trace_tree/tmp_file.rb
|
@@ -144,6 +190,6 @@ rubyforge_project:
|
|
144
190
|
rubygems_version: 2.6.8
|
145
191
|
signing_key:
|
146
192
|
specification_version: 4
|
147
|
-
summary: Print TracePoint(
|
148
|
-
tree
|
193
|
+
summary: Print TracePoint(:b_call, :b_return, :c_call, :c_return, :call, :return,
|
194
|
+
:class, :end, :thread_begin, :thread_end) in tree view, to console or html
|
149
195
|
test_files: []
|
data/lib/trace_tree/node.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'trace_tree/tree_graphable'
|
2
|
-
require 'trace_tree/tree_htmlable'
|
3
|
-
|
4
|
-
class TraceTree
|
5
|
-
class Node
|
6
|
-
|
7
|
-
include TreeGraphable
|
8
|
-
include TreeHtmlable
|
9
|
-
|
10
|
-
attr_reader :bindings
|
11
|
-
|
12
|
-
def initialize trace_point
|
13
|
-
@event = trace_point.event
|
14
|
-
@method_id = trace_point.method_id
|
15
|
-
@bindings = filter_call_stack trace_point.binding.of_callers
|
16
|
-
end
|
17
|
-
|
18
|
-
def << node
|
19
|
-
callees << node
|
20
|
-
end
|
21
|
-
|
22
|
-
def callees
|
23
|
-
@callees ||= []
|
24
|
-
end
|
25
|
-
|
26
|
-
def whole_stack
|
27
|
-
bindings.map{|b| location_without_lineno b}
|
28
|
-
end
|
29
|
-
|
30
|
-
def parent_stack
|
31
|
-
range = (raise_event? ? bindings : bindings[1..-1])
|
32
|
-
range.map{|b| location_without_lineno b}
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def location_without_lineno bi
|
38
|
-
[bi.klass, bi.call_symbol, bi.frame_env, bi.file]
|
39
|
-
end
|
40
|
-
|
41
|
-
def filter_call_stack bindings
|
42
|
-
bindings = bindings[2..-1]
|
43
|
-
bindings = callees_of_binding_trace_tree bindings
|
44
|
-
bindings = bindings.reject{|b| b.frame_env =~ /^rescue\sin\s/}
|
45
|
-
bindings.unshift bindings.first if throw_event?
|
46
|
-
bindings
|
47
|
-
end
|
48
|
-
|
49
|
-
def callees_of_binding_trace_tree bindings
|
50
|
-
bs = []
|
51
|
-
bindings.each do |b|
|
52
|
-
break if "#{b.klass}#{b.call_symbol}#{b.frame_env}" == "Binding#trace_tree"
|
53
|
-
bs << b
|
54
|
-
end
|
55
|
-
bs
|
56
|
-
end
|
57
|
-
|
58
|
-
def class_and_method
|
59
|
-
"#{event_indicator}#{current.klass}#{current.call_symbol}#{current.frame_env}"
|
60
|
-
end
|
61
|
-
|
62
|
-
def source_location
|
63
|
-
"#{current.file}:#{current.line}"
|
64
|
-
end
|
65
|
-
|
66
|
-
def current
|
67
|
-
bindings[0]
|
68
|
-
end
|
69
|
-
|
70
|
-
def raise_event?
|
71
|
-
@event == :raise
|
72
|
-
end
|
73
|
-
|
74
|
-
def throw_event?
|
75
|
-
@event == :c_call and :throw == @method_id
|
76
|
-
end
|
77
|
-
|
78
|
-
def event_indicator
|
79
|
-
return 'raise in ' if raise_event?
|
80
|
-
return 'throw in ' if throw_event?
|
81
|
-
return ''
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|