lib/ruby-debug/commands/variables.rb in ruby-debug-ide-0.4.9 vs lib/ruby-debug/commands/variables.rb in ruby-debug-ide-0.4.10
- old
+ new
@@ -112,11 +112,16 @@
/^\s*v(?:ar)?\s+l(?:ocal)?\s*$/
end
def execute
locals = @state.context.frame_locals(@state.frame_pos)
- _self = @state.context.frame_self(@state.frame_pos)
- locals['self'] = _self unless _self.to_s == "main"
+ _self = @state.context.frame_self(@state.frame_pos)
+ begin
+ locals['self'] = _self unless _self.to_s == "main"
+ rescue => ex
+ locals['self'] = "<Cannot evaluate self>"
+ $stderr << "Cannot evaluate self\n#{ex.class.name}: #{ex.message}\n #{ex.backtrace.join("\n ")}"
+ end
print_variables(locals.keys, 'local') do |var|
locals[var]
end
end