Debugger watch reports nil for variable with value false

Running the following code in the debugger:

a = false
if (a.nil?)
  puts "debugger thinks a is nil"
end
puts a



and setting a breakpoint at the if statement, the Variables pane reports 'a' as nil.  Adding a watch for 'a' also reports nil.

On the other hand, a.class reports FalseClass, and the code inside the if block is not executed, so clearly a is not actually nil, confirmed by the final puts.

Not trying to nitpick, just confused at this sometimes misleading behavior.  Is it a bug or is it me?
4 comments
Comment actions Permalink

Hi Alan,

Running the following code in the debugger:

a = false
if (a.nil?)
  puts "debugger thinks a is nil"
end
puts a


and setting a breakpoint at the if statement, the Variables pane reports 'a' as nil.  Adding a watch for 'a' also reports nil.

On the other hand, a.class reports FalseClass, and the code inside the if block is not executed, so clearly a is not actually nil, confirmed by the final puts.

Not trying to nitpick, just confused at this sometimes misleading behavior.  Is it a bug or is it me?

It seems like it's a bug of rdebug-ide gem. Have you tried command line debugger in this case?

Regards,
Oleg

0
Comment actions Permalink

I've just checked it with command line debugger and everything works fine, thus it's a bug of rdebug-ide.

Regards,
Oleg

0
Comment actions Permalink

isn't it possible to hack that -ide so RM show values correctly?
for folks like me it completelly equal what gems or other stuff do you use -- I see in debug panel "nil" so I think it is nil while it is "false"

go ahead -- fix it)

0
Comment actions Permalink

We are already aware of this problem and investigating it, so probably expect fixes soon.

Regards,
Oleg

0

Please sign in to leave a comment.