class DEBUGGER__::WatchIVarBreakpoint
Public Class Methods
new(ivar, object, current, cond: nil, command: nil, path: nil)
click to toggle source
Calls superclass method
DEBUGGER__::Breakpoint::new
# File debug-1.8.0/lib/debug/breakpoint.rb, line 382 def initialize ivar, object, current, cond: nil, command: nil, path: nil @ivar = ivar.to_sym @object = object @key = [:watch, object.object_id, @ivar].freeze @current = current super(cond, command, path) end
Public Instance Methods
setup()
click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 410 def setup @tp = TracePoint.new(:line, :return, :b_return){|tp| watch_eval(tp) } end
to_s()
click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 416 def to_s value_str = if defined?(@prev) "#{@prev} -> #{@current}" else "#{@current}" end "#{generate_label("Watch")} #{@object} #{@ivar} = #{value_str}" end
watch_eval(tp)
click to toggle source
# File debug-1.8.0/lib/debug/breakpoint.rb, line 392 def watch_eval(tp) result = @object.instance_variable_get(@ivar) if result != @current begin @prev = @current @current = result if (@cond.nil? || @object.instance_eval(@cond)) && !skip_path?(tp.path) suspend end ensure remove_instance_variable(:@prev) end end rescue Exception false end