@@ -150,7 +150,7 @@ def print_hash(hash)
150150 if k . class . name == "String"
151151 name = '\'' + k + '\''
152152 else
153- name = exec_with_allocation_control ( k , Debugger . debugger_memory_limit , Debugger . inspect_time_limit , :to_s , OverflowMessageType ::EXCEPTION_MESSAGE )
153+ name = exec_with_allocation_control ( k , :to_s , OverflowMessageType ::EXCEPTION_MESSAGE )
154154 end
155155 print_variable ( name , hash [ k ] , 'instance' )
156156 }
@@ -185,9 +185,12 @@ def exec_with_timeout(sec, error_message)
185185 end
186186 end
187187
188- def exec_with_allocation_control ( value , memory_limit , time_limit , exec_method , overflow_message_type )
188+ def exec_with_allocation_control ( value , exec_method , overflow_message_type )
189189 return value . send exec_method unless Debugger . trace_to_s
190190
191+ memory_limit = Debugger . debugger_memory_limit
192+ time_limit = Debugger . inspect_time_limit
193+
191194 if defined? ( JRUBY_VERSION ) || RUBY_VERSION < '2.0' || memory_limit <= 0
192195 return exec_with_timeout ( time_limit * 1e-3 , "Timeout: evaluation of #{ exec_method } took longer than #{ time_limit } ms." ) { value . send exec_method }
193196 end
@@ -258,7 +261,7 @@ def print_variable(name, value, kind)
258261 else
259262 has_children = !value . instance_variables . empty? || !value . class . class_variables . empty?
260263
261- value_str = exec_with_allocation_control ( value , Debugger . debugger_memory_limit , Debugger . inspect_time_limit , :to_s , OverflowMessageType ::EXCEPTION_MESSAGE ) || 'nil' rescue "<#to_s method raised exception: #{ $!} >"
264+ value_str = exec_with_allocation_control ( value , :to_s , OverflowMessageType ::EXCEPTION_MESSAGE ) || 'nil' rescue "<#to_s method raised exception: #{ $!} >"
262265 unless value_str . is_a? ( String )
263266 value_str = "ERROR: #{ value . class } .to_s method returns #{ value_str . class } . Should return String."
264267 end
@@ -484,7 +487,7 @@ def max_compact_name_size
484487 def compact_array_str ( value )
485488 slice = value [ 0 ..10 ]
486489
487- compact = exec_with_allocation_control ( slice , Debugger . debugger_memory_limit , Debugger . inspect_time_limit , :inspect , OverflowMessageType ::NIL_MESSAGE )
490+ compact = exec_with_allocation_control ( slice , :inspect , OverflowMessageType ::NIL_MESSAGE )
488491
489492 if compact && value . size != slice . size
490493 compact [ 0 ..compact . size - 2 ] + ", ...]"
@@ -496,14 +499,14 @@ def compact_hash_str(value)
496499 keys_strings = Hash . new
497500
498501 slice = value . sort_by do |k , _ |
499- keys_string = exec_with_allocation_control ( k , Debugger . debugger_memory_limit , Debugger . inspect_time_limit , :to_s , OverflowMessageType ::SPECIAL_SYMBOL_MESSAGE )
502+ keys_string = exec_with_allocation_control ( k , :to_s , OverflowMessageType ::SPECIAL_SYMBOL_MESSAGE )
500503 keys_strings [ k ] = keys_string
501504 keys_string
502505 end [ 0 ..5 ]
503506
504507 compact = slice . map do |kv |
505508 key_string = keys_strings [ kv [ 0 ] ]
506- value_string = exec_with_allocation_control ( kv [ 1 ] , Debugger . debugger_memory_limit , Debugger . inspect_time_limit , :to_s , OverflowMessageType ::SPECIAL_SYMBOL_MESSAGE )
509+ value_string = exec_with_allocation_control ( kv [ 1 ] , :to_s , OverflowMessageType ::SPECIAL_SYMBOL_MESSAGE )
507510 "#{ key_string } : #{ handle_binary_data ( value_string ) } "
508511 end . join ( ", " )
509512 "{" + compact + ( slice . size != value . size ? ", ..." : "" ) + "}"
0 commit comments