class Rookout::Services::Tracer
Public Class Methods
new()
click to toggle source
# File lib/rookout/services/tracer.rb, line 9 def initialize @trace_points = {} @augs = {} end
Public Instance Methods
add_breakpoint_aug(positions, aug)
click to toggle source
# File lib/rookout/services/tracer.rb, line 14 def add_breakpoint_aug positions, aug return if @augs.include? aug.id aug_trace_points = [] positions.each do |position| trace_point = create_trace_point aug begin trace_point.enable target: position.method, target_line: position.lineno rescue RuntimeError, ArgumentError => e raise Exceptions::RookSetTracepointFailed.new(position.lineno, e) end # We add and remove a dummy trace point to re-align the tracing mechanism as a result of some bug in adding # a breakpoint dummy_trace_point = TracePoint.new(:line) {} dummy_trace_point.enable target: position.method, target_line: position.lineno dummy_trace_point.disable aug_trace_points.push trace_point end @trace_points[aug.id] = aug_trace_points @augs[aug.id] = aug aug.notify_active end
clear_augs()
click to toggle source
# File lib/rookout/services/tracer.rb, line 55 def clear_augs @augs.values.each do |aug_id| remove_aug aug_id end @trace_points = {} @augs = {} end
close()
click to toggle source
# File lib/rookout/services/tracer.rb, line 64 def close clear_augs end
remove_aug(aug_id)
click to toggle source
# File lib/rookout/services/tracer.rb, line 41 def remove_aug aug_id aug = @augs[aug_id] return if aug.nil? aug_trace_points = @trace_points[aug_id] unless aug_trace_points.nil? aug_trace_points.each(&:disable) end @augs.delete aug_id @trace_points.delete aug_id aug.notify_removed end
Private Instance Methods
create_trace_point(aug)
click to toggle source
# File lib/rookout/services/tracer.rb, line 70 def create_trace_point aug TracePoint.new :line do begin begin # TODO: consider delaying callers (get bindings) until we actually need them in Aug.rb aug.execute callers, nil rescue Exception => e Logger.instance.exception "Exception calling aug", e end rescue # Don't leak any exception from here end end end