trace_tree 0.3.4 → 0.3.5

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: cc09963c20ff9fa2325a140cdba7f52a365a86e6345c91c0b73ed7e84954da88
4
- data.tar.gz: b4fc0967633be32701de2ae30fffe7c5d96d010a061f3885cda766ea893db261
3
+ metadata.gz: bd2acac6d571e0747380b7a119f10ceae8b047677da86922aacf86d61f230e1e
4
+ data.tar.gz: 9f99a54c748d8e36b92e11dba833e7059da16ee5fa486412e5c70c35c2186ffc
5
5
  SHA512:
6
- metadata.gz: 39a369877af219019c3bdf138733c265a69f20af06661c3c84fcc529b78e75e9e3007eac211755cbecd1c79eab33bfa2c32ec5d84cddc1f9c2d6d283c928b5eb
7
- data.tar.gz: 7ecbd1ecc5e2ecc2fafadefa02a41482bbed8e44790fc6f41b6aa1ba72e01b9e79f8e75141824ff4a99d52d6c7168fe8918898b9626f87031912c065389f6eb5
6
+ metadata.gz: 7597b9d86bf09817082dbdec9dd31a7a18f80afda328b437d7b7d023ff8e77983e09399e53e2d7f6e8026f13100aac29a48feecfd98ad1fc1319389ffeda7eb9
7
+ data.tar.gz: a69bef456553b83d05d749973c8e923080708bd27a3793b2639b13869f44932fbb85589a52c0695790ff9661043c7bfa55de9db0cc211521cebef7a7fbf6804a
@@ -3,7 +3,7 @@ class TraceTree
3
3
  class CcallKernelExtend < Point
4
4
  def parameters
5
5
  first_callee = callees[0]
6
- first_callee.respond_to?(:mixin) ? first_callee.mixin : first_callee.current.klass
6
+ first_callee.respond_to?(:mixin) ? first_callee.mixin : first_callee.class_name
7
7
  end
8
8
 
9
9
  def self.event_class_method
@@ -9,7 +9,7 @@ class TraceTree
9
9
  # first callee should be append_features(), check if it is native or custom
10
10
  def parameters
11
11
  first_callee = callees[0]
12
- Module == first_callee.class_name ? first_callee.return_value : first_callee.current.klass
12
+ Module == first_callee.class_name ? first_callee.return_value : first_callee.class_name
13
13
  end
14
14
 
15
15
  end
@@ -8,7 +8,7 @@ class TraceTree
8
8
 
9
9
  def parameters
10
10
  first_callee = callees[0]
11
- Module == first_callee.class_name ? first_callee.return_value : first_callee.current.klass
11
+ Module == first_callee.class_name ? first_callee.return_value : first_callee.class_name
12
12
  end
13
13
 
14
14
  end
@@ -7,7 +7,8 @@ class TraceTree
7
7
  include TreeGraphable
8
8
  include TreeHtmlable
9
9
 
10
- attr_reader :current, :thread, :frame_env
10
+ attr_reader :thread, :frame_env
11
+ attr_reader :call_symbol, :class_name
11
12
  attr_accessor :terminal, :config
12
13
 
13
14
  Interfaces = [:event, :defined_class, :method_id, :path, :lineno]
@@ -73,24 +74,31 @@ EOM
73
74
 
74
75
  @return_value = trace_point.return_value if x_return?
75
76
  @thread = Thread.current
77
+ return if thread?
76
78
 
77
- unless thread?
78
- there = trace_point.binding.of_caller(3)
79
- @current = BindingOfCallers::Revealed.new there
80
- @frame_env = current.frame_env.to_sym
79
+ if event == :c_call || event == :c_return
80
+ @call_symbol = '#'
81
+ @frame_env = method_id
82
+ @class_name = defined_class
83
+ return
81
84
  end
85
+
86
+ there = trace_point.binding.of_caller(3)
87
+ current = BindingOfCallers::Revealed.new there
88
+ @call_symbol = current.call_symbol
89
+ @frame_env = current.frame_env.to_sym
90
+ @class_name = current.klass
82
91
  rescue => e
83
- puts e
92
+ puts e.message
93
+ puts(Interfaces.each_with_object({}){|attr, h| h[attr] = send(attr)})
94
+ puts e.backtrace
95
+ raise e
84
96
  end
85
97
 
86
98
  def b_call?
87
99
  event == :b_call
88
100
  end
89
101
 
90
- def c_call?
91
- event == :c_call
92
- end
93
-
94
102
  def class?
95
103
  event == :class
96
104
  end
@@ -157,22 +165,12 @@ EOM
157
165
  @km ||= "#{class_name}#{call_symbol}#{method_name}"
158
166
  end
159
167
 
160
- def class_name
161
- c_call? ? defined_class : current.klass
162
- rescue
163
- puts event
164
- end
165
-
166
168
  def method_name
167
- return method_id if c_call?
169
+ return method_id if event == :c_call
168
170
  return frame_env if b_call? || class?
169
171
  (method_id == frame_env) ? method_id : "#{method_id} -> #{frame_env}"
170
172
  end
171
173
 
172
- def call_symbol
173
- c_call? ? '#' : current.call_symbol
174
- end
175
-
176
174
  def source_location
177
175
  "#{path}:#{lineno}"
178
176
  end
@@ -182,7 +180,6 @@ EOM
182
180
  end
183
181
 
184
182
  class Loader
185
-
186
183
  attr_reader :point_classes, :config
187
184
 
188
185
  def initialize *enhancement, config
@@ -1,3 +1,3 @@
1
1
  class TraceTree
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
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.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-19 00:00:00.000000000 Z
11
+ date: 2023-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler