Skip to content

Commit d13955e

Browse files
committed
use just binding for rbx as a temporary workaround
1 parent 1c0324b commit d13955e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/ruby-debug-ide/commands/variables.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ def help(cmd)
5959
end
6060

6161
class VarInstanceCommand < Command # :nodoc:
62+
# TODO: try to find out a way to use Kernel.binding
63+
BINDING_COMMAND = (defined? Rubinius) ? 'binding' : '::Kernel.binding'
64+
6265
def regexp
6366
# id will be read as first match, name as post match
6467
/^\s*v(?:ar)?\s+i(?:nstance)?\s+((?:[\\+-]0x)[\dabcdef]+)?/
@@ -67,8 +70,9 @@ def regexp
6770
def execute
6871
if (@match[1])
6972
obj = ObjectSpace._id2ref(@match[1].hex) rescue nil
73+
7074
unless obj
71-
# TODO: ensure that empty variables frame will be printed
75+
print_element("variables")
7276
@printer.print_msg("Unknown object id : %s", @match[1])
7377
end
7478
else
@@ -86,15 +90,15 @@ def execute
8690
# instance variables
8791
kind = 'instance'
8892
inst_vars = obj.instance_variables
89-
instance_binding = obj.instance_eval{::Kernel.binding()}
93+
instance_binding = obj.instance_eval(BINDING_COMMAND)
9094
# print self at top position
9195
print_variable('self', debug_eval('self', instance_binding), kind) if inst_vars.include?('self')
9296
inst_vars.sort.each do |var|
9397
print_variable(var, debug_eval(var, instance_binding), kind) unless var == 'self'
9498
end
9599

96100
# class variables
97-
class_binding = obj.class.class_eval('::Kernel.binding()')
101+
class_binding = obj.class.class_eval(BINDING_COMMAND)
98102
obj.class.class_variables.sort.each do |var|
99103
print_variable(var, debug_eval(var, class_binding), 'class')
100104
end

0 commit comments

Comments
 (0)