@@ -160,6 +160,9 @@ def print_string(string)
160
160
end
161
161
162
162
def exec_with_allocation_control ( value , memory_limit , time_limit , exec_method , return_message_if_overflow )
163
+ if ( defined? ( JRUBY_VERSION ) || ENV [ 'DEBUGGER_MEMORY_LIMIT' ] . to_i <= 0 )
164
+ return value . send exec_method
165
+ end
163
166
curr_thread = Thread . current
164
167
result = nil
165
168
inspect_thread = DebugThread . start {
@@ -217,11 +220,7 @@ def print_variable(name, value, kind)
217
220
else
218
221
has_children = !value . instance_variables . empty? || !value . class . class_variables . empty?
219
222
220
- value_str = if ( defined? ( JRUBY_VERSION ) || ENV [ 'DEBUGGER_MEMORY_LIMIT' ] . to_i <= 0 )
221
- value . to_s || 'nil' rescue "<#to_s method raised exception: #{ $!} >"
222
- else
223
- exec_with_allocation_control ( value , ENV [ 'DEBUGGER_MEMORY_LIMIT' ] . to_i , ENV [ 'INSPECT_TIME_LIMIT' ] . to_i , :to_s , true ) || 'nil' rescue "<#to_s method raised exception: #{ $!} >"
224
- end
223
+ value_str = exec_with_allocation_control ( value , ENV [ 'DEBUGGER_MEMORY_LIMIT' ] . to_i , ENV [ 'INSPECT_TIME_LIMIT' ] . to_i , :to_s , true ) || 'nil' rescue "<#to_s method raised exception: #{ $!} >"
225
224
226
225
unless value_str . is_a? ( String )
227
226
value_str = "ERROR: #{ value . class } .to_s method returns #{ value_str . class } . Should return String."
@@ -448,11 +447,7 @@ def max_compact_name_size
448
447
def compact_array_str ( value )
449
448
slice = value [ 0 ..10 ]
450
449
451
- compact = if ( defined? ( JRUBY_VERSION ) || ENV [ 'DEBUGGER_MEMORY_LIMIT' ] . to_i <= 0 )
452
- slice . inspect
453
- else
454
- exec_with_allocation_control ( slice , ENV [ 'DEBUGGER_MEMORY_LIMIT' ] . to_i , ENV [ 'INSPECT_TIME_LIMIT' ] . to_i , :inspect , true )
455
- end
450
+ compact = exec_with_allocation_control ( slice , ENV [ 'DEBUGGER_MEMORY_LIMIT' ] . to_i , ENV [ 'INSPECT_TIME_LIMIT' ] . to_i , :inspect , true )
456
451
457
452
if compact && value . size != slice . size
458
453
compact [ 0 ..compact . size -2 ] + ", ...]"
0 commit comments