@@ -219,6 +219,22 @@ def gather_variables(frame_idx: 0, type: "locals")
219219 end
220220 end
221221
222+ def req_rdbgTraceInspector_enable events : [ 'line' , 'call' , 'return' ]
223+ send_custom_dap_request 'rdbgTraceInspector' , command : 'enable' , events : events
224+ end
225+
226+ def req_rdbgTraceInspector_disable
227+ send_custom_dap_request 'rdbgTraceInspector' , command : 'disable'
228+ end
229+
230+ def req_rdbgRecordInspector_enable
231+ send_custom_dap_request 'rdbgRecordInspector' , command : 'enable'
232+ end
233+
234+ def req_rdbgRecordInspector_disable
235+ send_custom_dap_request 'rdbgRecordInspector' , command : 'disable'
236+ end
237+
222238 def assert_locals_result expected , frame_idx : 0
223239 case get_target_ui
224240 when 'vscode'
@@ -301,8 +317,51 @@ def assert_watch_result expected, expression, frame_idx: 0
301317 end
302318 end
303319
320+ def req_rdbgRecordInspector_step_back count
321+ send_custom_dap_request 'rdbgRecordInspector' , command : 'stepBack' , threadId : 1 , count : count
322+ end
323+
324+ def req_rdbgRecordInspector_step count
325+ send_custom_dap_request 'rdbgRecordInspector' , command : 'step' , threadId : 1 , count : count
326+ end
327+
328+ def assert_rdbgRecordInspector_collect_result expected
329+ res = send_custom_dap_request 'rdbgRecordInspector' , command : 'collect' , threadId : 1
330+ assert_collect_result ( res , expected ) do |exp , log |
331+ check_hash_values ( exp , log , :name ) &&
332+ check_hash_values ( exp [ :location ] , log [ :location ] , :line )
333+ end
334+ end
335+
336+ def assert_rdbgTraceInspector_collect_result expected
337+ res = send_custom_dap_request 'rdbgTraceInspector' , command : 'collect'
338+ assert_collect_result ( res , expected ) do |exp , log |
339+ check_hash_values ( exp , log , :returnValue ) &&
340+ check_hash_values ( exp , log , :name ) &&
341+ check_hash_values ( exp [ :location ] , log [ :location ] , :line )
342+ end
343+ end
344+
304345 # Not API
305346
347+ def assert_collect_result res , expected
348+ logs = res . dig ( :body , :logs )
349+ expected . each { |exp |
350+ matched = logs . find { |log |
351+ yield exp , log
352+ }
353+ if matched . nil?
354+ msg = create_protocol_message "Expected to include\n `#{ JSON . pretty_generate exp } `\n In\n `#{ JSON . pretty_generate logs } `\n "
355+ flunk ( msg )
356+ end
357+ }
358+ end
359+
360+ def check_hash_values hash_a , hash_b , key
361+ hash_a . has_key? ( key ) == hash_b . has_key? ( key ) &&
362+ hash_a [ key ] == hash_b [ key ]
363+ end
364+
306365 def attach_to_cdp_server_
307366 body = get_request HOST , @remote_info . port , '/json'
308367 Timeout . timeout ( TIMEOUT_SEC ) do
@@ -558,6 +617,11 @@ def send_dap_request command, **kw
558617 res
559618 end
560619
620+ def send_custom_dap_request command , **kw
621+ send_request command , **kw
622+ return find_crt_dap_response
623+ end
624+
561625 def send_cdp_request command , **kw
562626 send_request command , **kw
563627 res = find_crt_cdp_response
0 commit comments