module DEBUGGER__::DAP_TraceInspector::Custom_Session
def process_trace_cmd req
def process_trace_cmd req cmd = req.dig('arguments', 'subCommand') case cmd when 'enable' events = req.dig('arguments', 'events') evts = [] trace_params = false filter = req.dig('arguments', 'filterRegExp') max_log_size = req.dig('arguments', 'maxLogSize') events.each{|evt| case evt when 'traceLine' evts << :line when 'traceCall' evts << :call evts << :b_call when 'traceReturn' evts << :return evts << :b_return when 'traceParams' trace_params = true when 'traceClanguageCall' evts << :c_call when 'traceClanguageReturn' evts << :c_return else raise "unknown trace type #{evt}" end } add_tracer MultiTracer.new @ui, evts, trace_params, max_log_size: max_log_size, pattern: filter @ui.respond req, {} when 'disable' if t = find_multi_trace t.disable end @ui.respond req, {} when 'collect' logs = [] if t = find_multi_trace logs = t.log if t.dropped_trace_cnt > 0 @ui.puts "Return #{logs.size} traces and #{t.dropped_trace_cnt} traces are dropped" else @ui.puts "Return #{logs.size} traces" end t.dropped_trace_cnt = 0 end @ui.respond req, logs: logs else raise "Unknown trace sub command #{cmd}" end return :retry end