google-cloud-debugger 0.41.0 → 0.42.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 +6 -0
- data/CONTRIBUTING.md +4 -4
- data/LOGGING.md +1 -1
- data/lib/google/cloud/debugger/agent.rb +4 -1
- data/lib/google/cloud/debugger/breakpoint.rb +1 -1
- data/lib/google/cloud/debugger/breakpoint/evaluator.rb +18 -24
- data/lib/google/cloud/debugger/breakpoint/source_location.rb +3 -3
- data/lib/google/cloud/debugger/breakpoint/variable.rb +3 -6
- data/lib/google/cloud/debugger/breakpoint/variable_table.rb +1 -1
- data/lib/google/cloud/debugger/middleware.rb +1 -1
- data/lib/google/cloud/debugger/rails.rb +2 -2
- data/lib/google/cloud/debugger/service.rb +4 -1
- data/lib/google/cloud/debugger/snappoint.rb +4 -7
- data/lib/google/cloud/debugger/transmitter.rb +1 -1
- data/lib/google/cloud/debugger/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6641a7f5f24131e179ea351efa4aa2e43950f3baa38f86c63b1bf61c50d759fc
|
4
|
+
data.tar.gz: e383ad2653c833c28698717bc767b3cb00041214022881c2665e2e0833dbfa4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8db05c08b17b71ac1bac193acaaa6a00b14b5e17dc2ebdbae52a9d4b1a6a942142d211bf55c0b5e4870f631e417b279ae84e70d950e533cfb8f21b337682cbd9
|
7
|
+
data.tar.gz: 0d255e9ed3e4539f98df8b1d9753951bd0f5a5002135afa5ac0177966ad9ade22fe73124146c8070efc2f026bdb66bfe9d1d70caf7ff363f4bd9e1b46b0a906b
|
data/CHANGELOG.md
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -24,9 +24,9 @@ be able to accept your pull requests.
|
|
24
24
|
In order to use the google-cloud-debugger console and run the project's tests,
|
25
25
|
there is a small amount of setup:
|
26
26
|
|
27
|
-
1. Install Ruby. google-cloud-debugger requires Ruby 2.
|
28
|
-
manage your Ruby and gem installations
|
29
|
-
[rbenv](https://github.com/rbenv/rbenv), or
|
27
|
+
1. Install Ruby. google-cloud-debugger requires Ruby 2.5+. It is not currently
|
28
|
+
supported on Ruby 3. You may choose to manage your Ruby and gem installations
|
29
|
+
with [RVM](https://rvm.io/), [rbenv](https://github.com/rbenv/rbenv), or
|
30
30
|
[chruby](https://github.com/postmodern/chruby).
|
31
31
|
|
32
32
|
2. Install [Bundler](http://bundler.io/).
|
@@ -45,7 +45,7 @@ there is a small amount of setup:
|
|
45
45
|
|
46
46
|
```sh
|
47
47
|
$ cd google-cloud-debugger/
|
48
|
-
$ bundle
|
48
|
+
$ bundle install
|
49
49
|
```
|
50
50
|
|
51
51
|
## Console
|
data/LOGGING.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
To enable logging for this library, set the logger for the underlying
|
4
4
|
[gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger
|
5
5
|
that you set may be a Ruby stdlib
|
6
|
-
[`Logger`](https://ruby-doc.org/stdlib
|
6
|
+
[`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as
|
7
7
|
shown below, or a
|
8
8
|
[`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
9
9
|
that will write logs to [Stackdriver
|
@@ -120,7 +120,10 @@ module Google
|
|
120
120
|
# @param [String] app_root Absolute path to the root directory of
|
121
121
|
# the debuggee application. Default to Rack root.
|
122
122
|
#
|
123
|
-
def initialize service,
|
123
|
+
def initialize service,
|
124
|
+
service_name:,
|
125
|
+
service_version:,
|
126
|
+
logger: nil,
|
124
127
|
app_root: nil
|
125
128
|
super()
|
126
129
|
|
@@ -849,20 +849,18 @@ module Google
|
|
849
849
|
# do evaluation in a new thread, where function calls can be
|
850
850
|
# traced.
|
851
851
|
thr = Thread.new do
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
)
|
862
|
-
end
|
863
|
-
|
864
|
-
e
|
852
|
+
Thread.current.thread_variable_set EVALUATOR_REFERENCE, self
|
853
|
+
binding.eval wrap_expression(expression)
|
854
|
+
rescue StandardError, EvaluationError => e
|
855
|
+
# Treat all StandardError as mutation and set @mutation_cause
|
856
|
+
unless e.instance_variable_get :@mutation_cause
|
857
|
+
e.instance_variable_set(
|
858
|
+
:@mutation_cause,
|
859
|
+
Google::Cloud::Debugger::EvaluationError::UNKNOWN_CAUSE
|
860
|
+
)
|
865
861
|
end
|
862
|
+
|
863
|
+
e
|
866
864
|
end
|
867
865
|
|
868
866
|
thr.join @time_limit
|
@@ -942,7 +940,7 @@ module Google
|
|
942
940
|
##
|
943
941
|
# @private Wraps expression with tracing code
|
944
942
|
def wrap_expression expression
|
945
|
-
|
943
|
+
<<~CODE
|
946
944
|
begin
|
947
945
|
::Google::Cloud::Debugger::Breakpoint::Evaluator.send(
|
948
946
|
:enable_method_trace_for_thread)
|
@@ -951,11 +949,9 @@ module Google
|
|
951
949
|
::Google::Cloud::Debugger::Breakpoint::Evaluator.send(
|
952
950
|
:disable_method_trace_for_thread)
|
953
951
|
end
|
954
|
-
|
952
|
+
CODE
|
955
953
|
end
|
956
954
|
|
957
|
-
# rubocop:disable Layout/RescueEnsureAlignment
|
958
|
-
|
959
955
|
##
|
960
956
|
# @private Evaluation tracing callback function. This is called
|
961
957
|
# everytime a Ruby function is called during evaluation of
|
@@ -994,8 +990,6 @@ module Google
|
|
994
990
|
)
|
995
991
|
end
|
996
992
|
|
997
|
-
# rubocop:enable Layout/RescueEnsureAlignment
|
998
|
-
|
999
993
|
##
|
1000
994
|
# @private Evaluation tracing callback function. This is called
|
1001
995
|
# everytime a C function is called during evaluation of
|
@@ -1011,12 +1005,12 @@ module Google
|
|
1011
1005
|
#
|
1012
1006
|
def trace_c_func_callback receiver, defined_class, mid
|
1013
1007
|
return if @allow_mutating_methods
|
1014
|
-
|
1015
|
-
|
1008
|
+
invalid_op =
|
1009
|
+
if receiver.is_a?(Class) || receiver.is_a?(Module)
|
1016
1010
|
!validate_c_class_method(defined_class, receiver, mid)
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1011
|
+
else
|
1012
|
+
!validate_c_instance_method(defined_class, mid)
|
1013
|
+
end
|
1020
1014
|
|
1021
1015
|
return unless invalid_op
|
1022
1016
|
|
@@ -37,7 +37,8 @@ module Google
|
|
37
37
|
|
38
38
|
##
|
39
39
|
# @private Create an empty SourceLocation object.
|
40
|
-
def initialize
|
40
|
+
def initialize
|
41
|
+
end
|
41
42
|
|
42
43
|
##
|
43
44
|
# @private New Google::Cloud::Debugger::Breakpoint::SourceLocation
|
@@ -53,8 +54,7 @@ module Google
|
|
53
54
|
##
|
54
55
|
# @private Determines if the SourceLocation has any data.
|
55
56
|
def empty?
|
56
|
-
path.nil? &&
|
57
|
-
line.nil?
|
57
|
+
path.nil? && line.nil?
|
58
58
|
end
|
59
59
|
|
60
60
|
##
|
@@ -244,7 +244,7 @@ module Google
|
|
244
244
|
|
245
245
|
# If source is a non-empty Array or Hash, or source has instance
|
246
246
|
# variables, evaluate source as a compound variable.
|
247
|
-
if compound_var?(source) && depth
|
247
|
+
if compound_var?(source) && depth.positive?
|
248
248
|
from_compound_var source, name: name, depth: depth,
|
249
249
|
var_table: var_table, limit: limit
|
250
250
|
else
|
@@ -358,9 +358,7 @@ module Google
|
|
358
358
|
|
359
359
|
limit = deduct_limit limit, member_var.total_size
|
360
360
|
|
361
|
-
buffer_full =
|
362
|
-
i >= MAX_MEMBERS ||
|
363
|
-
member_var.buffer_full_variable?
|
361
|
+
buffer_full = limit&.negative? || i >= MAX_MEMBERS || member_var.buffer_full_variable?
|
364
362
|
|
365
363
|
if buffer_full
|
366
364
|
var.members << Variable.new.tap do |last_var|
|
@@ -384,8 +382,7 @@ module Google
|
|
384
382
|
new.tap do |var|
|
385
383
|
var.name = name if name
|
386
384
|
|
387
|
-
if var_table
|
388
|
-
var_table.first.buffer_full_variable?
|
385
|
+
if var_table&.first&.buffer_full_variable?
|
389
386
|
var.var_table = var_table
|
390
387
|
var.var_table_index = 0
|
391
388
|
else
|
@@ -154,7 +154,7 @@ module Google
|
|
154
154
|
@debugger.agent.tracer.disable_traces_for_thread
|
155
155
|
|
156
156
|
# Reset quotas after each request finishes.
|
157
|
-
@debugger.agent.quota_manager
|
157
|
+
@debugger.agent.quota_manager&.reset
|
158
158
|
end
|
159
159
|
|
160
160
|
private
|
@@ -151,13 +151,13 @@ module Google
|
|
151
151
|
Debugger::Credentials.new credentials
|
152
152
|
end
|
153
153
|
rescue StandardError => e
|
154
|
-
|
154
|
+
$stdout.puts "Note: Google::Cloud::Debugger is disabled because " \
|
155
155
|
"it failed to authorize with the service. (#{e.message})"
|
156
156
|
return false
|
157
157
|
end
|
158
158
|
|
159
159
|
if project_id.to_s.empty?
|
160
|
-
|
160
|
+
$stdout.puts "Note: Google::Cloud::Debugger is disabled because " \
|
161
161
|
"the project ID could not be determined."
|
162
162
|
return false
|
163
163
|
end
|
@@ -25,7 +25,10 @@ module Google
|
|
25
25
|
# @private Represents the gRPC Debugger service, including all the API
|
26
26
|
# methods.
|
27
27
|
class Service
|
28
|
-
attr_accessor :project
|
28
|
+
attr_accessor :project
|
29
|
+
attr_accessor :credentials
|
30
|
+
attr_accessor :timeout
|
31
|
+
attr_accessor :host
|
29
32
|
|
30
33
|
##
|
31
34
|
# Creates a new Service instance.
|
@@ -33,11 +33,11 @@ module Google
|
|
33
33
|
|
34
34
|
##
|
35
35
|
# Max size of payload a Snappoint collects
|
36
|
-
MAX_PAYLOAD_SIZE =
|
36
|
+
MAX_PAYLOAD_SIZE = 32_768 # 32KB
|
37
37
|
|
38
38
|
##
|
39
39
|
# @private Max size an evaluated expression variable is allowed to be
|
40
|
-
MAX_EXPRESSION_LIMIT =
|
40
|
+
MAX_EXPRESSION_LIMIT = 32_768 # 32KB
|
41
41
|
|
42
42
|
##
|
43
43
|
# @private Max size a normal evaluated variable is allowed to be
|
@@ -56,8 +56,7 @@ module Google
|
|
56
56
|
# variable at index 0. This variable will be shared by other variable
|
57
57
|
# evaluations if this Snappoint exceeds size limit.
|
58
58
|
def init_var_table
|
59
|
-
return if @variable_table[0]
|
60
|
-
@variable_table[0].buffer_full_variable?
|
59
|
+
return if @variable_table[0]&.buffer_full_variable?
|
61
60
|
|
62
61
|
buffer_full_var = Variable.buffer_full_variable
|
63
62
|
@variable_table.variables.unshift buffer_full_var
|
@@ -179,11 +178,9 @@ module Google
|
|
179
178
|
end
|
180
179
|
end
|
181
180
|
|
182
|
-
|
181
|
+
variable_table.variables.inject result do |sum, var|
|
183
182
|
sum + var.payload_size
|
184
183
|
end
|
185
|
-
|
186
|
-
result
|
187
184
|
end
|
188
185
|
|
189
186
|
##
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-debugger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.42.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heng Xiong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: binding_of_caller
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: 1.25.1
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
110
|
+
version: 1.25.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: minitest
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -337,16 +337,16 @@ require_paths:
|
|
337
337
|
- lib
|
338
338
|
required_ruby_version: !ruby/object:Gem::Requirement
|
339
339
|
requirements:
|
340
|
-
- - "
|
340
|
+
- - "~>"
|
341
341
|
- !ruby/object:Gem::Version
|
342
|
-
version: '2.
|
342
|
+
version: '2.5'
|
343
343
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
344
344
|
requirements:
|
345
345
|
- - ">="
|
346
346
|
- !ruby/object:Gem::Version
|
347
347
|
version: '0'
|
348
348
|
requirements: []
|
349
|
-
rubygems_version: 3.
|
349
|
+
rubygems_version: 3.2.13
|
350
350
|
signing_key:
|
351
351
|
specification_version: 4
|
352
352
|
summary: API Client and instrumentation library for Stackdriver Debugger
|