appmap 0.84.0 → 0.85.0
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/CHANGELOG.md +7 -0
- data/lib/appmap/builtin_hooks/activesupport.yml +3 -1
- data/lib/appmap/builtin_hooks/ruby.yml +4 -0
- data/lib/appmap/event.rb +3 -3
- data/lib/appmap/handler/eval_handler.rb +19 -0
- data/lib/appmap/handler/marshal_load_handler.rb +18 -0
- data/lib/appmap/version.rb +1 -1
- 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: 002b026a3ee8b2e89a073906212e694f296dcc0666db8450c9051bab372550b2
|
4
|
+
data.tar.gz: 743adc87f3f3ae044c7da5d3040be48f79db21bf5d9861b60ec32f84ba39bc19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6af49c4b8155df95b38edf948217eedfa785151c7d3b6997cee8f0ba5971444c755a1e189a12fffdd640e1ec7e12316bd3a5e70d82e047d1dba4c2873040e5a1
|
7
|
+
data.tar.gz: e5af21dd5198c5291cdcd8da036b54c31c59178c17ccda863e4653aab7efb9a5392325226f90ef973f99107d8a44d24870dab3417d6b50c001ae4d325f50f30a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [0.85.0](https://github.com/applandinc/appmap-ruby/compare/v0.84.0...v0.85.0) (2022-08-08)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* Tune method parameters ([4a7b575](https://github.com/applandinc/appmap-ruby/commit/4a7b575e6f9684adaac4b592adc1ad2c832e900d))
|
7
|
+
|
1
8
|
# [0.84.0](https://github.com/applandinc/appmap-ruby/compare/v0.83.6...v0.84.0) (2022-08-04)
|
2
9
|
|
3
10
|
|
@@ -11,7 +11,9 @@
|
|
11
11
|
require_name: active_support/security_utils
|
12
12
|
force: true
|
13
13
|
- method: ActiveSupport.run_load_hooks
|
14
|
-
|
14
|
+
labels:
|
15
|
+
- deserialize.safe
|
16
|
+
- lang.eval.safe
|
15
17
|
require_name: active_support/lazy_load_hooks
|
16
18
|
force: true
|
17
19
|
- method: ActiveSupport::MessageEncryptor#encrypt_and_sign
|
@@ -2,6 +2,7 @@
|
|
2
2
|
- Marshal#load
|
3
3
|
- Marshal#restore
|
4
4
|
require_name: ruby
|
5
|
+
handler_class: AppMap::Handler::MarshalLoadHandler
|
5
6
|
label: deserialize.unsafe
|
6
7
|
- method: Marshal#dump
|
7
8
|
require_name: ruby
|
@@ -29,3 +30,6 @@
|
|
29
30
|
- Process#spawn
|
30
31
|
require_name: ruby
|
31
32
|
label: system.exec
|
33
|
+
- methods:
|
34
|
+
- ERB#result
|
35
|
+
require_name: ruby
|
data/lib/appmap/event.rb
CHANGED
@@ -193,7 +193,7 @@ module AppMap
|
|
193
193
|
|
194
194
|
public
|
195
195
|
|
196
|
-
def build_from_invocation(defined_class, method, receiver, arguments, event: MethodCall.new)
|
196
|
+
def build_from_invocation(defined_class, method, receiver, arguments, parameters: method.parameters, event: MethodCall.new)
|
197
197
|
event ||= MethodCall.new
|
198
198
|
defined_class ||= 'Class'
|
199
199
|
|
@@ -208,10 +208,10 @@ module AppMap
|
|
208
208
|
|
209
209
|
# Check if the method has key parameters. If there are any they'll always be last.
|
210
210
|
# If yes, then extract it from arguments.
|
211
|
-
has_key = [[:dummy], *
|
211
|
+
has_key = [[:dummy], *parameters].last.first.to_s.start_with?('key') && arguments[-1].is_a?(Hash)
|
212
212
|
kwargs = has_key && arguments[-1].dup || {}
|
213
213
|
|
214
|
-
event.parameters =
|
214
|
+
event.parameters = parameters.map.with_index do |method_param, idx|
|
215
215
|
param_type, param_name = method_param
|
216
216
|
param_name ||= 'arg'
|
217
217
|
value = case param_type
|
@@ -23,6 +23,21 @@ module AppMap
|
|
23
23
|
# To avoid this, we explicitly substitute the correct execution
|
24
24
|
# context, up several stack frames.
|
25
25
|
class EvalHandler < FunctionHandler
|
26
|
+
# Kernel#eval reports the method parameters as :rest, instead of what you might expect from
|
27
|
+
# the documented signature: eval(string [, binding [, filename [,lineno]]])
|
28
|
+
# In the C code, it's defined as rb_f_eval(int argc, const VALUE *argv, VALUE self),
|
29
|
+
# so maybe that's why the parameters are reported as :rest.
|
30
|
+
#
|
31
|
+
# In any case, reporting the parameters as :rest means that the code string, binding, etc
|
32
|
+
# are reported in the AppMap as members of an Array, without individual object ids or types.
|
33
|
+
#
|
34
|
+
# To make eval easier to analyze, fake the hook_method parameters to better match
|
35
|
+
# the documentation.
|
36
|
+
PARAMETERS= [
|
37
|
+
[ :req, :string ],
|
38
|
+
[ :rest ],
|
39
|
+
]
|
40
|
+
|
26
41
|
# The depth of the frame we need to pluck out:
|
27
42
|
# 1. Hook::Method#do_call
|
28
43
|
# 2. Hook::Method#trace_call
|
@@ -31,6 +46,10 @@ module AppMap
|
|
31
46
|
# 5. the (intended) frame of the original eval that we hooked
|
32
47
|
# Note it needs to be adjusted if this call sequence changes.
|
33
48
|
FRAME_DEPTH = 5
|
49
|
+
|
50
|
+
def handle_call(receiver, args)
|
51
|
+
AppMap::Event::MethodCall.build_from_invocation(defined_class, hook_method, receiver, args, parameters: PARAMETERS)
|
52
|
+
end
|
34
53
|
|
35
54
|
def do_call(receiver, src = nil, context = nil, *rest)
|
36
55
|
context ||= AppMap.caller_binding FRAME_DEPTH
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'appmap/handler/function_handler'
|
4
|
+
|
5
|
+
module AppMap
|
6
|
+
module Handler
|
7
|
+
class MarshalLoadHandler < FunctionHandler
|
8
|
+
PARAMETERS= [
|
9
|
+
[ :req, :source ],
|
10
|
+
[ :rest ],
|
11
|
+
]
|
12
|
+
|
13
|
+
def handle_call(receiver, args)
|
14
|
+
AppMap::Event::MethodCall.build_from_invocation(defined_class, hook_method, receiver, args, parameters: PARAMETERS)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/appmap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.85.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|
@@ -396,6 +396,7 @@ files:
|
|
396
396
|
- lib/appmap/handler.rb
|
397
397
|
- lib/appmap/handler/eval_handler.rb
|
398
398
|
- lib/appmap/handler/function_handler.rb
|
399
|
+
- lib/appmap/handler/marshal_load_handler.rb
|
399
400
|
- lib/appmap/handler/net_http_handler.rb
|
400
401
|
- lib/appmap/handler/open_ssl_handler.rb
|
401
402
|
- lib/appmap/handler/rails/render_handler.rb
|