132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
# File 'lib/debug/dap_custom/traceInspector.rb', line 132
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
|