diff --git a/lib/ruby-debug-ide/commands/variables.rb b/lib/ruby-debug-ide/commands/variables.rb index cc8d935..ccc5841 100644 --- a/lib/ruby-debug-ide/commands/variables.rb +++ b/lib/ruby-debug-ide/commands/variables.rb @@ -129,7 +129,8 @@ def execute locals = @state.context.frame_locals(@state.frame_pos) _self = @state.context.frame_self(@state.frame_pos) begin - locals['self'] = _self unless "main" == _self.to_s + _self_str = exec_with_allocation_control(_self, ENV['DEBUGGER_MEMORY_LIMIT'].to_i, ENV['INSPECT_TIME_LIMIT'].to_i, :to_s, false) + locals['self'] = _self unless "main" == _self_str rescue => ex locals['self'] = "" $stderr << "Cannot evaluate self\n#{ex.class.name}: #{ex.message}\n #{ex.backtrace.join("\n ")}" diff --git a/lib/ruby-debug-ide/xml_printer.rb b/lib/ruby-debug-ide/xml_printer.rb index 0b0e607..d5fd24b 100644 --- a/lib/ruby-debug-ide/xml_printer.rb +++ b/lib/ruby-debug-ide/xml_printer.rb @@ -220,7 +220,7 @@ def print_variable(name, value, kind) value_str = if (defined?(JRUBY_VERSION) || ENV['DEBUGGER_MEMORY_LIMIT'].to_i <= 0) value.to_s || 'nil' rescue "<#to_s method raised exception: #{$!}>" else - exec_with_allocation_control(value, ENV['DEBUGGER_MEMORY_LIMIT'].to_i, ENV['INSPECT_TIME_LIMIT'].to_i, :to_s, false) || 'nil' rescue "<#to_s method raised exception: #{$!}>" + 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: #{$!}>" end unless value_str.is_a?(String)