Module: DEBUGGER__::DAP_TraceInspector::Custom_Session
- Defined in:
- lib/debug/dap_custom/traceInspector.rb
Instance Method Summary collapse
- #custom_dap_request_event_rdbgTraceInspector(req, result) ⇒ Object
- #custom_dap_request_rdbgTraceInspector(req) ⇒ Object
- #find_multi_trace ⇒ Object
- #process_event_record_cmd(req, result) ⇒ Object
- #process_record_cmd(req) ⇒ Object
- #process_trace_cmd(req) ⇒ Object
Instance Method Details
#custom_dap_request_event_rdbgTraceInspector(req, result) ⇒ Object
244 245 246 247 248 249 250 251 252 |
# File 'lib/debug/dap_custom/traceInspector.rb', line 244 def custom_dap_request_event_rdbgTraceInspector(req, result) cmd = req.dig('arguments', 'command') case cmd when 'record' process_event_record_cmd(req, result) else raise "Unknown command #{cmd}" end end |
#custom_dap_request_rdbgTraceInspector(req) ⇒ Object
232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/debug/dap_custom/traceInspector.rb', line 232 def custom_dap_request_rdbgTraceInspector(req) cmd = req.dig('arguments', 'command') case cmd when 'trace' process_trace_cmd req when 'record' process_record_cmd req else raise "Unknown command #{cmd}" end end |
#find_multi_trace ⇒ Object
186 187 188 189 190 191 192 193 |
# File 'lib/debug/dap_custom/traceInspector.rb', line 186 def find_multi_trace @tracers.values.each{|t| if t.type == 'multi' return t end } return nil end |
#process_event_record_cmd(req, result) ⇒ Object
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/debug/dap_custom/traceInspector.rb', line 254 def process_event_record_cmd(req, result) cmd = req.dig('arguments', 'subCommand') case cmd when 'enable' @ui.respond req, {} when 'disable' @ui.respond req, {} when 'collect' cnt = result.delete :dropped_trace_cnt if cnt > 0 @ui.puts "Return #{result[:logs].size} traces and #{cnt} traces are dropped" else @ui.puts "Return #{result[:logs].size} traces" end @ui.respond req, result else raise "Unknown command #{cmd}" end end |
#process_record_cmd(req) ⇒ Object
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/debug/dap_custom/traceInspector.rb', line 195 def process_record_cmd req cmd = req.dig('arguments', 'subCommand') case cmd when 'enable' @tc << [:dap, :rdbgTraceInspector, req] when 'disable' @tc << [:dap, :rdbgTraceInspector, req] when 'step' tid = req.dig('arguments', 'threadId') count = req.dig('arguments', 'count') if tc = find_waiting_tc(tid) @ui.respond req, {} tc << [:step, :in, count] else fail_response req end when 'stepBack' tid = req.dig('arguments', 'threadId') count = req.dig('arguments', 'count') if tc = find_waiting_tc(tid) @ui.respond req, {} tc << [:step, :back, count] else fail_response req end when 'collect' tid = req.dig('arguments', 'threadId') if tc = find_waiting_tc(tid) tc << [:dap, :rdbgTraceInspector, req] else fail_response req end else raise "Unknown record sub command #{cmd}" end end |
#process_trace_cmd(req) ⇒ Object
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 |