class DEBUGGER__::DAP_TraceInspector::MultiTracer
Attributes
dropped_trace_cnt[RW]
log[R]
Public Class Methods
new(ui, evts, trace_params, max_log_size: nil, **kw)
click to toggle source
Calls superclass method
# File debug-1.9.2/lib/debug/dap_custom/traceInspector.rb, line 4 def initialize ui, evts, trace_params, max_log_size: nil, **kw @evts = evts @log = [] @trace_params = trace_params if max_log_size @max_log_size = max_log_size else @max_log_size = 50000 end @dropped_trace_cnt = 0 super(ui, **kw) @type = 'multi' @name = 'TraceInspector' end
Public Instance Methods
append(log)
click to toggle source
# File debug-1.9.2/lib/debug/dap_custom/traceInspector.rb, line 60 def append log if @log.size >= @max_log_size @dropped_trace_cnt += 1 @log.shift end @log << log end
call_identifier_str(tp)
click to toggle source
# File debug-1.9.2/lib/debug/dap_custom/traceInspector.rb, line 52 def call_identifier_str tp if tp.defined_class minfo(tp) else "block" end end
call_trace_log(tp, return_str: nil, params: nil)
click to toggle source
# File debug-1.9.2/lib/debug/dap_custom/traceInspector.rb, line 68 def call_trace_log tp, return_str: nil, params: nil log = { depth: DEBUGGER__.frame_depth, name: call_identifier_str(tp), threadId: Thread.current.instance_variable_get(:@__thread_client_id), location: { path: tp.path, line: tp.lineno } } log[:returnValue] = return_str if return_str log[:parameters] = params if params && params.size > 0 log end
line_trace_log(tp)
click to toggle source
# File debug-1.9.2/lib/debug/dap_custom/traceInspector.rb, line 83 def line_trace_log tp { depth: DEBUGGER__.frame_depth, threadId: Thread.current.instance_variable_get(:@__thread_client_id), location: { path: tp.path, line: tp.lineno } } end
parameters_info(tp)
click to toggle source
# File debug-1.9.2/lib/debug/dap_custom/traceInspector.rb, line 41 def parameters_info tp b = tp.binding tp.parameters.map{|_type, name| begin { name: name, value: DEBUGGER__.safe_inspect(b.local_variable_get(name), short: true, max_length: 4096) } rescue NameError, TypeError nil end }.compact end
setup()
click to toggle source
# File debug-1.9.2/lib/debug/dap_custom/traceInspector.rb, line 22 def setup @tracer = TracePoint.new(*@evts){|tp| next if skip?(tp) case tp.event when :call, :c_call, :b_call if @trace_params params = parameters_info tp end append(call_trace_log(tp, params: params)) when :return, :c_return, :b_return return_str = DEBUGGER__.safe_inspect(tp.return_value, short: true, max_length: 4096) append(call_trace_log(tp, return_str: return_str)) when :line append(line_trace_log(tp)) end } end
skip?(tp)
click to toggle source
Calls superclass method
# File debug-1.9.2/lib/debug/dap_custom/traceInspector.rb, line 94 def skip? tp super || !@evts.include?(tp.event) end
skip_with_pattern?(tp)
click to toggle source
Calls superclass method
# File debug-1.9.2/lib/debug/dap_custom/traceInspector.rb, line 98 def skip_with_pattern?(tp) super && !tp.method_id&.match?(@pattern) end