From aed0a692875e3b278f26486c29379fffc20fc052 Mon Sep 17 00:00:00 2001 From: fangting Date: Thu, 26 Jun 2025 21:11:22 +0800 Subject: [PATCH 1/8] add 1.2 Debugger Issue:#ICI4D5 Signed-off-by: fangting --- .vscode/c_cpp_properties.json | 18 + .vscode/launch.json | 24 + .vscode/settings.json | 59 + BUILD.gn | 12 +- build/core/gn/BUILD.gn | 140 +++ inspector/BUILD.gn | 2 +- inspector/connect_inspector.cpp | 2 +- inspector/inspector.cpp | 2 +- .../BUILD.gn | 2 +- ...pprofileraddinspectedheapobject_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../heapprofilercollectgarbage_fuzzer.cpp | 2 +- .../heapprofilerdisable_fuzzer/BUILD.gn | 2 +- .../heapprofilerdisable_fuzzer.cpp | 2 +- .../heapprofilerdispatch_fuzzer/BUILD.gn | 2 +- .../heapprofilerdispatch_fuzzer.cpp | 2 +- .../heapprofilerenable_fuzzer/BUILD.gn | 2 +- .../heapprofilerenable_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../heapprofilergetheapobjectid_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...profilergetobjectbyheapobjectid_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../heapprofilergetsamplingprofile_fuzzer.cpp | 2 +- .../heapprofilerstartsampling_fuzzer/BUILD.gn | 2 +- .../heapprofilerstartsampling_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...rofilerstarttrackingheapobjects_fuzzer.cpp | 2 +- .../heapprofilerstopsampling_fuzzer/BUILD.gn | 2 +- .../heapprofilerstopsampling_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...profilerstoptrackingheapobjects_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../heapprofilertakeheapsnapshot_fuzzer.cpp | 2 +- .../backend/backendbreakpoint_fuzzer/BUILD.gn | 2 +- .../backendbreakpoint_fuzzer.cpp | 2 +- .../backend/backendexception_fuzzer/BUILD.gn | 2 +- .../backendexception_fuzzer.cpp | 2 +- .../backend/backendloadmodule_fuzzer/BUILD.gn | 2 +- .../backendloadmodule_fuzzer.cpp | 2 +- .../backendnativecalling_fuzzer/BUILD.gn | 2 +- .../backendnativecalling_fuzzer.cpp | 2 +- .../backend/backendsinglestep_fuzzer/BUILD.gn | 2 +- .../backendsinglestep_fuzzer.cpp | 2 +- .../baseptbase64decode_fuzzer/BUILD.gn | 2 +- .../baseptbase64decode_fuzzer.cpp | 4 +- .../baseptbase64encode_fuzzer/BUILD.gn | 2 +- .../baseptbase64encode_fuzzer.cpp | 4 +- .../BUILD.gn | 2 +- ...aseptsbreakpointgetbreakpointid_fuzzer.cpp | 4 +- .../BUILD.gn | 2 +- .../baseptsbreakpointgetlocation_fuzzer.cpp | 4 +- .../baseptsbreakpointgetname_fuzzer/BUILD.gn | 2 +- .../baseptsbreakpointgetname_fuzzer.cpp | 4 +- .../BUILD.gn | 2 +- ...aseptsbreakpointsetbreakpointid_fuzzer.cpp | 4 +- .../BUILD.gn | 2 +- .../baseptsbreakpointsetlocation_fuzzer.cpp | 4 +- .../BUILD.gn | 2 +- .../baseptspausedgetcallframes_fuzzer.cpp | 4 +- .../baseptspausedgetdata_fuzzer/BUILD.gn | 2 +- .../baseptspausedgetdata_fuzzer.cpp | 4 +- .../BUILD.gn | 2 +- .../baseptspausedgethitbreakpoints_fuzzer.cpp | 4 +- .../baseptspausedgetname_fuzzer/BUILD.gn | 2 +- .../baseptspausedgetname_fuzzer.cpp | 4 +- .../baseptspausedgetreason_fuzzer/BUILD.gn | 2 +- .../baseptspausedgetreason_fuzzer.cpp | 4 +- .../BUILD.gn | 2 +- .../baseptspausedgetreasonstring_fuzzer.cpp | 4 +- .../baseptspausedhasdata_fuzzer/BUILD.gn | 2 +- .../baseptspausedhasdata_fuzzer.cpp | 4 +- .../BUILD.gn | 2 +- .../baseptspausedhashitbreakpoints_fuzzer.cpp | 4 +- .../BUILD.gn | 2 +- .../baseptspausedsetcallframes_fuzzer.cpp | 4 +- .../baseptspausedsetdata_fuzzer/BUILD.gn | 2 +- .../baseptspausedsetdata_fuzzer.cpp | 4 +- .../BUILD.gn | 2 +- .../baseptspausedsethitbreakpoints_fuzzer.cpp | 4 +- .../baseptspausedsetreason_fuzzer/BUILD.gn | 2 +- .../baseptspausedsetreason_fuzzer.cpp | 4 +- .../connectserversendmessage_fuzzer/BUILD.gn | 2 +- .../BUILD.gn | 2 +- .../dispatchresponsecreatecode_fuzzer.cpp | 2 +- .../dispatchprotocolmessage_fuzzer/BUILD.gn | 2 +- .../dispatchprotocolmessage_fuzzer.cpp | 2 +- .../initializedebugger_fuzzer/BUILD.gn | 2 +- .../initializedebugger_fuzzer.cpp | 2 +- test/fuzztest/protocolhandler_fuzzer/BUILD.gn | 2 +- .../protocolhandler_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...protocolhandlercreateerrorreply_fuzzer.cpp | 2 +- .../protocolhandlerdispatch_fuzzer/BUILD.gn | 2 +- .../protocolhandlerdispatch_fuzzer.cpp | 2 +- .../protocolhandlerget_fuzzer/BUILD.gn | 2 +- .../protocolhandlerget_fuzzer.cpp | 2 +- .../protocolhandlernotif_fuzzer/BUILD.gn | 2 +- .../protocolhandlernotif_fuzzer.cpp | 2 +- .../protocolhandlerprocess_fuzzer/BUILD.gn | 2 +- .../protocolhandlerprocess_fuzzer.cpp | 2 +- .../protocolhandlerresponse_fuzzer/BUILD.gn | 2 +- .../protocolhandlerresponse_fuzzer.cpp | 2 +- .../protocolhandlerrun_fuzzer/BUILD.gn | 2 +- .../protocolhandlerrun_fuzzer.cpp | 2 +- .../protocolhandlersendreply_fuzzer/BUILD.gn | 2 +- .../protocolhandlersendreply_fuzzer.cpp | 2 +- .../protocolhandlerwait_fuzzer/BUILD.gn | 2 +- .../protocolhandlerwait_fuzzer.cpp | 2 +- .../pttypesbreakpointparseid_fuzzer/BUILD.gn | 2 +- .../pttypesbreakpointparseid_fuzzer.cpp | 2 +- .../pttypesbreakpointtostring_fuzzer/BUILD.gn | 2 +- .../pttypesbreakpointtostring_fuzzer.cpp | 2 +- .../pttypesexceptiondetails_fuzzer/BUILD.gn | 2 +- .../pttypesexceptiondetails_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesexceptiondetailscolumn_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesexceptiondetailscreate_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...ttypesexceptiondetailsexception_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...ypesexceptiondetailsexceptionid_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...eptiondetailsexecutioncontextid_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesexceptiondetailsline_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...pttypesexceptiondetailsscriptid_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesexceptiondetailstext_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesexceptiondetailstojson_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesexceptiondetailsurl_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesfunctionremoteobject_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...esgeneratorfunctionremoteobject_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesinternalpropertydesp_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...typesinternalpropertydespcreate_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...pttypesinternalpropertydespname_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...typesinternalpropertydesptojson_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...ttypesinternalpropertydespvalue_fuzzer.cpp | 2 +- .../pttypesobjectremoteobject_fuzzer/BUILD.gn | 2 +- .../pttypesobjectremoteobject_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesprimitiveremoteobject_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesprivatepropertydesp_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...ttypesprivatepropertydespcreate_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesprivatepropertydespget_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesprivatepropertydespname_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesprivatepropertydespset_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...ttypesprivatepropertydesptojson_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...pttypesprivatepropertydespvalue_fuzzer.cpp | 2 +- .../pttypesremoteobject_fuzzer/BUILD.gn | 2 +- .../pttypesremoteobject_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesremoteobjectdescription_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...pttypesremoteobjectgetclassname_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesremoteobjectgetsubtype_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesremoteobjectgettype_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesremoteobjectgetvalue_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...pttypesremoteobjecthasclassname_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesremoteobjecthassubtype_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesremoteobjectobjectid_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...pttypesremoteobjectsetclassname_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesremoteobjectsetsubtype_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesremoteobjectsettype_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- .../pttypesremoteobjectsetvalue_fuzzer.cpp | 2 +- .../BUILD.gn | 2 +- ...remoteobjectunserializablevalue_fuzzer.cpp | 2 +- .../pttypesstringremoteobject_fuzzer/BUILD.gn | 2 +- .../pttypesstringremoteobject_fuzzer.cpp | 2 +- .../pttypessymbolremoteobject_fuzzer/BUILD.gn | 2 +- .../pttypessymbolremoteobject_fuzzer.cpp | 2 +- .../wsserversendreply_fuzzer/BUILD.gn | 2 +- test/resource/tooling/ohos_test.xml | 186 +-- tooling/BUILD.gn | 147 +-- tooling/dynamic/BUILD.gn | 180 +++ .../{ => dynamic}/agent/animation_impl.cpp | 0 tooling/{ => dynamic}/agent/animation_impl.h | 0 tooling/{ => dynamic}/agent/css_impl.cpp | 0 tooling/{ => dynamic}/agent/css_impl.h | 0 tooling/{ => dynamic}/agent/debugger_impl.cpp | 2 +- tooling/{ => dynamic}/agent/debugger_impl.h | 2 +- tooling/{ => dynamic}/agent/dom_impl.cpp | 0 tooling/{ => dynamic}/agent/dom_impl.h | 0 .../{ => dynamic}/agent/heapprofiler_impl.cpp | 0 .../{ => dynamic}/agent/heapprofiler_impl.h | 6 +- tooling/{ => dynamic}/agent/overlay_impl.cpp | 0 tooling/{ => dynamic}/agent/overlay_impl.h | 0 tooling/{ => dynamic}/agent/page_impl.cpp | 0 tooling/{ => dynamic}/agent/page_impl.h | 0 tooling/{ => dynamic}/agent/profiler_impl.cpp | 0 tooling/{ => dynamic}/agent/profiler_impl.h | 4 +- tooling/{ => dynamic}/agent/runtime_impl.cpp | 0 tooling/{ => dynamic}/agent/runtime_impl.h | 2 +- tooling/{ => dynamic}/agent/target_impl.cpp | 0 tooling/{ => dynamic}/agent/target_impl.h | 0 tooling/{ => dynamic}/agent/tracing_impl.cpp | 0 tooling/{ => dynamic}/agent/tracing_impl.h | 4 +- .../backend/debugger_executor.cpp | 2 +- .../{ => dynamic}/backend/debugger_executor.h | 0 tooling/{ => dynamic}/backend/js_pt_hooks.cpp | 0 tooling/{ => dynamic}/backend/js_pt_hooks.h | 4 +- .../backend/js_single_stepper.cpp | 0 .../{ => dynamic}/backend/js_single_stepper.h | 0 tooling/{ => dynamic}/base/pt_base64.cpp | 2 +- tooling/{ => dynamic}/base/pt_base64.h | 0 tooling/{ => dynamic}/base/pt_events.cpp | 2 +- tooling/{ => dynamic}/base/pt_events.h | 4 +- tooling/{ => dynamic}/base/pt_json.cpp | 2 +- tooling/{ => dynamic}/base/pt_json.h | 0 tooling/{ => dynamic}/base/pt_params.cpp | 2 +- tooling/{ => dynamic}/base/pt_params.h | 2 +- tooling/{ => dynamic}/base/pt_returns.cpp | 2 +- tooling/{ => dynamic}/base/pt_returns.h | 2 +- tooling/{ => dynamic}/base/pt_script.cpp | 2 +- tooling/{ => dynamic}/base/pt_script.h | 2 +- tooling/{ => dynamic}/base/pt_types.cpp | 2 +- tooling/{ => dynamic}/base/pt_types.h | 4 +- tooling/{ => dynamic}/client/BUILD.gn | 18 +- tooling/{ => dynamic}/client/ark_cli/BUILD.gn | 13 +- tooling/{ => dynamic}/client/ark_cli/main.cpp | 4 +- .../{ => dynamic}/client/ark_multi/BUILD.gn | 2 +- .../{ => dynamic}/client/ark_multi/ReadMe.md | 0 .../client/ark_multi/ReadMe_Zh.md | 0 .../{ => dynamic}/client/ark_multi/main.cpp | 2 +- .../client/domain/debugger_client.cpp | 4 +- .../client/domain/debugger_client.h | 2 +- .../client/domain/heapprofiler_client.cpp | 4 +- .../client/domain/heapprofiler_client.h | 2 +- .../client/domain/profiler_client.cpp | 4 +- .../client/domain/profiler_client.h | 2 +- .../client/domain/runtime_client.cpp | 4 +- .../client/domain/runtime_client.h | 2 +- .../client/domain/test_client.cpp | 4 +- .../{ => dynamic}/client/domain/test_client.h | 2 +- .../client/manager/breakpoint_manager.cpp | 4 +- .../client/manager/breakpoint_manager.h | 4 +- .../client/manager/domain_manager.cpp | 2 +- .../client/manager/domain_manager.h | 10 +- .../client/manager/message_manager.h | 0 .../client/manager/source_manager.cpp | 4 +- .../client/manager/source_manager.h | 4 +- .../client/manager/stack_manager.cpp | 2 +- .../client/manager/stack_manager.h | 4 +- .../client/manager/variable_manager.cpp | 2 +- .../client/manager/variable_manager.h | 8 +- .../client/manager/watch_manager.cpp | 4 +- .../client/manager/watch_manager.h | 6 +- .../{ => dynamic}/client/session/session.cpp | 4 +- .../{ => dynamic}/client/session/session.h | 12 +- .../client/tcpServer/tcp_server.cpp | 4 +- .../client/tcpServer/tcp_server.h | 0 .../client/tcpServer/test/config.py | 0 .../client/tcpServer/test/js_test_base.py | 0 .../tcpServer/test/js_test_case/__init__.py | 0 .../tcpServer/test/js_test_case/js_test.py | 0 .../client/tcpServer/test/runtest.py | 0 .../client/utils/cli_command.cpp | 2 +- .../{ => dynamic}/client/utils/cli_command.h | 10 +- tooling/{ => dynamic}/debugger_service.cpp | 0 tooling/{ => dynamic}/debugger_service.h | 0 tooling/{ => dynamic}/dispatcher.cpp | 0 tooling/{ => dynamic}/dispatcher.h | 2 +- tooling/{ => dynamic}/protocol_channel.h | 4 +- tooling/{ => dynamic}/protocol_handler.cpp | 0 tooling/{ => dynamic}/protocol_handler.h | 0 tooling/{ => dynamic}/test/BUILD.gn | 10 +- .../test/animation_impl_test.cpp | 0 .../test/client_utils/test_actions.h | 0 .../test/client_utils/test_list.cpp | 116 +- .../test/client_utils/test_list.h | 0 .../test/client_utils/test_util.cpp | 10 +- .../test/client_utils/test_util.h | 8 +- .../test/debugger_cint_client_test.cpp | 4 +- .../test/debugger_cinterp_test.cpp | 2 +- .../test/debugger_client_test.cpp | 4 +- .../test/debugger_commands_test.cpp | 4 +- .../test/debugger_entry_test.cpp | 2 +- .../test/debugger_events_test.cpp | 4 +- .../{ => dynamic}/test/debugger_impl_test.cpp | 0 .../test/debugger_params_test.cpp | 4 +- .../test/debugger_returns_test.cpp | 4 +- .../test/debugger_script_test.cpp | 6 +- .../test/debugger_service_test.cpp | 0 .../test/debugger_types_test.cpp | 2 +- .../{ => dynamic}/test/dispatcher_test.cpp | 0 tooling/{ => dynamic}/test/dom_impl_test.cpp | 0 .../test/entry/test_debugger_entry.cpp | 2 +- .../test/heapprofiler_impl_test.cpp | 0 .../{ => dynamic}/test/js_pt_hooks_test.cpp | 4 +- .../{ => dynamic}/test/overlay_impl_test.cpp | 0 tooling/{ => dynamic}/test/page_impl_test.cpp | 0 .../{ => dynamic}/test/profiler_impl_test.cpp | 0 .../test/protocol_handler_test.cpp | 0 tooling/{ => dynamic}/test/pt_base64_test.cpp | 2 +- tooling/{ => dynamic}/test/pt_json_test.cpp | 2 +- tooling/{ => dynamic}/test/pt_params_test.cpp | 2 +- .../{ => dynamic}/test/pt_returns_test.cpp | 4 +- tooling/{ => dynamic}/test/pt_types_test.cpp | 3 +- .../{ => dynamic}/test/runtime_impl_test.cpp | 2 +- .../{ => dynamic}/test/target_impl_test.cpp | 0 .../test/testcases/js/arrow_func.js | 0 .../test/testcases/js/async_func.js | 0 .../{ => dynamic}/test/testcases/js/branch.js | 0 .../test/testcases/js/closure_scope.js | 0 .../test/testcases/js/closure_variable.js | 0 .../test/testcases/js/common_func.js | 0 .../test/testcases/js/container.js | 0 .../test/testcases/js/dropframe.js | 0 .../test/testcases/js/exception.js | 0 .../testcases/js/export_variable_first.js | 0 .../testcases/js/export_variable_second.js | 0 .../test/testcases/js/local_export.js | 0 .../test/testcases/js/local_variable_scope.js | 0 .../test/testcases/js/module_variable.js | 0 .../test/testcases/js/module_watch.js | 0 .../test/testcases/js/promise.js | 0 .../test/testcases/js/range_error.js | 0 .../{ => dynamic}/test/testcases/js/sample.js | 0 .../test/testcases/js/smart_stepInto.js | 0 .../{ => dynamic}/test/testcases/js/step.js | 0 .../test/testcases/js/syntax_exception.js | 0 .../test/testcases/js/throw_exception.js | 0 .../test/testcases/js/variable_first.js | 0 .../test/testcases/js/variable_second.js | 0 .../test/testcases/js/watch_variable.js | 0 .../testcases/js_accelerate_launch_test.h | 2 +- .../testcases/js_allocationtrack_loop_test.h | 2 +- .../js_allocationtrack_recursion_test.h | 2 +- .../test/testcases/js_allocationtrack_test.h | 2 +- .../test/testcases/js_asyn_stack_test.h | 0 .../test/testcases/js_breakpoint_arrow_test.h | 2 +- .../test/testcases/js_breakpoint_async_test.h | 2 +- .../testcases/js_breakpoint_cannot_hit_test.h | 2 +- .../js_breakpoint_in_different_branch.h | 2 +- .../test/testcases/js_breakpoint_loop_test.h | 2 +- .../testcases/js_breakpoint_recursion_test.h | 2 +- .../testcases/js_breakpoint_switch_test.h | 2 +- .../test/testcases/js_breakpoint_test.h | 2 +- .../test/testcases/js_closure_scope_test.h | 2 +- .../test/testcases/js_container_test.h | 2 +- .../test/testcases/js_cpuprofile_async_test.h | 2 +- .../test/testcases/js_cpuprofile_loop_test.h | 2 +- .../testcases/js_cpuprofile_recursion_test.h | 2 +- .../test/testcases/js_cpuprofile_step_test.h | 2 +- .../test/testcases/js_cpuprofile_test.h | 2 +- .../test/testcases/js_dropframe_test.h | 0 .../test/testcases/js_exception_test.h | 2 +- .../test/testcases/js_heapdump_loop_test.h | 2 +- .../test/testcases/js_heapdump_test.h | 2 +- .../testcases/js_heapprofiler_dump_test.h | 2 +- .../testcases/js_heapsampling_loop_test.h | 2 +- .../test/testcases/js_heapsampling_test.h | 2 +- .../test/testcases/js_heapusage_async_test.h | 2 +- .../test/testcases/js_heapusage_loop_test.h | 2 +- .../testcases/js_heapusage_recursion_test.h | 2 +- .../test/testcases/js_heapusage_step_test.h | 2 +- .../test/testcases/js_heapusage_test.h | 2 +- .../testcases/js_local_variable_scope_test.h | 2 +- .../test/testcases/js_module_variable_test.h | 2 +- .../js_multiple_breakpoint_in_function_test.h | 2 +- .../js_multiple_common_breakpoint_test.h | 2 +- .../test/testcases/js_range_error_test.h | 0 .../test/testcases/js_single_step_test.h | 0 .../test/testcases/js_smart_stepInto_test.h | 2 +- .../test/testcases/js_source_test.h | 2 +- .../js_special_location_breakpoint_test.h | 2 +- .../test/testcases/js_step_into_test.h | 0 .../test/testcases/js_step_out_test.h | 0 .../test/testcases/js_step_over_test.h | 0 .../testcases/js_stepinto_and_stepout_test.h | 2 +- .../test/testcases/js_stepinto_arrow_test.h | 2 +- .../test/testcases/js_stepinto_async_test.h | 2 +- .../test/testcases/js_stepinto_loop_test.h | 2 +- .../testcases/js_stepinto_recursion_test.h | 2 +- .../test/testcases/js_stepinto_switch_test.h | 2 +- .../test/testcases/js_stepinto_test.h | 2 +- .../test/testcases/js_stepout_arrow_test.h | 2 +- .../test/testcases/js_stepout_async_test.h | 2 +- .../js_stepout_before_function_test.h | 2 +- .../test/testcases/js_stepout_loop_test.h | 2 +- .../testcases/js_stepout_recursion_test.h | 2 +- .../test/testcases/js_stepout_switch_test.h | 2 +- .../test/testcases/js_stepout_test.h | 2 +- .../test/testcases/js_stepover_loop_test.h | 2 +- .../testcases/js_stepover_recursion_test.h | 2 +- .../test/testcases/js_stepover_switch_test.h | 2 +- .../test/testcases/js_stepover_test.h | 2 +- .../test/testcases/js_symbolbreakpoint_test.h | 0 .../test/testcases/js_syntax_exception_test.h | 0 .../test/testcases/js_throw_exception_test.h | 0 .../test/testcases/js_tracing_test.h | 2 +- .../test/testcases/js_variable_first_test.h | 0 .../test/testcases/js_variable_second_test.h | 0 .../test/testcases/js_watch_basic_type_test.h | 2 +- .../js_watch_closure_variable_test.h | 2 +- .../test/testcases/js_watch_module_test.h | 0 .../test/testcases/js_watch_other_type_test.h | 2 +- .../test/testcases/js_watch_set_type_test.h | 2 +- .../test/testcases/js_watch_test.h | 2 +- .../test/testcases/js_watch_variable_test.h | 2 +- .../{ => dynamic}/test/tracing_impl_test.cpp | 0 .../{ => dynamic}/test/utils/test_channel.h | 2 +- .../{ => dynamic}/test/utils/test_entry.cpp | 0 tooling/{ => dynamic}/test/utils/test_entry.h | 0 .../{ => dynamic}/test/utils/test_events.h | 0 .../test/utils/test_extractor.cpp | 0 .../{ => dynamic}/test/utils/test_extractor.h | 0 tooling/{ => dynamic}/test/utils/test_hooks.h | 0 .../{ => dynamic}/test/utils/test_list.cpp | 0 tooling/{ => dynamic}/test/utils/test_list.h | 0 .../{ => dynamic}/test/utils/test_util.cpp | 0 tooling/{ => dynamic}/test/utils/test_util.h | 0 tooling/{ => dynamic}/utils/utils.cpp | 2 +- tooling/{ => dynamic}/utils/utils.h | 0 tooling/static/BUILD.gn | 75 ++ tooling/static/CMakeLists.txt | 135 +++ tooling/static/common.h | 25 + tooling/static/connection/asio/asio_config.h | 43 + .../static/connection/asio/asio_server.cpp | 182 +++ tooling/static/connection/asio/asio_server.h | 46 + .../connection/asio/server_endpoint-inl.h | 67 ++ .../static/connection/asio/server_endpoint.h | 75 ++ tooling/static/connection/asio/ws_logger.cpp | 89 ++ tooling/static/connection/asio/ws_logger.h | 60 + tooling/static/connection/endpoint_base.cpp | 104 ++ tooling/static/connection/endpoint_base.h | 118 ++ tooling/static/connection/event_loop.cpp | 35 + tooling/static/connection/event_loop.h | 53 + .../connection/ohos_ws/ohos_ws_server.cpp | 94 ++ .../connection/ohos_ws/ohos_ws_server.h | 41 + .../ohos_ws/ohos_ws_server_endpoint.cpp | 31 + .../ohos_ws/ohos_ws_server_endpoint.h | 50 + tooling/static/connection/server.h | 66 + .../connection/server_endpoint_base.cpp | 63 + .../static/connection/server_endpoint_base.h | 62 + tooling/static/debugger/breakpoint.cpp | 69 ++ tooling/static/debugger/breakpoint.h | 80 ++ tooling/static/debugger/breakpoint_base.h | 113 ++ .../static/debugger/breakpoint_storage.cpp | 147 +++ tooling/static/debugger/breakpoint_storage.h | 107 ++ .../debugger/conditional_breakpoint.cpp | 97 ++ .../static/debugger/conditional_breakpoint.h | 67 ++ tooling/static/debugger/debug_info_cache.cpp | 422 +++++++ tooling/static/debugger/debug_info_cache.h | 112 ++ tooling/static/debugger/debuggable_thread.cpp | 289 +++++ tooling/static/debugger/debuggable_thread.h | 149 +++ tooling/static/debugger/object_repository.cpp | 222 ++++ tooling/static/debugger/object_repository.h | 65 + tooling/static/debugger/thread_state.cpp | 247 ++++ tooling/static/debugger/thread_state.h | 131 ++ tooling/static/debugger_arkapi.cpp | 88 ++ tooling/static/debugger_arkapi.h | 43 + tooling/static/error.cpp | 29 + tooling/static/error.h | 27 + tooling/static/evaluation/base64.h | 151 +++ .../static/evaluation/evaluation_engine.cpp | 51 + tooling/static/evaluation/evaluation_engine.h | 81 ++ tooling/static/init.cpp | 106 ++ tooling/static/inspector.cpp | 819 +++++++++++++ tooling/static/inspector.h | 179 +++ tooling/static/inspector_server.cpp | 1072 +++++++++++++++++ tooling/static/inspector_server.h | 159 +++ .../static/json_serialization/jrpc_error.cpp | 28 + .../static/json_serialization/jrpc_error.h | 60 + .../static/json_serialization/serializable.h | 47 + tooling/static/session_manager.cpp | 66 + tooling/static/session_manager.h | 44 + tooling/static/source_manager.cpp | 53 + tooling/static/source_manager.h | 50 + tooling/static/tests/base64.cpp | 58 + tooling/static/tests/common.h | 40 + tooling/static/tests/debug_info_cache.cpp | 206 ++++ tooling/static/tests/inspector_server.cpp | 910 ++++++++++++++ tooling/static/tests/json_object_matcher.cpp | 44 + tooling/static/tests/json_object_matcher.h | 238 ++++ tooling/static/tests/object_repository.cpp | 212 ++++ tooling/static/tests/session_manager.cpp | 111 ++ tooling/static/tests/source_manager.cpp | 96 ++ tooling/static/tests/test_frame.h | 170 +++ tooling/static/tests/thread_state.cpp | 198 +++ .../types/custom_url_breakpoint_response.cpp | 41 + .../types/custom_url_breakpoint_response.h | 92 ++ .../debugger_call_function_on_request.cpp | 57 + .../types/debugger_call_function_on_request.h | 78 ++ .../types/debugger_evaluation_request.cpp | 58 + .../types/debugger_evaluation_request.h | 64 + tooling/static/types/evaluation_result.h | 56 + tooling/static/types/exception_details.cpp | 43 + tooling/static/types/exception_details.h | 138 +++ tooling/static/types/location.cpp | 60 + tooling/static/types/location.h | 78 ++ tooling/static/types/numeric_id.h | 70 ++ tooling/static/types/object_preview.cpp | 98 ++ tooling/static/types/object_preview.h | 42 + .../static/types/pause_on_exceptions_state.h | 23 + .../types/possible_breakpoints_response.h | 49 + tooling/static/types/profile_result.cpp | 105 ++ tooling/static/types/profile_result.h | 43 + tooling/static/types/property_descriptor.h | 138 +++ tooling/static/types/property_preview.h | 55 + tooling/static/types/remote_object.cpp | 161 +++ tooling/static/types/remote_object.h | 154 +++ tooling/static/types/remote_object_type.h | 87 ++ tooling/static/types/scope.cpp | 47 + tooling/static/types/scope.h | 45 + tooling/static/types/script_source_response.h | 47 + .../static/types/url_breakpoint_request.cpp | 52 + tooling/static/types/url_breakpoint_request.h | 72 ++ .../static/types/url_breakpoint_response.cpp | 44 + .../static/types/url_breakpoint_response.h | 82 ++ websocket/client/websocket_client.h | 1 - 539 files changed, 12470 insertions(+), 715 deletions(-) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 build/core/gn/BUILD.gn create mode 100644 tooling/dynamic/BUILD.gn rename tooling/{ => dynamic}/agent/animation_impl.cpp (100%) rename tooling/{ => dynamic}/agent/animation_impl.h (100%) rename tooling/{ => dynamic}/agent/css_impl.cpp (100%) rename tooling/{ => dynamic}/agent/css_impl.h (100%) rename tooling/{ => dynamic}/agent/debugger_impl.cpp (99%) rename tooling/{ => dynamic}/agent/debugger_impl.h (99%) rename tooling/{ => dynamic}/agent/dom_impl.cpp (100%) rename tooling/{ => dynamic}/agent/dom_impl.h (100%) rename tooling/{ => dynamic}/agent/heapprofiler_impl.cpp (100%) rename tooling/{ => dynamic}/agent/heapprofiler_impl.h (98%) rename tooling/{ => dynamic}/agent/overlay_impl.cpp (100%) rename tooling/{ => dynamic}/agent/overlay_impl.h (100%) rename tooling/{ => dynamic}/agent/page_impl.cpp (100%) rename tooling/{ => dynamic}/agent/page_impl.h (100%) rename tooling/{ => dynamic}/agent/profiler_impl.cpp (100%) rename tooling/{ => dynamic}/agent/profiler_impl.h (97%) rename tooling/{ => dynamic}/agent/runtime_impl.cpp (100%) rename tooling/{ => dynamic}/agent/runtime_impl.h (99%) rename tooling/{ => dynamic}/agent/target_impl.cpp (100%) rename tooling/{ => dynamic}/agent/target_impl.h (100%) rename tooling/{ => dynamic}/agent/tracing_impl.cpp (100%) rename tooling/{ => dynamic}/agent/tracing_impl.h (97%) rename tooling/{ => dynamic}/backend/debugger_executor.cpp (99%) rename tooling/{ => dynamic}/backend/debugger_executor.h (100%) rename tooling/{ => dynamic}/backend/js_pt_hooks.cpp (100%) rename tooling/{ => dynamic}/backend/js_pt_hooks.h (96%) rename tooling/{ => dynamic}/backend/js_single_stepper.cpp (100%) rename tooling/{ => dynamic}/backend/js_single_stepper.h (100%) rename tooling/{ => dynamic}/base/pt_base64.cpp (99%) rename tooling/{ => dynamic}/base/pt_base64.h (100%) rename tooling/{ => dynamic}/base/pt_events.cpp (99%) rename tooling/{ => dynamic}/base/pt_events.h (99%) rename tooling/{ => dynamic}/base/pt_json.cpp (99%) rename tooling/{ => dynamic}/base/pt_json.h (100%) rename tooling/{ => dynamic}/base/pt_params.cpp (97%) rename tooling/{ => dynamic}/base/pt_params.h (99%) rename tooling/{ => dynamic}/base/pt_returns.cpp (99%) rename tooling/{ => dynamic}/base/pt_returns.h (99%) rename tooling/{ => dynamic}/base/pt_script.cpp (95%) rename tooling/{ => dynamic}/base/pt_script.h (98%) rename tooling/{ => dynamic}/base/pt_types.cpp (99%) rename tooling/{ => dynamic}/base/pt_types.h (99%) rename tooling/{ => dynamic}/client/BUILD.gn (85%) rename tooling/{ => dynamic}/client/ark_cli/BUILD.gn (85%) rename tooling/{ => dynamic}/client/ark_cli/main.cpp (98%) rename tooling/{ => dynamic}/client/ark_multi/BUILD.gn (96%) rename tooling/{ => dynamic}/client/ark_multi/ReadMe.md (100%) rename tooling/{ => dynamic}/client/ark_multi/ReadMe_Zh.md (100%) rename tooling/{ => dynamic}/client/ark_multi/main.cpp (99%) rename tooling/{ => dynamic}/client/domain/debugger_client.cpp (99%) rename tooling/{ => dynamic}/client/domain/debugger_client.h (98%) rename tooling/{ => dynamic}/client/domain/heapprofiler_client.cpp (99%) rename tooling/{ => dynamic}/client/domain/heapprofiler_client.h (97%) rename tooling/{ => dynamic}/client/domain/profiler_client.cpp (98%) rename tooling/{ => dynamic}/client/domain/profiler_client.h (98%) rename tooling/{ => dynamic}/client/domain/runtime_client.cpp (98%) rename tooling/{ => dynamic}/client/domain/runtime_client.h (97%) rename tooling/{ => dynamic}/client/domain/test_client.cpp (95%) rename tooling/{ => dynamic}/client/domain/test_client.h (96%) rename tooling/{ => dynamic}/client/manager/breakpoint_manager.cpp (95%) rename tooling/{ => dynamic}/client/manager/breakpoint_manager.h (95%) rename tooling/{ => dynamic}/client/manager/domain_manager.cpp (97%) rename tooling/{ => dynamic}/client/manager/domain_manager.h (88%) rename tooling/{ => dynamic}/client/manager/message_manager.h (100%) rename tooling/{ => dynamic}/client/manager/source_manager.cpp (98%) rename tooling/{ => dynamic}/client/manager/source_manager.h (95%) rename tooling/{ => dynamic}/client/manager/stack_manager.cpp (97%) rename tooling/{ => dynamic}/client/manager/stack_manager.h (95%) rename tooling/{ => dynamic}/client/manager/variable_manager.cpp (99%) rename tooling/{ => dynamic}/client/manager/variable_manager.h (95%) rename tooling/{ => dynamic}/client/manager/watch_manager.cpp (98%) rename tooling/{ => dynamic}/client/manager/watch_manager.h (93%) rename tooling/{ => dynamic}/client/session/session.cpp (98%) rename tooling/{ => dynamic}/client/session/session.h (92%) rename tooling/{ => dynamic}/client/tcpServer/tcp_server.cpp (98%) rename tooling/{ => dynamic}/client/tcpServer/tcp_server.h (100%) rename tooling/{ => dynamic}/client/tcpServer/test/config.py (100%) rename tooling/{ => dynamic}/client/tcpServer/test/js_test_base.py (100%) rename tooling/{ => dynamic}/client/tcpServer/test/js_test_case/__init__.py (100%) rename tooling/{ => dynamic}/client/tcpServer/test/js_test_case/js_test.py (100%) rename tooling/{ => dynamic}/client/tcpServer/test/runtest.py (100%) rename tooling/{ => dynamic}/client/utils/cli_command.cpp (99%) rename tooling/{ => dynamic}/client/utils/cli_command.h (91%) rename tooling/{ => dynamic}/debugger_service.cpp (100%) rename tooling/{ => dynamic}/debugger_service.h (100%) rename tooling/{ => dynamic}/dispatcher.cpp (100%) rename tooling/{ => dynamic}/dispatcher.h (99%) rename tooling/{ => dynamic}/protocol_channel.h (94%) rename tooling/{ => dynamic}/protocol_handler.cpp (100%) rename tooling/{ => dynamic}/protocol_handler.h (100%) rename tooling/{ => dynamic}/test/BUILD.gn (97%) rename tooling/{ => dynamic}/test/animation_impl_test.cpp (100%) rename tooling/{ => dynamic}/test/client_utils/test_actions.h (100%) rename tooling/{ => dynamic}/test/client_utils/test_list.cpp (61%) rename tooling/{ => dynamic}/test/client_utils/test_list.h (100%) rename tooling/{ => dynamic}/test/client_utils/test_util.cpp (96%) rename tooling/{ => dynamic}/test/client_utils/test_util.h (91%) rename tooling/{ => dynamic}/test/debugger_cint_client_test.cpp (95%) rename tooling/{ => dynamic}/test/debugger_cinterp_test.cpp (97%) rename tooling/{ => dynamic}/test/debugger_client_test.cpp (95%) rename tooling/{ => dynamic}/test/debugger_commands_test.cpp (95%) rename tooling/{ => dynamic}/test/debugger_entry_test.cpp (97%) rename tooling/{ => dynamic}/test/debugger_events_test.cpp (99%) rename tooling/{ => dynamic}/test/debugger_impl_test.cpp (100%) rename tooling/{ => dynamic}/test/debugger_params_test.cpp (97%) rename tooling/{ => dynamic}/test/debugger_returns_test.cpp (99%) rename tooling/{ => dynamic}/test/debugger_script_test.cpp (96%) rename tooling/{ => dynamic}/test/debugger_service_test.cpp (100%) rename tooling/{ => dynamic}/test/debugger_types_test.cpp (99%) rename tooling/{ => dynamic}/test/dispatcher_test.cpp (100%) rename tooling/{ => dynamic}/test/dom_impl_test.cpp (100%) rename tooling/{ => dynamic}/test/entry/test_debugger_entry.cpp (94%) rename tooling/{ => dynamic}/test/heapprofiler_impl_test.cpp (100%) rename tooling/{ => dynamic}/test/js_pt_hooks_test.cpp (97%) rename tooling/{ => dynamic}/test/overlay_impl_test.cpp (100%) rename tooling/{ => dynamic}/test/page_impl_test.cpp (100%) rename tooling/{ => dynamic}/test/profiler_impl_test.cpp (100%) rename tooling/{ => dynamic}/test/protocol_handler_test.cpp (100%) rename tooling/{ => dynamic}/test/pt_base64_test.cpp (99%) rename tooling/{ => dynamic}/test/pt_json_test.cpp (99%) rename tooling/{ => dynamic}/test/pt_params_test.cpp (99%) rename tooling/{ => dynamic}/test/pt_returns_test.cpp (99%) rename tooling/{ => dynamic}/test/pt_types_test.cpp (99%) rename tooling/{ => dynamic}/test/runtime_impl_test.cpp (97%) rename tooling/{ => dynamic}/test/target_impl_test.cpp (100%) rename tooling/{ => dynamic}/test/testcases/js/arrow_func.js (100%) rename tooling/{ => dynamic}/test/testcases/js/async_func.js (100%) rename tooling/{ => dynamic}/test/testcases/js/branch.js (100%) rename tooling/{ => dynamic}/test/testcases/js/closure_scope.js (100%) rename tooling/{ => dynamic}/test/testcases/js/closure_variable.js (100%) rename tooling/{ => dynamic}/test/testcases/js/common_func.js (100%) rename tooling/{ => dynamic}/test/testcases/js/container.js (100%) rename tooling/{ => dynamic}/test/testcases/js/dropframe.js (100%) rename tooling/{ => dynamic}/test/testcases/js/exception.js (100%) rename tooling/{ => dynamic}/test/testcases/js/export_variable_first.js (100%) rename tooling/{ => dynamic}/test/testcases/js/export_variable_second.js (100%) rename tooling/{ => dynamic}/test/testcases/js/local_export.js (100%) rename tooling/{ => dynamic}/test/testcases/js/local_variable_scope.js (100%) rename tooling/{ => dynamic}/test/testcases/js/module_variable.js (100%) rename tooling/{ => dynamic}/test/testcases/js/module_watch.js (100%) rename tooling/{ => dynamic}/test/testcases/js/promise.js (100%) rename tooling/{ => dynamic}/test/testcases/js/range_error.js (100%) rename tooling/{ => dynamic}/test/testcases/js/sample.js (100%) rename tooling/{ => dynamic}/test/testcases/js/smart_stepInto.js (100%) rename tooling/{ => dynamic}/test/testcases/js/step.js (100%) rename tooling/{ => dynamic}/test/testcases/js/syntax_exception.js (100%) rename tooling/{ => dynamic}/test/testcases/js/throw_exception.js (100%) rename tooling/{ => dynamic}/test/testcases/js/variable_first.js (100%) rename tooling/{ => dynamic}/test/testcases/js/variable_second.js (100%) rename tooling/{ => dynamic}/test/testcases/js/watch_variable.js (100%) rename tooling/{ => dynamic}/test/testcases/js_accelerate_launch_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_allocationtrack_loop_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_allocationtrack_recursion_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_allocationtrack_test.h (96%) rename tooling/{ => dynamic}/test/testcases/js_asyn_stack_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_breakpoint_arrow_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_breakpoint_async_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_breakpoint_cannot_hit_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_breakpoint_in_different_branch.h (98%) rename tooling/{ => dynamic}/test/testcases/js_breakpoint_loop_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_breakpoint_recursion_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_breakpoint_switch_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_breakpoint_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_closure_scope_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_container_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_cpuprofile_async_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_cpuprofile_loop_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_cpuprofile_recursion_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_cpuprofile_step_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_cpuprofile_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_dropframe_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_exception_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_heapdump_loop_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_heapdump_test.h (96%) rename tooling/{ => dynamic}/test/testcases/js_heapprofiler_dump_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_heapsampling_loop_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_heapsampling_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_heapusage_async_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_heapusage_loop_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_heapusage_recursion_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_heapusage_step_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_heapusage_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_local_variable_scope_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_module_variable_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_multiple_breakpoint_in_function_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_multiple_common_breakpoint_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_range_error_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_single_step_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_smart_stepInto_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_source_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_special_location_breakpoint_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_step_into_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_step_out_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_step_over_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_stepinto_and_stepout_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepinto_arrow_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepinto_async_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepinto_loop_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepinto_recursion_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepinto_switch_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepinto_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepout_arrow_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepout_async_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepout_before_function_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepout_loop_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepout_recursion_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepout_switch_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepout_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepover_loop_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepover_recursion_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepover_switch_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_stepover_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_symbolbreakpoint_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_syntax_exception_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_throw_exception_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_tracing_test.h (98%) rename tooling/{ => dynamic}/test/testcases/js_variable_first_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_variable_second_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_watch_basic_type_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_watch_closure_variable_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_watch_module_test.h (100%) rename tooling/{ => dynamic}/test/testcases/js_watch_other_type_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_watch_set_type_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_watch_test.h (99%) rename tooling/{ => dynamic}/test/testcases/js_watch_variable_test.h (99%) rename tooling/{ => dynamic}/test/tracing_impl_test.cpp (100%) rename tooling/{ => dynamic}/test/utils/test_channel.h (97%) rename tooling/{ => dynamic}/test/utils/test_entry.cpp (100%) rename tooling/{ => dynamic}/test/utils/test_entry.h (100%) rename tooling/{ => dynamic}/test/utils/test_events.h (100%) rename tooling/{ => dynamic}/test/utils/test_extractor.cpp (100%) rename tooling/{ => dynamic}/test/utils/test_extractor.h (100%) rename tooling/{ => dynamic}/test/utils/test_hooks.h (100%) rename tooling/{ => dynamic}/test/utils/test_list.cpp (100%) rename tooling/{ => dynamic}/test/utils/test_list.h (100%) rename tooling/{ => dynamic}/test/utils/test_util.cpp (100%) rename tooling/{ => dynamic}/test/utils/test_util.h (100%) rename tooling/{ => dynamic}/utils/utils.cpp (99%) rename tooling/{ => dynamic}/utils/utils.h (100%) create mode 100644 tooling/static/BUILD.gn create mode 100644 tooling/static/CMakeLists.txt create mode 100644 tooling/static/common.h create mode 100644 tooling/static/connection/asio/asio_config.h create mode 100644 tooling/static/connection/asio/asio_server.cpp create mode 100644 tooling/static/connection/asio/asio_server.h create mode 100644 tooling/static/connection/asio/server_endpoint-inl.h create mode 100644 tooling/static/connection/asio/server_endpoint.h create mode 100644 tooling/static/connection/asio/ws_logger.cpp create mode 100644 tooling/static/connection/asio/ws_logger.h create mode 100644 tooling/static/connection/endpoint_base.cpp create mode 100644 tooling/static/connection/endpoint_base.h create mode 100644 tooling/static/connection/event_loop.cpp create mode 100644 tooling/static/connection/event_loop.h create mode 100644 tooling/static/connection/ohos_ws/ohos_ws_server.cpp create mode 100644 tooling/static/connection/ohos_ws/ohos_ws_server.h create mode 100644 tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.cpp create mode 100644 tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.h create mode 100644 tooling/static/connection/server.h create mode 100644 tooling/static/connection/server_endpoint_base.cpp create mode 100644 tooling/static/connection/server_endpoint_base.h create mode 100644 tooling/static/debugger/breakpoint.cpp create mode 100644 tooling/static/debugger/breakpoint.h create mode 100644 tooling/static/debugger/breakpoint_base.h create mode 100644 tooling/static/debugger/breakpoint_storage.cpp create mode 100644 tooling/static/debugger/breakpoint_storage.h create mode 100644 tooling/static/debugger/conditional_breakpoint.cpp create mode 100644 tooling/static/debugger/conditional_breakpoint.h create mode 100644 tooling/static/debugger/debug_info_cache.cpp create mode 100644 tooling/static/debugger/debug_info_cache.h create mode 100644 tooling/static/debugger/debuggable_thread.cpp create mode 100644 tooling/static/debugger/debuggable_thread.h create mode 100644 tooling/static/debugger/object_repository.cpp create mode 100644 tooling/static/debugger/object_repository.h create mode 100644 tooling/static/debugger/thread_state.cpp create mode 100644 tooling/static/debugger/thread_state.h create mode 100644 tooling/static/debugger_arkapi.cpp create mode 100644 tooling/static/debugger_arkapi.h create mode 100644 tooling/static/error.cpp create mode 100644 tooling/static/error.h create mode 100644 tooling/static/evaluation/base64.h create mode 100644 tooling/static/evaluation/evaluation_engine.cpp create mode 100644 tooling/static/evaluation/evaluation_engine.h create mode 100644 tooling/static/init.cpp create mode 100644 tooling/static/inspector.cpp create mode 100644 tooling/static/inspector.h create mode 100644 tooling/static/inspector_server.cpp create mode 100644 tooling/static/inspector_server.h create mode 100644 tooling/static/json_serialization/jrpc_error.cpp create mode 100644 tooling/static/json_serialization/jrpc_error.h create mode 100644 tooling/static/json_serialization/serializable.h create mode 100644 tooling/static/session_manager.cpp create mode 100644 tooling/static/session_manager.h create mode 100644 tooling/static/source_manager.cpp create mode 100644 tooling/static/source_manager.h create mode 100644 tooling/static/tests/base64.cpp create mode 100644 tooling/static/tests/common.h create mode 100644 tooling/static/tests/debug_info_cache.cpp create mode 100644 tooling/static/tests/inspector_server.cpp create mode 100644 tooling/static/tests/json_object_matcher.cpp create mode 100644 tooling/static/tests/json_object_matcher.h create mode 100644 tooling/static/tests/object_repository.cpp create mode 100644 tooling/static/tests/session_manager.cpp create mode 100644 tooling/static/tests/source_manager.cpp create mode 100644 tooling/static/tests/test_frame.h create mode 100644 tooling/static/tests/thread_state.cpp create mode 100644 tooling/static/types/custom_url_breakpoint_response.cpp create mode 100644 tooling/static/types/custom_url_breakpoint_response.h create mode 100644 tooling/static/types/debugger_call_function_on_request.cpp create mode 100644 tooling/static/types/debugger_call_function_on_request.h create mode 100644 tooling/static/types/debugger_evaluation_request.cpp create mode 100644 tooling/static/types/debugger_evaluation_request.h create mode 100644 tooling/static/types/evaluation_result.h create mode 100644 tooling/static/types/exception_details.cpp create mode 100644 tooling/static/types/exception_details.h create mode 100644 tooling/static/types/location.cpp create mode 100644 tooling/static/types/location.h create mode 100644 tooling/static/types/numeric_id.h create mode 100644 tooling/static/types/object_preview.cpp create mode 100644 tooling/static/types/object_preview.h create mode 100644 tooling/static/types/pause_on_exceptions_state.h create mode 100644 tooling/static/types/possible_breakpoints_response.h create mode 100644 tooling/static/types/profile_result.cpp create mode 100644 tooling/static/types/profile_result.h create mode 100644 tooling/static/types/property_descriptor.h create mode 100644 tooling/static/types/property_preview.h create mode 100644 tooling/static/types/remote_object.cpp create mode 100644 tooling/static/types/remote_object.h create mode 100644 tooling/static/types/remote_object_type.h create mode 100644 tooling/static/types/scope.cpp create mode 100644 tooling/static/types/scope.h create mode 100644 tooling/static/types/script_source_response.h create mode 100644 tooling/static/types/url_breakpoint_request.cpp create mode 100644 tooling/static/types/url_breakpoint_request.h create mode 100644 tooling/static/types/url_breakpoint_response.cpp create mode 100644 tooling/static/types/url_breakpoint_response.h diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 00000000..cea4d3f4 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "windows-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "gcc", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "windows-gcc-x64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..308b9088 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": true, + "cwd": "//wsl.localhost/Ubuntu-24.04/home/fangting/0702_master/arkcompiler_toolchain/tooling/dynamic/client/ark_multi", + "program": "//wsl.localhost/Ubuntu-24.04/home/fangting/0702_master/arkcompiler_toolchain/tooling/dynamic/client/ark_multi/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..bb879da5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,59 @@ +{ + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "C_Cpp_Runner.msvcSecureNoWarnings": false +} \ No newline at end of file diff --git a/BUILD.gn b/BUILD.gn index 120bf836..6e2cea7d 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -236,7 +236,7 @@ config("toolchain_test_config") { visibility = [ "./inspector/test/*", "./test/fuzztest/*", - "./tooling/test/*", + "./tooling/dynamic/test/*", "./websocket/test/*", ] @@ -253,9 +253,9 @@ group("ark_toolchain_packages") { "./inspector:ark_debugger", "./inspector:connectserver_debugger", "./tooling:libark_ecma_debugger", - "./tooling/client:libark_client", - "./tooling/client/ark_cli:arkdb", - "./tooling/client/ark_multi:ark_multi", + "./tooling/dynamic/client:libark_client", + "./tooling/dynamic/client/ark_cli:arkdb", + "./tooling/dynamic/client/ark_multi:ark_multi", ] } @@ -264,7 +264,7 @@ group("ark_toolchain_unittest") { deps = [] deps += [ "./inspector/test:unittest", - "./tooling/test:unittest", + "./tooling/dynamic/test:unittest", "./websocket/test:unittest", ] if (is_ohos && is_standard_system) { @@ -279,7 +279,7 @@ group("ark_toolchain_host_unittest") { # js unittest deps += [ "./inspector/test:host_unittest", - "./tooling/test:host_unittest", + "./tooling/dynamic/test:host_unittest", "./websocket/test:host_unittest", ] } diff --git a/build/core/gn/BUILD.gn b/build/core/gn/BUILD.gn new file mode 100644 index 00000000..e7f0c607 --- /dev/null +++ b/build/core/gn/BUILD.gn @@ -0,0 +1,140 @@ +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//arkcompiler/toolchain/toolchain.gni") +import("$build_root/config/components/ets_frontend/ets_frontend_config.gni") + +print("root_out_dir=$root_out_dir") +print("root_build_dir=$root_build_dir") +print("root_gen_dir=$root_gen_dir") +print("default_toolchain=$default_toolchain") +print("current_toolchain=$current_toolchain") +print("host_toolchain=$host_toolchain") +print("current_os=$current_os, current_cpu=$current_cpu") +print("host_os=$host_os, host_cpu=$host_cpu") +print("target_os=$target_os, target_cpu=$target_cpu") + +print() + +group("default") { + deps = [ + ":ets_frontend", + ":ets_runtime", + ":runtime_core", + ":toolchain", + ] +} + +group("unittest_packages") { + testonly = true + deps = [ + "$js_root:ark_runtime_host_unittest", + "$toolchain_root:ark_toolchain_host_unittest", + ] +} + +group("runtime_core_unittest_packages") { + testonly = true + deps = [ "$toolchain_root:runtime_core_host_ut" ] +} + +group("ets_runtime") { + deps = [ + "$js_root:js_type_metadata", + "$js_root:libark_jsruntime", + "$js_root/ecmascript/dfx/hprof:ark_js_heap_snapshot_tool", + "$js_root/ecmascript/dfx/hprof/rawheap_translate:rawheap_translator", + "$js_root/ecmascript/js_vm:ark_js_vm", + "$js_root/ecmascript/quick_fix:quick_fix", + ] + if ((target_os == "linux" && target_cpu == "x64") || + (target_cpu == "arm64" && target_os == "ohos") || + (target_cpu == "arm64" && target_os == "mac")) { + deps += [ + "$js_root/ecmascript/compiler:ark_aot_compiler", + "$js_root/ecmascript/compiler:ark_stub_compiler", + "$js_root/ecmascript/compiler:libark_jsoptimizer", + "$js_root/ecmascript/compiler:stub.an", + "$js_root/ecmascript/pgo_profiler/prof_dump:profdump", + ] + } +} + +group("ets_frontend") { + if ((target_os == "linux" && target_cpu == "x64") || target_os == "mingw" || + target_os == "mac") { + deps = [ + "$ets_frontend_root/es2panda:es2panda", + "$ets_frontend_root/merge_abc:merge_abc", + ] + if (target_os != "mac") { + deps += [ "$ets_frontend_root/ets2panda/lsp:lsp_packages" ] + } + } +} + +group("runtime_core") { + deps = [ + "$ark_root:ark_host_defectscanaux_tools", + "$ark_root/disassembler:ark_disasm", + ] +} + +group("static_core") { + deps = [ + "$ark_root/static_core/assembler:libarktsassembler", + "$ark_root/static_core/compiler:libarktscompiler", + "$ark_root/static_core/libpandabase:libarktsbase", + "$ark_root/static_core/libpandafile:libarktsfile", + ] + if (target_os != "mac") { + deps += [ "$ark_root/static_core/static_linker:static_linker" ] + } + if (target_os != "mingw" && target_os != "mac") { + deps += [ "$ark_root/static_core/runtime:libarkruntime" ] + } +} + +group("hybrid") { + deps = [ + ":ets_frontend", + ":ets_runtime", + ":static_core", + "$ark_root/static_core/plugins/ets:etsstdlib(${host_toolchain})", + ] + if (target_os != "mingw" && target_os != "mac") { + deps += [ + "$ark_root/static_core/plugins/ets/runtime/interop_js:ets_interop_js_napi", + "$ark_root/static_core/plugins/ets/tests/interop_js/test_helper:interop_test_helper", + "$ark_root/static_core/tools/ark_js_napi_cli:ark_js_napi_cli", + ] + } +} + +group("toolchain") { + deps = [] + if (target_cpu != "mipsel") { + deps += [ + "$toolchain_root/inspector:ark_debugger", + "$toolchain_root/inspector:connectserver_debugger", + "$toolchain_root/tooling:libark_ecma_debugger", + ] + } + if (target_os != "mingw") { + deps += [ + "$toolchain_root/tooling/dynamic/client:libark_client", + "$toolchain_root/tooling/dynamic/client/ark_cli:arkdb", + "$toolchain_root/tooling/dynamic/client/ark_multi:ark_multi", + ] + } +} diff --git a/inspector/BUILD.gn b/inspector/BUILD.gn index 607bd80a..b7703724 100644 --- a/inspector/BUILD.gn +++ b/inspector/BUILD.gn @@ -99,7 +99,7 @@ ohos_source_set("connectserver_debugger_static") { deps = [ "../websocket:libwebsocket_server" ] sources = [ "../common/log_wrapper.cpp", - "../tooling/base/pt_json.cpp", + "../tooling/dynamic/base/pt_json.cpp", "connect_inspector.cpp", "connect_server.cpp", ] diff --git a/inspector/connect_inspector.cpp b/inspector/connect_inspector.cpp index a51f4973..1d975852 100644 --- a/inspector/connect_inspector.cpp +++ b/inspector/connect_inspector.cpp @@ -18,7 +18,7 @@ #include #include "common/log_wrapper.h" -#include "tooling/base/pt_json.h" +#include "tooling/dynamic/base/pt_json.h" #include "ws_server.h" namespace OHOS::ArkCompiler::Toolchain { diff --git a/inspector/inspector.cpp b/inspector/inspector.cpp index 755ac392..6af88825 100644 --- a/inspector/inspector.cpp +++ b/inspector/inspector.cpp @@ -28,7 +28,7 @@ #include "library_loader.h" #if defined(IOS_PLATFORM) -#include "tooling/debugger_service.h" +#include "tooling/dynamic/debugger_service.h" #endif #if defined(ENABLE_FFRT_INTERFACES) diff --git a/test/fuzztest/agent/heapprofiler/heapprofileraddinspectedheapobject_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofileraddinspectedheapobject_fuzzer/BUILD.gn index 3e4c043a..18f24553 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofileraddinspectedheapobject_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofileraddinspectedheapobject_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("HeapprofilerAddInspectedHeapObjectFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofileraddinspectedheapobject_fuzzer/heapprofileraddinspectedheapobject_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofileraddinspectedheapobject_fuzzer/heapprofileraddinspectedheapobject_fuzzer.cpp index 30d5a75d..99a51698 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofileraddinspectedheapobject_fuzzer/heapprofileraddinspectedheapobject_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofileraddinspectedheapobject_fuzzer/heapprofileraddinspectedheapobject_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofileraddinspectedheapobject_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilercollectgarbage_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilercollectgarbage_fuzzer/BUILD.gn index 5315851e..eabb5dd8 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilercollectgarbage_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilercollectgarbage_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("HeapprofilerCollectgarbageFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilercollectgarbage_fuzzer/heapprofilercollectgarbage_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilercollectgarbage_fuzzer/heapprofilercollectgarbage_fuzzer.cpp index 32dfc129..ed966674 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilercollectgarbage_fuzzer/heapprofilercollectgarbage_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilercollectgarbage_fuzzer/heapprofilercollectgarbage_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilercollectgarbage_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerdisable_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilerdisable_fuzzer/BUILD.gn index 0710ee66..94bc5821 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerdisable_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilerdisable_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("HeapprofilerDisableFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerdisable_fuzzer/heapprofilerdisable_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilerdisable_fuzzer/heapprofilerdisable_fuzzer.cpp index da6fbf1a..0d80bd9e 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerdisable_fuzzer/heapprofilerdisable_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilerdisable_fuzzer/heapprofilerdisable_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilerdisable_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerdispatch_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilerdispatch_fuzzer/BUILD.gn index 856a33e4..b9407316 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerdispatch_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilerdispatch_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("HeapprofilerDispatchFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerdispatch_fuzzer/heapprofilerdispatch_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilerdispatch_fuzzer/heapprofilerdispatch_fuzzer.cpp index b59b335a..5c7c8691 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerdispatch_fuzzer/heapprofilerdispatch_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilerdispatch_fuzzer/heapprofilerdispatch_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilerdispatch_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerenable_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilerenable_fuzzer/BUILD.gn index 6691e971..91ca56e7 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerenable_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilerenable_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("HeapprofilerEnableFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerenable_fuzzer/heapprofilerenable_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilerenable_fuzzer/heapprofilerenable_fuzzer.cpp index 09d67d66..5b30b35e 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerenable_fuzzer/heapprofilerenable_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilerenable_fuzzer/heapprofilerenable_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilerenable_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilergetheapobjectid_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilergetheapobjectid_fuzzer/BUILD.gn index 5e753384..bc3505d6 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilergetheapobjectid_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilergetheapobjectid_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("HeapprofilerGetheapObjectIdFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilergetheapobjectid_fuzzer/heapprofilergetheapobjectid_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilergetheapobjectid_fuzzer/heapprofilergetheapobjectid_fuzzer.cpp index 32886181..84288d2b 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilergetheapobjectid_fuzzer/heapprofilergetheapobjectid_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilergetheapobjectid_fuzzer/heapprofilergetheapobjectid_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilergetheapobjectid_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilergetobjectbyheapobjectid_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilergetobjectbyheapobjectid_fuzzer/BUILD.gn index 9c3c062d..4ae7f623 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilergetobjectbyheapobjectid_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilergetobjectbyheapobjectid_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("HeapprofilerGetObjectByHeapObjectIdFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilergetobjectbyheapobjectid_fuzzer/heapprofilergetobjectbyheapobjectid_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilergetobjectbyheapobjectid_fuzzer/heapprofilergetobjectbyheapobjectid_fuzzer.cpp index b4bc0a18..46691209 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilergetobjectbyheapobjectid_fuzzer/heapprofilergetobjectbyheapobjectid_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilergetobjectbyheapobjectid_fuzzer/heapprofilergetobjectbyheapobjectid_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilergetobjectbyheapobjectid_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilergetsamplingprofile_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilergetsamplingprofile_fuzzer/BUILD.gn index d57422f3..6910147f 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilergetsamplingprofile_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilergetsamplingprofile_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("HeapprofilerGetSamplingProfileFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilergetsamplingprofile_fuzzer/heapprofilergetsamplingprofile_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilergetsamplingprofile_fuzzer/heapprofilergetsamplingprofile_fuzzer.cpp index 6e08b171..520473ad 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilergetsamplingprofile_fuzzer/heapprofilergetsamplingprofile_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilergetsamplingprofile_fuzzer/heapprofilergetsamplingprofile_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilergetsamplingprofile_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerstartsampling_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilerstartsampling_fuzzer/BUILD.gn index ba8d4a35..eb9f3070 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerstartsampling_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilerstartsampling_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("HeapprofilerStartSamplingFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerstartsampling_fuzzer/heapprofilerstartsampling_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilerstartsampling_fuzzer/heapprofilerstartsampling_fuzzer.cpp index 2a8155f4..62be4592 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerstartsampling_fuzzer/heapprofilerstartsampling_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilerstartsampling_fuzzer/heapprofilerstartsampling_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilerstartsampling_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerstarttrackingheapobjects_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilerstarttrackingheapobjects_fuzzer/BUILD.gn index 2d460555..ebe99a24 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerstarttrackingheapobjects_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilerstarttrackingheapobjects_fuzzer/BUILD.gn @@ -30,7 +30,7 @@ ohos_fuzztest("HeapprofilerStartTrackingHeapObjectsFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerstarttrackingheapobjects_fuzzer/heapprofilerstarttrackingheapobjects_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilerstarttrackingheapobjects_fuzzer/heapprofilerstarttrackingheapobjects_fuzzer.cpp index 266919c1..7a78f7d0 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerstarttrackingheapobjects_fuzzer/heapprofilerstarttrackingheapobjects_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilerstarttrackingheapobjects_fuzzer/heapprofilerstarttrackingheapobjects_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilerstarttrackingheapobjects_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerstopsampling_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilerstopsampling_fuzzer/BUILD.gn index 581da693..9b45b066 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerstopsampling_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilerstopsampling_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("HeapprofilerStopSamplingFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerstopsampling_fuzzer/heapprofilerstopsampling_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilerstopsampling_fuzzer/heapprofilerstopsampling_fuzzer.cpp index f7fc9ff5..9800789d 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerstopsampling_fuzzer/heapprofilerstopsampling_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilerstopsampling_fuzzer/heapprofilerstopsampling_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilerstopsampling_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerstoptrackingheapobjects_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilerstoptrackingheapobjects_fuzzer/BUILD.gn index 870dbc8d..c185b9a8 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerstoptrackingheapobjects_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilerstoptrackingheapobjects_fuzzer/BUILD.gn @@ -30,7 +30,7 @@ ohos_fuzztest("HeapprofilerStopTrackingHeapObjectsFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilerstoptrackingheapobjects_fuzzer/heapprofilerstoptrackingheapobjects_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilerstoptrackingheapobjects_fuzzer/heapprofilerstoptrackingheapobjects_fuzzer.cpp index 5d73c2c2..5b05770c 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilerstoptrackingheapobjects_fuzzer/heapprofilerstoptrackingheapobjects_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilerstoptrackingheapobjects_fuzzer/heapprofilerstoptrackingheapobjects_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilerstoptrackingheapobjects_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/agent/heapprofiler/heapprofilertakeheapsnapshot_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofilertakeheapsnapshot_fuzzer/BUILD.gn index ab388efe..6759fb72 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilertakeheapsnapshot_fuzzer/BUILD.gn +++ b/test/fuzztest/agent/heapprofiler/heapprofilertakeheapsnapshot_fuzzer/BUILD.gn @@ -30,7 +30,7 @@ ohos_fuzztest("HeapprofilerTakeHeapSnapshotFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/agent/heapprofiler/heapprofilertakeheapsnapshot_fuzzer/heapprofilertakeheapsnapshot_fuzzer.cpp b/test/fuzztest/agent/heapprofiler/heapprofilertakeheapsnapshot_fuzzer/heapprofilertakeheapsnapshot_fuzzer.cpp index d2013f5c..e7c51991 100644 --- a/test/fuzztest/agent/heapprofiler/heapprofilertakeheapsnapshot_fuzzer/heapprofilertakeheapsnapshot_fuzzer.cpp +++ b/test/fuzztest/agent/heapprofiler/heapprofilertakeheapsnapshot_fuzzer/heapprofilertakeheapsnapshot_fuzzer.cpp @@ -16,7 +16,7 @@ #include "heapprofilertakeheapsnapshot_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/heapprofiler_impl.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/backend/backendbreakpoint_fuzzer/BUILD.gn b/test/fuzztest/backend/backendbreakpoint_fuzzer/BUILD.gn index 09f9ffe7..2f9570ec 100644 --- a/test/fuzztest/backend/backendbreakpoint_fuzzer/BUILD.gn +++ b/test/fuzztest/backend/backendbreakpoint_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("BackendBreakpointFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/backend/backendbreakpoint_fuzzer/backendbreakpoint_fuzzer.cpp b/test/fuzztest/backend/backendbreakpoint_fuzzer/backendbreakpoint_fuzzer.cpp index 9a29531c..35d598f9 100644 --- a/test/fuzztest/backend/backendbreakpoint_fuzzer/backendbreakpoint_fuzzer.cpp +++ b/test/fuzztest/backend/backendbreakpoint_fuzzer/backendbreakpoint_fuzzer.cpp @@ -16,7 +16,7 @@ #include "backendbreakpoint_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/debugger_impl.h" -#include "tooling/backend/js_pt_hooks.h" +#include "tooling/dynamic/backend/js_pt_hooks.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/backend/backendexception_fuzzer/BUILD.gn b/test/fuzztest/backend/backendexception_fuzzer/BUILD.gn index b8035b36..92b40fa8 100644 --- a/test/fuzztest/backend/backendexception_fuzzer/BUILD.gn +++ b/test/fuzztest/backend/backendexception_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("BackendExceptionFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/backend/backendexception_fuzzer/backendexception_fuzzer.cpp b/test/fuzztest/backend/backendexception_fuzzer/backendexception_fuzzer.cpp index 21c878b3..4eb5f731 100644 --- a/test/fuzztest/backend/backendexception_fuzzer/backendexception_fuzzer.cpp +++ b/test/fuzztest/backend/backendexception_fuzzer/backendexception_fuzzer.cpp @@ -16,7 +16,7 @@ #include "backendexception_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/debugger_impl.h" -#include "tooling/backend/js_pt_hooks.h" +#include "tooling/dynamic/backend/js_pt_hooks.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/backend/backendloadmodule_fuzzer/BUILD.gn b/test/fuzztest/backend/backendloadmodule_fuzzer/BUILD.gn index 0fdb8000..04e6206a 100644 --- a/test/fuzztest/backend/backendloadmodule_fuzzer/BUILD.gn +++ b/test/fuzztest/backend/backendloadmodule_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("BackendLoadModuleFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/backend/backendloadmodule_fuzzer/backendloadmodule_fuzzer.cpp b/test/fuzztest/backend/backendloadmodule_fuzzer/backendloadmodule_fuzzer.cpp index f9fe087d..1a692b1c 100644 --- a/test/fuzztest/backend/backendloadmodule_fuzzer/backendloadmodule_fuzzer.cpp +++ b/test/fuzztest/backend/backendloadmodule_fuzzer/backendloadmodule_fuzzer.cpp @@ -16,7 +16,7 @@ #include "backendloadmodule_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/debugger_impl.h" -#include "tooling/backend/js_pt_hooks.h" +#include "tooling/dynamic/backend/js_pt_hooks.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/backend/backendnativecalling_fuzzer/BUILD.gn b/test/fuzztest/backend/backendnativecalling_fuzzer/BUILD.gn index 8717b255..f7531a8e 100644 --- a/test/fuzztest/backend/backendnativecalling_fuzzer/BUILD.gn +++ b/test/fuzztest/backend/backendnativecalling_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("BackendNativeCallingFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/backend/backendnativecalling_fuzzer/backendnativecalling_fuzzer.cpp b/test/fuzztest/backend/backendnativecalling_fuzzer/backendnativecalling_fuzzer.cpp index 3732cc86..9c52e478 100644 --- a/test/fuzztest/backend/backendnativecalling_fuzzer/backendnativecalling_fuzzer.cpp +++ b/test/fuzztest/backend/backendnativecalling_fuzzer/backendnativecalling_fuzzer.cpp @@ -16,7 +16,7 @@ #include "backendnativecalling_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/debugger_impl.h" -#include "tooling/backend/js_pt_hooks.h" +#include "tooling/dynamic/backend/js_pt_hooks.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/backend/backendsinglestep_fuzzer/BUILD.gn b/test/fuzztest/backend/backendsinglestep_fuzzer/BUILD.gn index 29ff1ad2..202e7e76 100644 --- a/test/fuzztest/backend/backendsinglestep_fuzzer/BUILD.gn +++ b/test/fuzztest/backend/backendsinglestep_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("BackendSingleStepFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/backend/backendsinglestep_fuzzer/backendsinglestep_fuzzer.cpp b/test/fuzztest/backend/backendsinglestep_fuzzer/backendsinglestep_fuzzer.cpp index b25dbc07..db8dcefa 100644 --- a/test/fuzztest/backend/backendsinglestep_fuzzer/backendsinglestep_fuzzer.cpp +++ b/test/fuzztest/backend/backendsinglestep_fuzzer/backendsinglestep_fuzzer.cpp @@ -16,7 +16,7 @@ #include "backendsinglestep_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" #include "agent/debugger_impl.h" -#include "tooling/backend/js_pt_hooks.h" +#include "tooling/dynamic/backend/js_pt_hooks.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/base/ptbase64/baseptbase64decode_fuzzer/BUILD.gn b/test/fuzztest/base/ptbase64/baseptbase64decode_fuzzer/BUILD.gn index 7a23a8ea..a2bddf05 100644 --- a/test/fuzztest/base/ptbase64/baseptbase64decode_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptbase64/baseptbase64decode_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtBase64DecodeFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptbase64/baseptbase64decode_fuzzer/baseptbase64decode_fuzzer.cpp b/test/fuzztest/base/ptbase64/baseptbase64decode_fuzzer/baseptbase64decode_fuzzer.cpp index 33d44535..d55b01c8 100644 --- a/test/fuzztest/base/ptbase64/baseptbase64decode_fuzzer/baseptbase64decode_fuzzer.cpp +++ b/test/fuzztest/base/ptbase64/baseptbase64decode_fuzzer/baseptbase64decode_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptbase64decode_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_base64.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_base64.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptbase64/baseptbase64encode_fuzzer/BUILD.gn b/test/fuzztest/base/ptbase64/baseptbase64encode_fuzzer/BUILD.gn index 8e151f12..3d176fd6 100644 --- a/test/fuzztest/base/ptbase64/baseptbase64encode_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptbase64/baseptbase64encode_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtBase64EncodeFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptbase64/baseptbase64encode_fuzzer/baseptbase64encode_fuzzer.cpp b/test/fuzztest/base/ptbase64/baseptbase64encode_fuzzer/baseptbase64encode_fuzzer.cpp index 91245d81..ffebe0a0 100644 --- a/test/fuzztest/base/ptbase64/baseptbase64encode_fuzzer/baseptbase64encode_fuzzer.cpp +++ b/test/fuzztest/base/ptbase64/baseptbase64encode_fuzzer/baseptbase64encode_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptbase64encode_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_base64.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_base64.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetbreakpointid_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetbreakpointid_fuzzer/BUILD.gn index cf0e0dc5..2ffcb786 100644 --- a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetbreakpointid_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetbreakpointid_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsBreakpointGetBreakpointIdFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetbreakpointid_fuzzer/baseptsbreakpointgetbreakpointid_fuzzer.cpp b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetbreakpointid_fuzzer/baseptsbreakpointgetbreakpointid_fuzzer.cpp index b10ce3ee..bb40b9ab 100644 --- a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetbreakpointid_fuzzer/baseptsbreakpointgetbreakpointid_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetbreakpointid_fuzzer/baseptsbreakpointgetbreakpointid_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptsbreakpointgetbreakpointid_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetlocation_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetlocation_fuzzer/BUILD.gn index 5b797668..e928fc34 100644 --- a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetlocation_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetlocation_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsBreakpointGetLocationFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetlocation_fuzzer/baseptsbreakpointgetlocation_fuzzer.cpp b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetlocation_fuzzer/baseptsbreakpointgetlocation_fuzzer.cpp index 8e0defb9..89a39193 100644 --- a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetlocation_fuzzer/baseptsbreakpointgetlocation_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetlocation_fuzzer/baseptsbreakpointgetlocation_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptsbreakpointgetlocation_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetname_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetname_fuzzer/BUILD.gn index 1bbe450d..5eb489bd 100644 --- a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetname_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetname_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsBreakpointGetNameFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetname_fuzzer/baseptsbreakpointgetname_fuzzer.cpp b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetname_fuzzer/baseptsbreakpointgetname_fuzzer.cpp index 3499d097..e058a3f7 100644 --- a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetname_fuzzer/baseptsbreakpointgetname_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointgetname_fuzzer/baseptsbreakpointgetname_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptsbreakpointgetname_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetbreakpointid_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetbreakpointid_fuzzer/BUILD.gn index 75dfe585..c387adfd 100644 --- a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetbreakpointid_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetbreakpointid_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsBreakpointSetBreakpointIdFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetbreakpointid_fuzzer/baseptsbreakpointsetbreakpointid_fuzzer.cpp b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetbreakpointid_fuzzer/baseptsbreakpointsetbreakpointid_fuzzer.cpp index 98a80d50..65729541 100644 --- a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetbreakpointid_fuzzer/baseptsbreakpointsetbreakpointid_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetbreakpointid_fuzzer/baseptsbreakpointsetbreakpointid_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptsbreakpointsetbreakpointid_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetlocation_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetlocation_fuzzer/BUILD.gn index edaba656..b0218c8e 100644 --- a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetlocation_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetlocation_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsBreakpointSetLocationFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetlocation_fuzzer/baseptsbreakpointsetlocation_fuzzer.cpp b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetlocation_fuzzer/baseptsbreakpointsetlocation_fuzzer.cpp index f5943609..8664cafc 100644 --- a/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetlocation_fuzzer/baseptsbreakpointsetlocation_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/breakpointresolved/baseptsbreakpointsetlocation_fuzzer/baseptsbreakpointsetlocation_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptsbreakpointsetlocation_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgetcallframes_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedgetcallframes_fuzzer/BUILD.gn index 6b3a6ba0..b94a6793 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgetcallframes_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgetcallframes_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedGetCallFramesFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgetcallframes_fuzzer/baseptspausedgetcallframes_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedgetcallframes_fuzzer/baseptspausedgetcallframes_fuzzer.cpp index 3cff0a9f..3cef2889 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgetcallframes_fuzzer/baseptspausedgetcallframes_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgetcallframes_fuzzer/baseptspausedgetcallframes_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedgetcallframes_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgetdata_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedgetdata_fuzzer/BUILD.gn index 8a8107c1..3081646a 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgetdata_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgetdata_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedGetDataFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgetdata_fuzzer/baseptspausedgetdata_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedgetdata_fuzzer/baseptspausedgetdata_fuzzer.cpp index b596dfa8..ec235aed 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgetdata_fuzzer/baseptspausedgetdata_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgetdata_fuzzer/baseptspausedgetdata_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedgetdata_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgethitbreakpoints_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedgethitbreakpoints_fuzzer/BUILD.gn index 56c13195..aa6d9f59 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgethitbreakpoints_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgethitbreakpoints_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedGetHitBreakpointsFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgethitbreakpoints_fuzzer/baseptspausedgethitbreakpoints_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedgethitbreakpoints_fuzzer/baseptspausedgethitbreakpoints_fuzzer.cpp index 865283e5..6237fbfc 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgethitbreakpoints_fuzzer/baseptspausedgethitbreakpoints_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgethitbreakpoints_fuzzer/baseptspausedgethitbreakpoints_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedgethitbreakpoints_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgetname_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedgetname_fuzzer/BUILD.gn index 348d980e..f133a42c 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgetname_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgetname_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedGetNameFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgetname_fuzzer/baseptspausedgetname_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedgetname_fuzzer/baseptspausedgetname_fuzzer.cpp index 0e254368..6d635812 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgetname_fuzzer/baseptspausedgetname_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgetname_fuzzer/baseptspausedgetname_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedgetname_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgetreason_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedgetreason_fuzzer/BUILD.gn index fbcb9d4e..58154026 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgetreason_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgetreason_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedGetReasonFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgetreason_fuzzer/baseptspausedgetreason_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedgetreason_fuzzer/baseptspausedgetreason_fuzzer.cpp index 11036971..ecdd72cb 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgetreason_fuzzer/baseptspausedgetreason_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgetreason_fuzzer/baseptspausedgetreason_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedgetreason_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgetreasonstring_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedgetreasonstring_fuzzer/BUILD.gn index e89e0831..f92713a4 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgetreasonstring_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgetreasonstring_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedGetReasonStringFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedgetreasonstring_fuzzer/baseptspausedgetreasonstring_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedgetreasonstring_fuzzer/baseptspausedgetreasonstring_fuzzer.cpp index 677da0ff..8718d7bd 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedgetreasonstring_fuzzer/baseptspausedgetreasonstring_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedgetreasonstring_fuzzer/baseptspausedgetreasonstring_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedgetreasonstring_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedhasdata_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedhasdata_fuzzer/BUILD.gn index 31b8b07d..1d8df7a0 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedhasdata_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedhasdata_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedHasDataFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedhasdata_fuzzer/baseptspausedhasdata_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedhasdata_fuzzer/baseptspausedhasdata_fuzzer.cpp index 501c6c77..7f59ca03 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedhasdata_fuzzer/baseptspausedhasdata_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedhasdata_fuzzer/baseptspausedhasdata_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedhasdata_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedhashitbreakpoints_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedhashitbreakpoints_fuzzer/BUILD.gn index 32d30296..a89aa693 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedhashitbreakpoints_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedhashitbreakpoints_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedHasHitBreakpointsFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedhashitbreakpoints_fuzzer/baseptspausedhashitbreakpoints_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedhashitbreakpoints_fuzzer/baseptspausedhashitbreakpoints_fuzzer.cpp index 32e73477..b3c209ad 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedhashitbreakpoints_fuzzer/baseptspausedhashitbreakpoints_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedhashitbreakpoints_fuzzer/baseptspausedhashitbreakpoints_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedhashitbreakpoints_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedsetcallframes_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedsetcallframes_fuzzer/BUILD.gn index f3562513..10602bd5 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedsetcallframes_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedsetcallframes_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedSetCallFramesFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedsetcallframes_fuzzer/baseptspausedsetcallframes_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedsetcallframes_fuzzer/baseptspausedsetcallframes_fuzzer.cpp index d6ac8eb3..463f315c 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedsetcallframes_fuzzer/baseptspausedsetcallframes_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedsetcallframes_fuzzer/baseptspausedsetcallframes_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedsetcallframes_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedsetdata_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedsetdata_fuzzer/BUILD.gn index 1cbd9505..7e633ca6 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedsetdata_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedsetdata_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedSetDataFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedsetdata_fuzzer/baseptspausedsetdata_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedsetdata_fuzzer/baseptspausedsetdata_fuzzer.cpp index 540dec7e..5aa349f8 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedsetdata_fuzzer/baseptspausedsetdata_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedsetdata_fuzzer/baseptspausedsetdata_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedsetdata_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedsethitbreakpoints_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedsethitbreakpoints_fuzzer/BUILD.gn index a9cd5bd1..c3e7bdd0 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedsethitbreakpoints_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedsethitbreakpoints_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedSetHitBreakpointsFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedsethitbreakpoints_fuzzer/baseptspausedsethitbreakpoints_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedsethitbreakpoints_fuzzer/baseptspausedsethitbreakpoints_fuzzer.cpp index f83b6e49..bfdb6969 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedsethitbreakpoints_fuzzer/baseptspausedsethitbreakpoints_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedsethitbreakpoints_fuzzer/baseptspausedsethitbreakpoints_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedsethitbreakpoints_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedsetreason_fuzzer/BUILD.gn b/test/fuzztest/base/ptevents/paused/baseptspausedsetreason_fuzzer/BUILD.gn index 6ae3ab80..d0fbca68 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedsetreason_fuzzer/BUILD.gn +++ b/test/fuzztest/base/ptevents/paused/baseptspausedsetreason_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("BasePtsPausedSetReasonFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/base/ptevents/paused/baseptspausedsetreason_fuzzer/baseptspausedsetreason_fuzzer.cpp b/test/fuzztest/base/ptevents/paused/baseptspausedsetreason_fuzzer/baseptspausedsetreason_fuzzer.cpp index 45f1466f..f8cd8963 100644 --- a/test/fuzztest/base/ptevents/paused/baseptspausedsetreason_fuzzer/baseptspausedsetreason_fuzzer.cpp +++ b/test/fuzztest/base/ptevents/paused/baseptspausedsetreason_fuzzer/baseptspausedsetreason_fuzzer.cpp @@ -15,8 +15,8 @@ #include "baseptspausedsetreason_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_events.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/dispatcher.h" #include "test/fuzztest/common_fuzzer/common_fuzzer.h" using namespace panda; diff --git a/test/fuzztest/connectserversendmessage_fuzzer/BUILD.gn b/test/fuzztest/connectserversendmessage_fuzzer/BUILD.gn index 63d33cc7..3ba7cd16 100644 --- a/test/fuzztest/connectserversendmessage_fuzzer/BUILD.gn +++ b/test/fuzztest/connectserversendmessage_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("ConnectServerSendMessageFuzzTest") { deps = [ "../../../inspector:connectserver_debugger", - "../../../tooling:libark_ecma_debugger_set", + "../../../tooling/dynamic:libark_ecma_debugger_set", ] # hiviewdfx libraries diff --git a/test/fuzztest/dispatcher/dispatchresponsecreatecode_fuzzer/BUILD.gn b/test/fuzztest/dispatcher/dispatchresponsecreatecode_fuzzer/BUILD.gn index f2069056..09787232 100644 --- a/test/fuzztest/dispatcher/dispatchresponsecreatecode_fuzzer/BUILD.gn +++ b/test/fuzztest/dispatcher/dispatchresponsecreatecode_fuzzer/BUILD.gn @@ -33,7 +33,7 @@ ohos_fuzztest("DispatchResponseCreateCodeFuzzTest") { deps = [ "$toolchain_root/inspector:ark_debugger", "$toolchain_root/inspector:connectserver_debugger", - "$toolchain_root/tooling:libark_ecma_debugger_set", + "$toolchain_root/tooling/dynamic:libark_ecma_debugger_set", ] # hiviewdfx libraries diff --git a/test/fuzztest/dispatcher/dispatchresponsecreatecode_fuzzer/dispatchresponsecreatecode_fuzzer.cpp b/test/fuzztest/dispatcher/dispatchresponsecreatecode_fuzzer/dispatchresponsecreatecode_fuzzer.cpp index d7c5dc69..cc8a2ce0 100644 --- a/test/fuzztest/dispatcher/dispatchresponsecreatecode_fuzzer/dispatchresponsecreatecode_fuzzer.cpp +++ b/test/fuzztest/dispatcher/dispatchresponsecreatecode_fuzzer/dispatchresponsecreatecode_fuzzer.cpp @@ -15,7 +15,7 @@ #include "dispatchresponsecreatecode_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/dispatcher.h" +#include "tooling/dynamic/dispatcher.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/dispatchprotocolmessage_fuzzer/BUILD.gn b/test/fuzztest/dispatchprotocolmessage_fuzzer/BUILD.gn index 8672956d..6f503087 100644 --- a/test/fuzztest/dispatchprotocolmessage_fuzzer/BUILD.gn +++ b/test/fuzztest/dispatchprotocolmessage_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("DispatchProtocolMessageFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/dispatchprotocolmessage_fuzzer/dispatchprotocolmessage_fuzzer.cpp b/test/fuzztest/dispatchprotocolmessage_fuzzer/dispatchprotocolmessage_fuzzer.cpp index 5aab5385..850aa608 100644 --- a/test/fuzztest/dispatchprotocolmessage_fuzzer/dispatchprotocolmessage_fuzzer.cpp +++ b/test/fuzztest/dispatchprotocolmessage_fuzzer/dispatchprotocolmessage_fuzzer.cpp @@ -15,7 +15,7 @@ #include "dispatchprotocolmessage_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/debugger_service.h" +#include "tooling/dynamic/debugger_service.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/initializedebugger_fuzzer/BUILD.gn b/test/fuzztest/initializedebugger_fuzzer/BUILD.gn index 37305f26..2ecc6c96 100644 --- a/test/fuzztest/initializedebugger_fuzzer/BUILD.gn +++ b/test/fuzztest/initializedebugger_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("InitializeDebuggerFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/initializedebugger_fuzzer/initializedebugger_fuzzer.cpp b/test/fuzztest/initializedebugger_fuzzer/initializedebugger_fuzzer.cpp index 82bab1cd..e0c64a0a 100644 --- a/test/fuzztest/initializedebugger_fuzzer/initializedebugger_fuzzer.cpp +++ b/test/fuzztest/initializedebugger_fuzzer/initializedebugger_fuzzer.cpp @@ -15,7 +15,7 @@ #include "initializedebugger_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/debugger_service.h" +#include "tooling/dynamic/debugger_service.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/protocolhandler_fuzzer/BUILD.gn b/test/fuzztest/protocolhandler_fuzzer/BUILD.gn index c549d1e6..a1ed4cd3 100644 --- a/test/fuzztest/protocolhandler_fuzzer/BUILD.gn +++ b/test/fuzztest/protocolhandler_fuzzer/BUILD.gn @@ -30,7 +30,7 @@ ohos_fuzztest("ProtocolHandlerFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.cpp b/test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.cpp index 96d67bdc..90ad22a9 100644 --- a/test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.cpp +++ b/test/fuzztest/protocolhandler_fuzzer/protocolhandler_fuzzer.cpp @@ -15,7 +15,7 @@ #include "protocolhandler_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/protocolhandlercreateerrorreply_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlercreateerrorreply_fuzzer/BUILD.gn index 04536415..961fdc8a 100644 --- a/test/fuzztest/protocolhandlercreateerrorreply_fuzzer/BUILD.gn +++ b/test/fuzztest/protocolhandlercreateerrorreply_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("ProtocolHandlerCreateErrorReplyFuzzTest") { configs = [ "../../../:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/protocolhandlercreateerrorreply_fuzzer/protocolhandlercreateerrorreply_fuzzer.cpp b/test/fuzztest/protocolhandlercreateerrorreply_fuzzer/protocolhandlercreateerrorreply_fuzzer.cpp index 7cdfc194..fc980ed9 100644 --- a/test/fuzztest/protocolhandlercreateerrorreply_fuzzer/protocolhandlercreateerrorreply_fuzzer.cpp +++ b/test/fuzztest/protocolhandlercreateerrorreply_fuzzer/protocolhandlercreateerrorreply_fuzzer.cpp @@ -15,7 +15,7 @@ #include "protocolhandlercreateerrorreply_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/protocolhandlerdispatch_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerdispatch_fuzzer/BUILD.gn index b83cb1a6..bb4eabfd 100644 --- a/test/fuzztest/protocolhandlerdispatch_fuzzer/BUILD.gn +++ b/test/fuzztest/protocolhandlerdispatch_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("ProtocolHandlerDispatchFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.cpp b/test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.cpp index 684a8b66..cd6b4c37 100644 --- a/test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.cpp +++ b/test/fuzztest/protocolhandlerdispatch_fuzzer/protocolhandlerdispatch_fuzzer.cpp @@ -15,7 +15,7 @@ #include "protocolhandlerdispatch_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/protocolhandlerget_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerget_fuzzer/BUILD.gn index af643b64..d1360d4d 100644 --- a/test/fuzztest/protocolhandlerget_fuzzer/BUILD.gn +++ b/test/fuzztest/protocolhandlerget_fuzzer/BUILD.gn @@ -30,7 +30,7 @@ ohos_fuzztest("ProtocolHandlerGetFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.cpp b/test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.cpp index 296da959..fd6c5100 100644 --- a/test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.cpp +++ b/test/fuzztest/protocolhandlerget_fuzzer/protocolhandlerget_fuzzer.cpp @@ -15,7 +15,7 @@ #include "protocolhandlerget_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/protocolhandlernotif_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlernotif_fuzzer/BUILD.gn index 14ed840b..df505ac9 100644 --- a/test/fuzztest/protocolhandlernotif_fuzzer/BUILD.gn +++ b/test/fuzztest/protocolhandlernotif_fuzzer/BUILD.gn @@ -30,7 +30,7 @@ ohos_fuzztest("ProtocolHandlerNotifFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.cpp b/test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.cpp index 1d899ad4..9e99a564 100644 --- a/test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.cpp +++ b/test/fuzztest/protocolhandlernotif_fuzzer/protocolhandlernotif_fuzzer.cpp @@ -15,7 +15,7 @@ #include "protocolhandlernotif_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/protocolhandlerprocess_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerprocess_fuzzer/BUILD.gn index 2ffb9b0f..9cef7ceb 100644 --- a/test/fuzztest/protocolhandlerprocess_fuzzer/BUILD.gn +++ b/test/fuzztest/protocolhandlerprocess_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("ProtocolHandlerProcessFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.cpp b/test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.cpp index 9945e632..52f6c13c 100644 --- a/test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.cpp +++ b/test/fuzztest/protocolhandlerprocess_fuzzer/protocolhandlerprocess_fuzzer.cpp @@ -15,7 +15,7 @@ #include "protocolhandlerprocess_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/protocolhandlerresponse_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerresponse_fuzzer/BUILD.gn index 579f4ce1..6e405852 100644 --- a/test/fuzztest/protocolhandlerresponse_fuzzer/BUILD.gn +++ b/test/fuzztest/protocolhandlerresponse_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("ProtocolHandlerResponseFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.cpp b/test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.cpp index 76456f6a..cb1becd3 100644 --- a/test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.cpp +++ b/test/fuzztest/protocolhandlerresponse_fuzzer/protocolhandlerresponse_fuzzer.cpp @@ -15,7 +15,7 @@ #include "protocolhandlerresponse_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/protocolhandlerrun_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerrun_fuzzer/BUILD.gn index 7c7d8476..2632e92b 100644 --- a/test/fuzztest/protocolhandlerrun_fuzzer/BUILD.gn +++ b/test/fuzztest/protocolhandlerrun_fuzzer/BUILD.gn @@ -30,7 +30,7 @@ ohos_fuzztest("ProtocolHandlerRunFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.cpp b/test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.cpp index 72a781b7..58494b76 100644 --- a/test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.cpp +++ b/test/fuzztest/protocolhandlerrun_fuzzer/protocolhandlerrun_fuzzer.cpp @@ -15,7 +15,7 @@ #include "protocolhandlerrun_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/protocolhandlersendreply_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlersendreply_fuzzer/BUILD.gn index 6da3b1f6..18a4d526 100644 --- a/test/fuzztest/protocolhandlersendreply_fuzzer/BUILD.gn +++ b/test/fuzztest/protocolhandlersendreply_fuzzer/BUILD.gn @@ -31,7 +31,7 @@ ohos_fuzztest("ProtocolHandlerSendReplyFuzzTest") { configs = [ "../../../:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/protocolhandlersendreply_fuzzer/protocolhandlersendreply_fuzzer.cpp b/test/fuzztest/protocolhandlersendreply_fuzzer/protocolhandlersendreply_fuzzer.cpp index d650a918..c4baed1a 100644 --- a/test/fuzztest/protocolhandlersendreply_fuzzer/protocolhandlersendreply_fuzzer.cpp +++ b/test/fuzztest/protocolhandlersendreply_fuzzer/protocolhandlersendreply_fuzzer.cpp @@ -15,7 +15,7 @@ #include "protocolhandlersendreply_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/protocolhandlerwait_fuzzer/BUILD.gn b/test/fuzztest/protocolhandlerwait_fuzzer/BUILD.gn index 72d365a7..d30fed65 100644 --- a/test/fuzztest/protocolhandlerwait_fuzzer/BUILD.gn +++ b/test/fuzztest/protocolhandlerwait_fuzzer/BUILD.gn @@ -30,7 +30,7 @@ ohos_fuzztest("ProtocolHandlerWaitFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.cpp b/test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.cpp index 51e930e5..fddecb75 100644 --- a/test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.cpp +++ b/test/fuzztest/protocolhandlerwait_fuzzer/protocolhandlerwait_fuzzer.cpp @@ -15,7 +15,7 @@ #include "protocolhandlerwait_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesbreakpointparseid_fuzzer/BUILD.gn b/test/fuzztest/pttypesbreakpointparseid_fuzzer/BUILD.gn index abb9e430..c4395d7c 100644 --- a/test/fuzztest/pttypesbreakpointparseid_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesbreakpointparseid_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesBreakpointParseIdFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.cpp b/test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.cpp index 956f0005..1a9fee79 100644 --- a/test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.cpp +++ b/test/fuzztest/pttypesbreakpointparseid_fuzzer/pttypesbreakpointparseid_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesbreakpointparseid_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesbreakpointtostring_fuzzer/BUILD.gn b/test/fuzztest/pttypesbreakpointtostring_fuzzer/BUILD.gn index 048cfa5d..30f528cb 100644 --- a/test/fuzztest/pttypesbreakpointtostring_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesbreakpointtostring_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesBreakpointToStringFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.cpp b/test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.cpp index c77bbd53..8fda95bc 100644 --- a/test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.cpp +++ b/test/fuzztest/pttypesbreakpointtostring_fuzzer/pttypesbreakpointtostring_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesbreakpointtostring_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetails_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetails_fuzzer/BUILD.gn index 54474374..cd5a4faf 100644 --- a/test/fuzztest/pttypesexceptiondetails_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetails_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesExceptionDetailsFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.cpp index e6c51055..206602c0 100644 --- a/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetails_fuzzer/pttypesexceptiondetails_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetails_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/BUILD.gn index a64d2672..84f51bb6 100644 --- a/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesExceptionDetailsColumnFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.cpp index 7e27654e..fe7683cf 100644 --- a/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailscolumn_fuzzer/pttypesexceptiondetailscolumn_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetailscolumn_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/BUILD.gn index 56eee19c..31f3de75 100644 --- a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesExceptionDetailsCreateFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp index 1732fa11..b678267f 100644 --- a/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailscreate_fuzzer/pttypesexceptiondetailscreate_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetailscreate_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/BUILD.gn index 218ab781..7ca4304a 100644 --- a/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesExceptionDetailsExceptionFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp index dd3ffb24..ba1cdc71 100644 --- a/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailsexception_fuzzer/pttypesexceptiondetailsexception_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetailsexception_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/BUILD.gn index 3c7f6291..a4e90435 100644 --- a/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesExceptionDetailsExceptionIdFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.cpp index 4cd252a9..b05e1379 100644 --- a/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailsexceptionid_fuzzer/pttypesexceptiondetailsexceptionid_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetailsexceptionid_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/BUILD.gn index 9fbea5c1..3714b03a 100644 --- a/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesExceptionDetailsExecutionContextIdFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.cpp index ca7b1ea8..52538961 100644 --- a/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailsexecutioncontextid_fuzzer/pttypesexceptiondetailsexecutioncontextid_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetailsexecutioncontextid_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetailsline_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/BUILD.gn index 9fafdb77..200fbd85 100644 --- a/test/fuzztest/pttypesexceptiondetailsline_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesExceptionDetailsLineFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.cpp index 34b5c4f6..f3b7f3ac 100644 --- a/test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailsline_fuzzer/pttypesexceptiondetailsline_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetailsline_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/BUILD.gn index 07b6edf8..b0438acf 100644 --- a/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesExceptionDetailsScriptIdFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.cpp index a8e568fc..9b87c842 100644 --- a/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailsscriptid_fuzzer/pttypesexceptiondetailsscriptid_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetailsscriptid_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetailstext_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/BUILD.gn index c1dab620..43b45c5d 100644 --- a/test/fuzztest/pttypesexceptiondetailstext_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesExceptionDetailsTextFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.cpp index a7449f7a..2f77fa0d 100644 --- a/test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailstext_fuzzer/pttypesexceptiondetailstext_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetailstext_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn index ad1e8f3c..b5d83f09 100644 --- a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesExceptionDetailsToJsonFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.cpp index 315db3fc..251968d0 100644 --- a/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailstojson_fuzzer/pttypesexceptiondetailstojson_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetailstojson_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/BUILD.gn b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/BUILD.gn index 7bb26fcb..7f8b18ae 100644 --- a/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesExceptionDetailsUrlFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.cpp b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.cpp index c78a8bd5..bd170f26 100644 --- a/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.cpp +++ b/test/fuzztest/pttypesexceptiondetailsurl_fuzzer/pttypesexceptiondetailsurl_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesexceptiondetailsurl_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesfunctionremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/BUILD.gn index ef756c4d..1d0dcbbd 100644 --- a/test/fuzztest/pttypesfunctionremoteobject_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesFunctionRemoteObjectFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.cpp b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.cpp index 287b9cbb..428c0d5b 100644 --- a/test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.cpp +++ b/test/fuzztest/pttypesfunctionremoteobject_fuzzer/pttypesfunctionremoteobject_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesfunctionremoteobject_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/BUILD.gn index 241d7db3..bfb449dc 100644 --- a/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesGeneratorFunctionRemoteObjectFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.cpp b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.cpp index 9b37098b..7e43efed 100644 --- a/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.cpp +++ b/test/fuzztest/pttypesgeneratorfunctionremoteobject_fuzzer/pttypesgeneratorfunctionremoteobject_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesgeneratorfunctionremoteobject_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/BUILD.gn b/test/fuzztest/pttypesinternalpropertydesp_fuzzer/BUILD.gn index 89046fab..44894613 100755 --- a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesinternalpropertydesp_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesInternalPropertyDespFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/pttypesinternalpropertydesp_fuzzer.cpp b/test/fuzztest/pttypesinternalpropertydesp_fuzzer/pttypesinternalpropertydesp_fuzzer.cpp index 17542961..d9dbc450 100755 --- a/test/fuzztest/pttypesinternalpropertydesp_fuzzer/pttypesinternalpropertydesp_fuzzer.cpp +++ b/test/fuzztest/pttypesinternalpropertydesp_fuzzer/pttypesinternalpropertydesp_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesinternalpropertydesp_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesinternalpropertydespcreate_fuzzer/BUILD.gn b/test/fuzztest/pttypesinternalpropertydespcreate_fuzzer/BUILD.gn index 42940a0f..042cc80e 100755 --- a/test/fuzztest/pttypesinternalpropertydespcreate_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesinternalpropertydespcreate_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesInternalPropertyDespCreateFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesinternalpropertydespcreate_fuzzer/pttypesinternalpropertydespcreate_fuzzer.cpp b/test/fuzztest/pttypesinternalpropertydespcreate_fuzzer/pttypesinternalpropertydespcreate_fuzzer.cpp index a89e9c2d..43c8c08b 100755 --- a/test/fuzztest/pttypesinternalpropertydespcreate_fuzzer/pttypesinternalpropertydespcreate_fuzzer.cpp +++ b/test/fuzztest/pttypesinternalpropertydespcreate_fuzzer/pttypesinternalpropertydespcreate_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesinternalpropertydespcreate_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesinternalpropertydespname_fuzzer/BUILD.gn b/test/fuzztest/pttypesinternalpropertydespname_fuzzer/BUILD.gn index 1b367cae..3efbe6b7 100755 --- a/test/fuzztest/pttypesinternalpropertydespname_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesinternalpropertydespname_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesInternalPropertyDespNameFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesinternalpropertydespname_fuzzer/pttypesinternalpropertydespname_fuzzer.cpp b/test/fuzztest/pttypesinternalpropertydespname_fuzzer/pttypesinternalpropertydespname_fuzzer.cpp index 25d6bafd..0493eb23 100755 --- a/test/fuzztest/pttypesinternalpropertydespname_fuzzer/pttypesinternalpropertydespname_fuzzer.cpp +++ b/test/fuzztest/pttypesinternalpropertydespname_fuzzer/pttypesinternalpropertydespname_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesinternalpropertydespname_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/BUILD.gn b/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/BUILD.gn index f3ebb61c..ec2bb463 100755 --- a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesInternalPropertyDespToJsonFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/pttypesinternalpropertydesptojson_fuzzer.cpp b/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/pttypesinternalpropertydesptojson_fuzzer.cpp index 86599921..1dd66de8 100755 --- a/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/pttypesinternalpropertydesptojson_fuzzer.cpp +++ b/test/fuzztest/pttypesinternalpropertydesptojson_fuzzer/pttypesinternalpropertydesptojson_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesinternalpropertydesptojson_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/BUILD.gn b/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/BUILD.gn index 5d78065c..24769ea8 100755 --- a/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesInternalPropertyDespValueFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/pttypesinternalpropertydespvalue_fuzzer.cpp b/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/pttypesinternalpropertydespvalue_fuzzer.cpp index 5e5d04d4..5848ac5d 100755 --- a/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/pttypesinternalpropertydespvalue_fuzzer.cpp +++ b/test/fuzztest/pttypesinternalpropertydespvalue_fuzzer/pttypesinternalpropertydespvalue_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesinternalpropertydespvalue_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesobjectremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesobjectremoteobject_fuzzer/BUILD.gn index 71594b73..dd59e470 100644 --- a/test/fuzztest/pttypesobjectremoteobject_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesobjectremoteobject_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesObjectRemoteObjectFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.cpp b/test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.cpp index b713da6a..9d5f27c6 100644 --- a/test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.cpp +++ b/test/fuzztest/pttypesobjectremoteobject_fuzzer/pttypesobjectremoteobject_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesobjectremoteobject_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/BUILD.gn index d0a0b24c..2bc2b3d8 100644 --- a/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesPrimitiveRemoteObjectFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.cpp b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.cpp index a3d2e19c..75fafb63 100644 --- a/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.cpp +++ b/test/fuzztest/pttypesprimitiveremoteobject_fuzzer/pttypesprimitiveremoteobject_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesprimitiveremoteobject_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/BUILD.gn b/test/fuzztest/pttypesprivatepropertydesp_fuzzer/BUILD.gn index 7da5dac8..86560f3e 100755 --- a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesprivatepropertydesp_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesPrivatePropertyDespFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/pttypesprivatepropertydesp_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydesp_fuzzer/pttypesprivatepropertydesp_fuzzer.cpp index c8e1f660..b3378828 100755 --- a/test/fuzztest/pttypesprivatepropertydesp_fuzzer/pttypesprivatepropertydesp_fuzzer.cpp +++ b/test/fuzztest/pttypesprivatepropertydesp_fuzzer/pttypesprivatepropertydesp_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesprivatepropertydesp_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesprivatepropertydespcreate_fuzzer/BUILD.gn b/test/fuzztest/pttypesprivatepropertydespcreate_fuzzer/BUILD.gn index 95c28c4e..40420189 100755 --- a/test/fuzztest/pttypesprivatepropertydespcreate_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesprivatepropertydespcreate_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesPrivatePropertyDespCreateFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesprivatepropertydespcreate_fuzzer/pttypesprivatepropertydespcreate_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydespcreate_fuzzer/pttypesprivatepropertydespcreate_fuzzer.cpp index 5defa7f8..f0a759cb 100755 --- a/test/fuzztest/pttypesprivatepropertydespcreate_fuzzer/pttypesprivatepropertydespcreate_fuzzer.cpp +++ b/test/fuzztest/pttypesprivatepropertydespcreate_fuzzer/pttypesprivatepropertydespcreate_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesprivatepropertydespcreate_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesprivatepropertydespget_fuzzer/BUILD.gn b/test/fuzztest/pttypesprivatepropertydespget_fuzzer/BUILD.gn index 1c11f543..83bd7a53 100755 --- a/test/fuzztest/pttypesprivatepropertydespget_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesprivatepropertydespget_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesPrivatePropertyDespGetFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesprivatepropertydespget_fuzzer/pttypesprivatepropertydespget_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydespget_fuzzer/pttypesprivatepropertydespget_fuzzer.cpp index 278189ee..2ec65355 100755 --- a/test/fuzztest/pttypesprivatepropertydespget_fuzzer/pttypesprivatepropertydespget_fuzzer.cpp +++ b/test/fuzztest/pttypesprivatepropertydespget_fuzzer/pttypesprivatepropertydespget_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesprivatepropertydespget_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesprivatepropertydespname_fuzzer/BUILD.gn b/test/fuzztest/pttypesprivatepropertydespname_fuzzer/BUILD.gn index 7175b72f..e2b43785 100755 --- a/test/fuzztest/pttypesprivatepropertydespname_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesprivatepropertydespname_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesPrivatePropertyDespNameFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesprivatepropertydespname_fuzzer/pttypesprivatepropertydespname_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydespname_fuzzer/pttypesprivatepropertydespname_fuzzer.cpp index 78ba2224..7151c3f4 100755 --- a/test/fuzztest/pttypesprivatepropertydespname_fuzzer/pttypesprivatepropertydespname_fuzzer.cpp +++ b/test/fuzztest/pttypesprivatepropertydespname_fuzzer/pttypesprivatepropertydespname_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesprivatepropertydespname_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesprivatepropertydespset_fuzzer/BUILD.gn b/test/fuzztest/pttypesprivatepropertydespset_fuzzer/BUILD.gn index b613f04c..10dbb54c 100755 --- a/test/fuzztest/pttypesprivatepropertydespset_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesprivatepropertydespset_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesPrivatePropertyDespSetFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesprivatepropertydespset_fuzzer/pttypesprivatepropertydespset_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydespset_fuzzer/pttypesprivatepropertydespset_fuzzer.cpp index 4ad99271..c37c6933 100755 --- a/test/fuzztest/pttypesprivatepropertydespset_fuzzer/pttypesprivatepropertydespset_fuzzer.cpp +++ b/test/fuzztest/pttypesprivatepropertydespset_fuzzer/pttypesprivatepropertydespset_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesprivatepropertydespset_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/BUILD.gn b/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/BUILD.gn index f8021301..8d757c8d 100755 --- a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesPrivatePropertyDespToJsonFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/pttypesprivatepropertydesptojson_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/pttypesprivatepropertydesptojson_fuzzer.cpp index 12e81ae5..105b8710 100755 --- a/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/pttypesprivatepropertydesptojson_fuzzer.cpp +++ b/test/fuzztest/pttypesprivatepropertydesptojson_fuzzer/pttypesprivatepropertydesptojson_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesprivatepropertydesptojson_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/BUILD.gn b/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/BUILD.gn index f1a6c91a..d98bdbab 100755 --- a/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesPrivatePropertyDespValueFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/pttypesprivatepropertydespvalue_fuzzer.cpp b/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/pttypesprivatepropertydespvalue_fuzzer.cpp index 3d66d082..d3e505a5 100755 --- a/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/pttypesprivatepropertydespvalue_fuzzer.cpp +++ b/test/fuzztest/pttypesprivatepropertydespvalue_fuzzer/pttypesprivatepropertydespvalue_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesprivatepropertydespvalue_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn index d5b61116..fdd5ea37 100644 --- a/test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobject_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesRemoteObjectFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.cpp b/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.cpp index 9662e823..68334f08 100644 --- a/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobject_fuzzer/pttypesremoteobject_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobject_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectdescription_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/BUILD.gn index 73cbd20b..0c46de8b 100644 --- a/test/fuzztest/pttypesremoteobjectdescription_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesRemoteObjectDescriptionFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.cpp index e9540031..d554f61f 100644 --- a/test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectdescription_fuzzer/pttypesremoteobjectdescription_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectdescription_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/BUILD.gn index 4943fb74..c8c9d1b1 100644 --- a/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesRemoteObjectGetClassNameFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.cpp index 79d5d464..71b4d36d 100644 --- a/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectgetclassname_fuzzer/pttypesremoteobjectgetclassname_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectgetclassname_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/BUILD.gn index ae118211..4671dace 100644 --- a/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesRemoteObjectGetSubTypeFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.cpp index 3ac620a7..8c465029 100644 --- a/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectgetsubtype_fuzzer/pttypesremoteobjectgetsubtype_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectgetsubtype_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectgettype_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/BUILD.gn index e52962f2..cef42cfc 100644 --- a/test/fuzztest/pttypesremoteobjectgettype_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesRemoteObjectGetTypeFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp index c5f7d02d..99cd8446 100644 --- a/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectgettype_fuzzer/pttypesremoteobjectgettype_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectgettype_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/BUILD.gn index 586d7544..f8c7d18b 100644 --- a/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesRemoteObjectGetValueFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp index 761a78d2..05a55562 100644 --- a/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectgetvalue_fuzzer/pttypesremoteobjectgetvalue_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectgetvalue_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/BUILD.gn index 3384d912..426b9ced 100644 --- a/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesRemoteObjectHasClassNameFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp index f560041e..dc5d93b7 100644 --- a/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjecthasclassname_fuzzer/pttypesremoteobjecthasclassname_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjecthasclassname_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/BUILD.gn index 40c34ddc..83c1a086 100644 --- a/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesRemoteObjectHasSubTypeFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp index d34ce6e5..691cc84e 100644 --- a/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjecthassubtype_fuzzer/pttypesremoteobjecthassubtype_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjecthassubtype_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/BUILD.gn index 51dd9403..f9341543 100644 --- a/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesRemoteObjectObjectIdFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.cpp index acc9b5df..a6b94f71 100644 --- a/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectobjectid_fuzzer/pttypesremoteobjectobjectid_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectobjectid_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/BUILD.gn index 6713f370..d1ac7795 100644 --- a/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesRemoteObjectSetClassNameFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.cpp index 04321ac6..5a67820b 100644 --- a/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectsetclassname_fuzzer/pttypesremoteobjectsetclassname_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectsetclassname_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/BUILD.gn index f3dc9067..2170c831 100644 --- a/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesRemoteObjectSetSubTypeFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.cpp index 10303309..98f1c221 100644 --- a/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectsetsubtype_fuzzer/pttypesremoteobjectsetsubtype_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectsetsubtype_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectsettype_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/BUILD.gn index 7618fd32..31360070 100644 --- a/test/fuzztest/pttypesremoteobjectsettype_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesRemoteObjectSetTypeFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.cpp index bf0fcbdb..18bbf0b7 100644 --- a/test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectsettype_fuzzer/pttypesremoteobjectsettype_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectsettype_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn index f9ec5017..bbf55d88 100644 --- a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesRemoteObjectSetValueFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.cpp index 95f67506..3a007512 100644 --- a/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectsetvalue_fuzzer/pttypesremoteobjectsetvalue_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectsetvalue_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/BUILD.gn b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/BUILD.gn index 404a77f0..c1a64213 100644 --- a/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("PtTypesRemoteObjectUnserializableValueFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.cpp b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.cpp index bdb58e7b..616cf507 100644 --- a/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.cpp +++ b/test/fuzztest/pttypesremoteobjectunserializablevalue_fuzzer/pttypesremoteobjectunserializablevalue_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesremoteobjectunserializablevalue_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypesstringremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypesstringremoteobject_fuzzer/BUILD.gn index ea1de604..51a77f79 100644 --- a/test/fuzztest/pttypesstringremoteobject_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypesstringremoteobject_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesStringRemoteObjectFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.cpp b/test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.cpp index e2243648..7406438f 100644 --- a/test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.cpp +++ b/test/fuzztest/pttypesstringremoteobject_fuzzer/pttypesstringremoteobject_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypesstringremoteobject_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/pttypessymbolremoteobject_fuzzer/BUILD.gn b/test/fuzztest/pttypessymbolremoteobject_fuzzer/BUILD.gn index 958ffd8b..8a972645 100644 --- a/test/fuzztest/pttypessymbolremoteobject_fuzzer/BUILD.gn +++ b/test/fuzztest/pttypessymbolremoteobject_fuzzer/BUILD.gn @@ -28,7 +28,7 @@ ohos_fuzztest("PtTypesSymbolRemoteObjectFuzzTest") { configs = [ "//arkcompiler/toolchain:toolchain_test_config" ] - deps = [ "../../../tooling:libark_ecma_debugger_set" ] + deps = [ "../../../tooling/dynamic:libark_ecma_debugger_set" ] # hiviewdfx libraries external_deps = hiviewdfx_ext_deps diff --git a/test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.cpp b/test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.cpp index d64368c0..95bec9d2 100644 --- a/test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.cpp +++ b/test/fuzztest/pttypessymbolremoteobject_fuzzer/pttypessymbolremoteobject_fuzzer.cpp @@ -15,7 +15,7 @@ #include "pttypessymbolremoteobject_fuzzer.h" #include "ecmascript/napi/include/jsnapi.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using namespace panda; using namespace panda::ecmascript; diff --git a/test/fuzztest/wsserver/wsserversendreply_fuzzer/BUILD.gn b/test/fuzztest/wsserver/wsserversendreply_fuzzer/BUILD.gn index b2ed5463..ef50d094 100644 --- a/test/fuzztest/wsserver/wsserversendreply_fuzzer/BUILD.gn +++ b/test/fuzztest/wsserver/wsserversendreply_fuzzer/BUILD.gn @@ -32,7 +32,7 @@ ohos_fuzztest("WsServerSendReplyFuzzTest") { deps = [ "$toolchain_root/inspector:ark_debugger", "$toolchain_root/inspector:connectserver_debugger", - "$toolchain_root/tooling:libark_ecma_debugger_set", + "$toolchain_root/tooling/dynamic:libark_ecma_debugger_set", ] # hiviewdfx libraries diff --git a/test/resource/tooling/ohos_test.xml b/test/resource/tooling/ohos_test.xml index b78bc478..9b21f6ba 100755 --- a/test/resource/tooling/ohos_test.xml +++ b/test/resource/tooling/ohos_test.xml @@ -15,114 +15,118 @@ - - - - diff --git a/tooling/BUILD.gn b/tooling/BUILD.gn index 5f802647..a3d5d094 100644 --- a/tooling/BUILD.gn +++ b/tooling/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -13,154 +13,31 @@ import("../toolchain.gni") -config("ark_ecma_debugger_config") { - configs = [ "..:ark_toolchain_common_config" ] - - include_dirs = [ "." ] -} - -debugger_sources = [ - "../common/log_wrapper.cpp", - "agent/animation_impl.cpp", - "agent/css_impl.cpp", - "agent/debugger_impl.cpp", - "agent/dom_impl.cpp", - "agent/overlay_impl.cpp", - "agent/page_impl.cpp", - "agent/runtime_impl.cpp", - "agent/target_impl.cpp", - "agent/tracing_impl.cpp", - "backend/debugger_executor.cpp", - "backend/js_pt_hooks.cpp", - "backend/js_single_stepper.cpp", - "base/pt_base64.cpp", - "base/pt_events.cpp", - "base/pt_json.cpp", - "base/pt_params.cpp", - "base/pt_returns.cpp", - "base/pt_script.cpp", - "base/pt_types.cpp", - "debugger_service.cpp", - "dispatcher.cpp", - "protocol_handler.cpp", - "utils/utils.cpp", -] -if (!is_mingw && !is_mac && target_os != "ios") { - debugger_sources += [ - "agent/heapprofiler_impl.cpp", - "agent/profiler_impl.cpp", - ] -} - -ohos_source_set("libark_ecma_debugger_set") { - stack_protector_ret = true - sources = debugger_sources - - public_configs = [ ":ark_ecma_debugger_config" ] - - defines = [] - deps = [] - external_deps = [ "ets_runtime:libark_jsruntime" ] - if (is_arkui_x && target_os == "ios") { - sources -= [ "../common/log_wrapper.cpp" ] - external_deps += [ "cJSON:cjson_static" ] - } else { - external_deps += [ "cJSON:cjson" ] - } - external_deps += [ - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, - ] - - if (is_ohos && is_standard_system && !is_arkui_x) { - defines += [ "ENABLE_FFRT_INTERFACES" ] - external_deps += [ "ffrt:libffrt" ] - } - - # hiviewdfx libraries - external_deps += hiviewdfx_ext_deps - - external_deps += [ "runtime_core:libarkfile_static" ] - deps += hiviewdfx_deps - - if (enable_leak_check) { - sources += [ "$js_root/ecmascript/dfx/native_dfx/backtrace.cpp" ] - defines += [ - "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK", - "ECMASCRIPT_ENABLE_GLOBAL_LEAK_CHECK", - ] - } - - cflags_cc = [ "-fvisibility=hidden" ] - subsystem_name = "arkcompiler" - part_name = "toolchain" -} - ohos_shared_library("libark_ecma_debugger") { stack_protector_ret = true - deps = [ ":libark_ecma_debugger_set" ] - external_deps = [ "libuv:uv" ] - if (is_mac) { - external_deps += [ "cJSON:cjson_static" ] - } - + deps = [ "./dynamic/:libark_ecma_debugger_static" ] install_enable = true - # hiviewdfx libraries - external_deps += hiviewdfx_ext_deps - if (enable_hilog) { - external_deps += [ "hilog:libhilog" ] - } - if (!is_arkui_x) { - external_deps += [ "ets_runtime:libark_jsruntime" ] + if (is_mingw || is_win) { + output_extension = "dll" } else { - deps += [ "../../ets_runtime:libark_jsruntime" ] - } - deps += hiviewdfx_deps - - if (!is_mingw && !is_mac) { output_extension = "so" } - if (!is_standard_system) { - relative_install_dir = "ark" - } - subsystem_name = "arkcompiler" part_name = "toolchain" + subsystem_name = "arkcompiler" output_name = "libark_tooling" } -ohos_static_library("libark_ecma_debugger_test") { - testonly = true - stack_protector_ret = true - sources = debugger_sources - - public_configs = [ ":ark_ecma_debugger_config" ] +ohos_shared_library("libark_tooling_plus") { + deps = [ "./static/:libark_tooling_plus_static" ] - defines = [ "OHOS_UNIT_TEST" ] - deps = [] - external_deps = [ - "ets_runtime:libark_jsruntime", - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, - ] - if ((is_arkui_x && target_os == "ios") || target_os == "mac") { - external_deps += [ "cJSON:cjson_static" ] + if (is_mingw || is_win) { + output_extension = "dll" } else { - external_deps += [ "cJSON:cjson" ] - } - - # hiviewdfx libraries - external_deps += hiviewdfx_ext_deps - deps += hiviewdfx_deps - if (enable_hilog) { - external_deps += [ "hilog:libhilog" ] - } - - if (!is_mingw && !is_mac) { output_extension = "so" } - subsystem_name = "test" + part_name = "toolchain" + subsystem_name = "arkcompiler" } + diff --git a/tooling/dynamic/BUILD.gn b/tooling/dynamic/BUILD.gn new file mode 100644 index 00000000..c04d3a08 --- /dev/null +++ b/tooling/dynamic/BUILD.gn @@ -0,0 +1,180 @@ +# Copyright (c) 2021-2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../toolchain.gni") + +config("ark_ecma_debugger_config") { + configs = [ "../..:ark_toolchain_common_config" ] + + include_dirs = [ "." ] +} + +debugger_sources = [ + "../../common/log_wrapper.cpp", + "agent/animation_impl.cpp", + "agent/css_impl.cpp", + "agent/debugger_impl.cpp", + "agent/dom_impl.cpp", + "agent/overlay_impl.cpp", + "agent/page_impl.cpp", + "agent/runtime_impl.cpp", + "agent/target_impl.cpp", + "agent/tracing_impl.cpp", + "backend/debugger_executor.cpp", + "backend/js_pt_hooks.cpp", + "backend/js_single_stepper.cpp", + "base/pt_base64.cpp", + "base/pt_events.cpp", + "base/pt_json.cpp", + "base/pt_params.cpp", + "base/pt_returns.cpp", + "base/pt_script.cpp", + "base/pt_types.cpp", + "debugger_service.cpp", + "dispatcher.cpp", + "protocol_handler.cpp", + "utils/utils.cpp", +] +if (!is_mingw && !is_mac && target_os != "ios") { + debugger_sources += [ + "agent/heapprofiler_impl.cpp", + "agent/profiler_impl.cpp", + ] +} + +ohos_source_set("libark_ecma_debugger_set") { + stack_protector_ret = true + sources = debugger_sources + + public_configs = [ ":ark_ecma_debugger_config" ] + + defines = [] + deps = [] + external_deps = [] + if (defined(ark_hybrid) && ark_hybrid) { + external_deps += [ "runtime_core:libarkruntime" ] + } else { + external_deps += [ "ets_runtime:libark_jsruntime" ] + } + if (is_arkui_x && target_os == "ios") { + sources -= [ "../../common/log_wrapper.cpp" ] + external_deps += [ "cJSON:cjson_static" ] + } else { + external_deps += [ "cJSON:cjson" ] + } + external_deps += [ + "icu:shared_icuuc", + "libuv:uv", + ] + + if (is_ohos && is_standard_system && !is_arkui_x) { + defines += [ "ENABLE_FFRT_INTERFACES" ] + external_deps += [ "ffrt:libffrt" ] + } + + # hiviewdfx libraries + external_deps += hiviewdfx_ext_deps + + external_deps += [ "runtime_core:libarkfile_static" ] + deps += hiviewdfx_deps + + if (enable_leak_check) { + sources += [ "$js_root/ecmascript/dfx/native_dfx/backtrace.cpp" ] + defines += [ + "ECMASCRIPT_ENABLE_HANDLE_LEAK_CHECK", + "ECMASCRIPT_ENABLE_GLOBAL_LEAK_CHECK", + ] + } + + cflags_cc = [ "-fvisibility=hidden" ] + subsystem_name = "arkcompiler" + part_name = "toolchain" +} + +ohos_static_library("libark_ecma_debugger_static") { + deps = [ ":libark_ecma_debugger_set" ] + external_deps = [ "libuv:uv" ] + if (is_mac) { + external_deps += [ "cJSON:cjson_static" ] + } + + + + # hiviewdfx libraries + external_deps += hiviewdfx_ext_deps + if (enable_hilog) { + external_deps += [ "hilog:libhilog" ] + } + if (!is_arkui_x) { + if (defined(ark_hybrid) && ark_hybrid) { + external_deps += [ "runtime_core:libarkruntime" ] + } else { + external_deps += [ "ets_runtime:libark_jsruntime" ] + } + } else { + if (defined(ark_hybrid) && ark_hybrid) { + deps += [ "../../../runtime_core:libarkruntime" ] + } else { + deps += [ "../../../ets_runtime:libark_jsruntime" ] + } + } + deps += hiviewdfx_deps + + if (!is_mingw && !is_mac) { + output_extension = "so" + } + + if (!is_standard_system && !ark_standalone_build) { + relative_install_dir = "ark" + } + subsystem_name = "arkcompiler" + part_name = "toolchain" + output_name = "libark_tooling" +} + +ohos_static_library("libark_ecma_debugger_test") { + testonly = true + stack_protector_ret = true + sources = debugger_sources + + public_configs = [ ":ark_ecma_debugger_config" ] + + defines = [ "OHOS_UNIT_TEST" ] + deps = [] + external_deps = [ + "icu:shared_icuuc", + "libuv:uv", + ] + if (defined(ark_hybrid) && ark_hybrid) { + external_deps += [ "runtime_core:libarkruntime" ] + } else { + external_deps += [ "ets_runtime:libark_jsruntime" ] + } + if ((is_arkui_x && target_os == "ios") || target_os == "mac") { + external_deps += [ "cJSON:cjson_static" ] + } else { + external_deps += [ "cJSON:cjson" ] + } + + # hiviewdfx libraries + external_deps += hiviewdfx_ext_deps + deps += hiviewdfx_deps + if (enable_hilog) { + external_deps += [ "hilog:libhilog" ] + } + + if (!is_mingw && !is_mac) { + output_extension = "so" + } + subsystem_name = "test" +} \ No newline at end of file diff --git a/tooling/agent/animation_impl.cpp b/tooling/dynamic/agent/animation_impl.cpp similarity index 100% rename from tooling/agent/animation_impl.cpp rename to tooling/dynamic/agent/animation_impl.cpp diff --git a/tooling/agent/animation_impl.h b/tooling/dynamic/agent/animation_impl.h similarity index 100% rename from tooling/agent/animation_impl.h rename to tooling/dynamic/agent/animation_impl.h diff --git a/tooling/agent/css_impl.cpp b/tooling/dynamic/agent/css_impl.cpp similarity index 100% rename from tooling/agent/css_impl.cpp rename to tooling/dynamic/agent/css_impl.cpp diff --git a/tooling/agent/css_impl.h b/tooling/dynamic/agent/css_impl.h similarity index 100% rename from tooling/agent/css_impl.h rename to tooling/dynamic/agent/css_impl.h diff --git a/tooling/agent/debugger_impl.cpp b/tooling/dynamic/agent/debugger_impl.cpp similarity index 99% rename from tooling/agent/debugger_impl.cpp rename to tooling/dynamic/agent/debugger_impl.cpp index bd3ecbf8..b6f10efe 100755 --- a/tooling/agent/debugger_impl.cpp +++ b/tooling/dynamic/agent/debugger_impl.cpp @@ -15,7 +15,7 @@ #include "agent/debugger_impl.h" -#include "tooling/base/pt_base64.h" +#include "tooling/dynamic/base/pt_base64.h" #include "backend/debugger_executor.h" #include "protocol_handler.h" diff --git a/tooling/agent/debugger_impl.h b/tooling/dynamic/agent/debugger_impl.h similarity index 99% rename from tooling/agent/debugger_impl.h rename to tooling/dynamic/agent/debugger_impl.h index b0a4272c..7c33d0e5 100644 --- a/tooling/agent/debugger_impl.h +++ b/tooling/dynamic/agent/debugger_impl.h @@ -18,7 +18,7 @@ #include "agent/runtime_impl.h" #include "backend/js_pt_hooks.h" -#include "tooling/base/pt_params.h" +#include "tooling/dynamic/base/pt_params.h" #include "backend/js_single_stepper.h" #include "dispatcher.h" diff --git a/tooling/agent/dom_impl.cpp b/tooling/dynamic/agent/dom_impl.cpp similarity index 100% rename from tooling/agent/dom_impl.cpp rename to tooling/dynamic/agent/dom_impl.cpp diff --git a/tooling/agent/dom_impl.h b/tooling/dynamic/agent/dom_impl.h similarity index 100% rename from tooling/agent/dom_impl.h rename to tooling/dynamic/agent/dom_impl.h diff --git a/tooling/agent/heapprofiler_impl.cpp b/tooling/dynamic/agent/heapprofiler_impl.cpp similarity index 100% rename from tooling/agent/heapprofiler_impl.cpp rename to tooling/dynamic/agent/heapprofiler_impl.cpp diff --git a/tooling/agent/heapprofiler_impl.h b/tooling/dynamic/agent/heapprofiler_impl.h similarity index 98% rename from tooling/agent/heapprofiler_impl.h rename to tooling/dynamic/agent/heapprofiler_impl.h index 767bc6f5..04f1acd2 100644 --- a/tooling/agent/heapprofiler_impl.h +++ b/tooling/dynamic/agent/heapprofiler_impl.h @@ -20,9 +20,9 @@ #include #endif -#include "tooling/base/pt_params.h" -#include "tooling/base/pt_events.h" -#include "tooling/base/pt_returns.h" +#include "tooling/dynamic/base/pt_params.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/base/pt_returns.h" #include "dispatcher.h" #include "protocol_handler.h" #include "protocol_channel.h" diff --git a/tooling/agent/overlay_impl.cpp b/tooling/dynamic/agent/overlay_impl.cpp similarity index 100% rename from tooling/agent/overlay_impl.cpp rename to tooling/dynamic/agent/overlay_impl.cpp diff --git a/tooling/agent/overlay_impl.h b/tooling/dynamic/agent/overlay_impl.h similarity index 100% rename from tooling/agent/overlay_impl.h rename to tooling/dynamic/agent/overlay_impl.h diff --git a/tooling/agent/page_impl.cpp b/tooling/dynamic/agent/page_impl.cpp similarity index 100% rename from tooling/agent/page_impl.cpp rename to tooling/dynamic/agent/page_impl.cpp diff --git a/tooling/agent/page_impl.h b/tooling/dynamic/agent/page_impl.h similarity index 100% rename from tooling/agent/page_impl.h rename to tooling/dynamic/agent/page_impl.h diff --git a/tooling/agent/profiler_impl.cpp b/tooling/dynamic/agent/profiler_impl.cpp similarity index 100% rename from tooling/agent/profiler_impl.cpp rename to tooling/dynamic/agent/profiler_impl.cpp diff --git a/tooling/agent/profiler_impl.h b/tooling/dynamic/agent/profiler_impl.h similarity index 97% rename from tooling/agent/profiler_impl.h rename to tooling/dynamic/agent/profiler_impl.h index e953baca..4361e413 100644 --- a/tooling/agent/profiler_impl.h +++ b/tooling/dynamic/agent/profiler_impl.h @@ -16,8 +16,8 @@ #ifndef ECMASCRIPT_TOOLING_AGENT_PROFILER_IMPL_H #define ECMASCRIPT_TOOLING_AGENT_PROFILER_IMPL_H -#include "tooling/base/pt_params.h" -#include "tooling/base/pt_returns.h" +#include "tooling/dynamic/base/pt_params.h" +#include "tooling/dynamic/base/pt_returns.h" #include "dispatcher.h" #include "ecmascript/dfx/cpu_profiler/samples_record.h" diff --git a/tooling/agent/runtime_impl.cpp b/tooling/dynamic/agent/runtime_impl.cpp similarity index 100% rename from tooling/agent/runtime_impl.cpp rename to tooling/dynamic/agent/runtime_impl.cpp diff --git a/tooling/agent/runtime_impl.h b/tooling/dynamic/agent/runtime_impl.h similarity index 99% rename from tooling/agent/runtime_impl.h rename to tooling/dynamic/agent/runtime_impl.h index 52124416..28040df3 100644 --- a/tooling/agent/runtime_impl.h +++ b/tooling/dynamic/agent/runtime_impl.h @@ -17,7 +17,7 @@ #define ECMASCRIPT_TOOLING_AGENT_RUNTIME_IMPL_H -#include "tooling/base/pt_params.h" +#include "tooling/dynamic/base/pt_params.h" #include "dispatcher.h" #include "libpandabase/macros.h" diff --git a/tooling/agent/target_impl.cpp b/tooling/dynamic/agent/target_impl.cpp similarity index 100% rename from tooling/agent/target_impl.cpp rename to tooling/dynamic/agent/target_impl.cpp diff --git a/tooling/agent/target_impl.h b/tooling/dynamic/agent/target_impl.h similarity index 100% rename from tooling/agent/target_impl.h rename to tooling/dynamic/agent/target_impl.h diff --git a/tooling/agent/tracing_impl.cpp b/tooling/dynamic/agent/tracing_impl.cpp similarity index 100% rename from tooling/agent/tracing_impl.cpp rename to tooling/dynamic/agent/tracing_impl.cpp diff --git a/tooling/agent/tracing_impl.h b/tooling/dynamic/agent/tracing_impl.h similarity index 97% rename from tooling/agent/tracing_impl.h rename to tooling/dynamic/agent/tracing_impl.h index 0b050c0f..65f730fd 100644 --- a/tooling/agent/tracing_impl.h +++ b/tooling/dynamic/agent/tracing_impl.h @@ -20,8 +20,8 @@ #include #endif -#include "tooling/base/pt_params.h" -#include "tooling/base/pt_returns.h" +#include "tooling/dynamic/base/pt_params.h" +#include "tooling/dynamic/base/pt_returns.h" #include "dispatcher.h" #include "ecmascript/dfx/cpu_profiler/samples_record.h" diff --git a/tooling/backend/debugger_executor.cpp b/tooling/dynamic/backend/debugger_executor.cpp similarity index 99% rename from tooling/backend/debugger_executor.cpp rename to tooling/dynamic/backend/debugger_executor.cpp index 806618e7..43c77bd4 100644 --- a/tooling/backend/debugger_executor.cpp +++ b/tooling/dynamic/backend/debugger_executor.cpp @@ -16,7 +16,7 @@ #include "backend/debugger_executor.h" #include "ecmascript/debugger/js_debugger_manager.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" namespace panda::ecmascript::tooling { void DebuggerExecutor::Initialize(const EcmaVM *vm) diff --git a/tooling/backend/debugger_executor.h b/tooling/dynamic/backend/debugger_executor.h similarity index 100% rename from tooling/backend/debugger_executor.h rename to tooling/dynamic/backend/debugger_executor.h diff --git a/tooling/backend/js_pt_hooks.cpp b/tooling/dynamic/backend/js_pt_hooks.cpp similarity index 100% rename from tooling/backend/js_pt_hooks.cpp rename to tooling/dynamic/backend/js_pt_hooks.cpp diff --git a/tooling/backend/js_pt_hooks.h b/tooling/dynamic/backend/js_pt_hooks.h similarity index 96% rename from tooling/backend/js_pt_hooks.h rename to tooling/dynamic/backend/js_pt_hooks.h index f875c697..204e9d8c 100644 --- a/tooling/backend/js_pt_hooks.h +++ b/tooling/dynamic/backend/js_pt_hooks.h @@ -16,8 +16,8 @@ #ifndef ECMASCRIPT_TOOLING_BACKEND_JS_PT_HOOKS_H #define ECMASCRIPT_TOOLING_BACKEND_JS_PT_HOOKS_H -#include "tooling/base/pt_events.h" -#include "tooling/base/pt_script.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/base/pt_script.h" #include "ecmascript/debugger/js_debugger_interface.h" #include "libpandabase/macros.h" diff --git a/tooling/backend/js_single_stepper.cpp b/tooling/dynamic/backend/js_single_stepper.cpp similarity index 100% rename from tooling/backend/js_single_stepper.cpp rename to tooling/dynamic/backend/js_single_stepper.cpp diff --git a/tooling/backend/js_single_stepper.h b/tooling/dynamic/backend/js_single_stepper.h similarity index 100% rename from tooling/backend/js_single_stepper.h rename to tooling/dynamic/backend/js_single_stepper.h diff --git a/tooling/base/pt_base64.cpp b/tooling/dynamic/base/pt_base64.cpp similarity index 99% rename from tooling/base/pt_base64.cpp rename to tooling/dynamic/base/pt_base64.cpp index e50920de..f8f954a8 100644 --- a/tooling/base/pt_base64.cpp +++ b/tooling/dynamic/base/pt_base64.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/base/pt_base64.h" +#include "tooling/dynamic/base/pt_base64.h" namespace panda::ecmascript::tooling { static const unsigned char DECODE_TABLE[] = { diff --git a/tooling/base/pt_base64.h b/tooling/dynamic/base/pt_base64.h similarity index 100% rename from tooling/base/pt_base64.h rename to tooling/dynamic/base/pt_base64.h diff --git a/tooling/base/pt_events.cpp b/tooling/dynamic/base/pt_events.cpp similarity index 99% rename from tooling/base/pt_events.cpp rename to tooling/dynamic/base/pt_events.cpp index 3d7d3771..48ce8b22 100644 --- a/tooling/base/pt_events.cpp +++ b/tooling/dynamic/base/pt_events.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/base/pt_events.h" +#include "tooling/dynamic/base/pt_events.h" namespace panda::ecmascript::tooling { std::unique_ptr BreakpointResolved::ToJson() const diff --git a/tooling/base/pt_events.h b/tooling/dynamic/base/pt_events.h similarity index 99% rename from tooling/base/pt_events.h rename to tooling/dynamic/base/pt_events.h index d39d052e..1ecaba86 100644 --- a/tooling/base/pt_events.h +++ b/tooling/dynamic/base/pt_events.h @@ -20,8 +20,8 @@ #include #include "ecmascript/dfx/tracing/tracing.h" -#include "tooling/base/pt_script.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_script.h" +#include "tooling/dynamic/base/pt_types.h" #include "dispatcher.h" #include "libpandabase/macros.h" diff --git a/tooling/base/pt_json.cpp b/tooling/dynamic/base/pt_json.cpp similarity index 99% rename from tooling/base/pt_json.cpp rename to tooling/dynamic/base/pt_json.cpp index 71fee1a1..a1ce3f47 100644 --- a/tooling/base/pt_json.cpp +++ b/tooling/dynamic/base/pt_json.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/base/pt_json.h" +#include "tooling/dynamic/base/pt_json.h" namespace panda::ecmascript::tooling { std::unique_ptr PtJson::CreateObject() diff --git a/tooling/base/pt_json.h b/tooling/dynamic/base/pt_json.h similarity index 100% rename from tooling/base/pt_json.h rename to tooling/dynamic/base/pt_json.h diff --git a/tooling/base/pt_params.cpp b/tooling/dynamic/base/pt_params.cpp similarity index 97% rename from tooling/base/pt_params.cpp rename to tooling/dynamic/base/pt_params.cpp index 78c2acfd..a53b2a20 100644 --- a/tooling/base/pt_params.cpp +++ b/tooling/dynamic/base/pt_params.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/base/pt_params.h" +#include "tooling/dynamic/base/pt_params.h" namespace panda::ecmascript::tooling { std::unique_ptr EnableParams::Create(const PtJson ¶ms) diff --git a/tooling/base/pt_params.h b/tooling/dynamic/base/pt_params.h similarity index 99% rename from tooling/base/pt_params.h rename to tooling/dynamic/base/pt_params.h index 880addf9..0ca2d375 100644 --- a/tooling/base/pt_params.h +++ b/tooling/dynamic/base/pt_params.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_BASE_PT_PARAMS_H #define ECMASCRIPT_TOOLING_BASE_PT_PARAMS_H -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" namespace panda::ecmascript::tooling { class PtBaseParams : public PtBaseTypes { diff --git a/tooling/base/pt_returns.cpp b/tooling/dynamic/base/pt_returns.cpp similarity index 99% rename from tooling/base/pt_returns.cpp rename to tooling/dynamic/base/pt_returns.cpp index b53355b1..63c1090c 100644 --- a/tooling/base/pt_returns.cpp +++ b/tooling/dynamic/base/pt_returns.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/base/pt_returns.h" +#include "tooling/dynamic/base/pt_returns.h" namespace panda::ecmascript::tooling { std::unique_ptr DebuggerEnableReturns::ToJson() const diff --git a/tooling/base/pt_returns.h b/tooling/dynamic/base/pt_returns.h similarity index 99% rename from tooling/base/pt_returns.h rename to tooling/dynamic/base/pt_returns.h index d9dfa1ef..d6555809 100644 --- a/tooling/base/pt_returns.h +++ b/tooling/dynamic/base/pt_returns.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_BASE_PT_RETURNS_H #define ECMASCRIPT_TOOLING_BASE_PT_RETURNS_H -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" namespace panda::ecmascript::tooling { class PtBaseReturns : public PtBaseTypes { diff --git a/tooling/base/pt_script.cpp b/tooling/dynamic/base/pt_script.cpp similarity index 95% rename from tooling/base/pt_script.cpp rename to tooling/dynamic/base/pt_script.cpp index 79db193f..5d2debde 100644 --- a/tooling/base/pt_script.cpp +++ b/tooling/dynamic/base/pt_script.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/base/pt_script.h" +#include "tooling/dynamic/base/pt_script.h" namespace panda::ecmascript::tooling { PtScript::PtScript(ScriptId scriptId, const std::string &fileName, const std::string &url, const std::string &source) diff --git a/tooling/base/pt_script.h b/tooling/dynamic/base/pt_script.h similarity index 98% rename from tooling/base/pt_script.h rename to tooling/dynamic/base/pt_script.h index 2d797e2b..d4d565f0 100644 --- a/tooling/base/pt_script.h +++ b/tooling/dynamic/base/pt_script.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_BASE_PT_SCRIPT_H #define ECMASCRIPT_TOOLING_BASE_PT_SCRIPT_H -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" #include "libpandabase/macros.h" diff --git a/tooling/base/pt_types.cpp b/tooling/dynamic/base/pt_types.cpp similarity index 99% rename from tooling/base/pt_types.cpp rename to tooling/dynamic/base/pt_types.cpp index 096c7a9d..7e06aa47 100644 --- a/tooling/base/pt_types.cpp +++ b/tooling/dynamic/base/pt_types.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" #include "ecmascript/napi/jsnapi_helper.h" #include "ecmascript/debugger/js_debugger.h" diff --git a/tooling/base/pt_types.h b/tooling/dynamic/base/pt_types.h similarity index 99% rename from tooling/base/pt_types.h rename to tooling/dynamic/base/pt_types.h index 39efb84e..682de66f 100644 --- a/tooling/base/pt_types.h +++ b/tooling/dynamic/base/pt_types.h @@ -21,8 +21,8 @@ #include "common/macros.h" -#include "tooling/base/pt_json.h" -#include "tooling/utils/utils.h" +#include "tooling/dynamic/base/pt_json.h" +#include "tooling/dynamic/utils/utils.h" #include "ecmascript/debugger/debugger_api.h" #include "ecmascript/dfx/cpu_profiler/samples_record.h" diff --git a/tooling/client/BUILD.gn b/tooling/dynamic/client/BUILD.gn similarity index 85% rename from tooling/client/BUILD.gn rename to tooling/dynamic/client/BUILD.gn index 21c40e9b..a2772b8f 100644 --- a/tooling/client/BUILD.gn +++ b/tooling/dynamic/client/BUILD.gn @@ -28,7 +28,6 @@ ohos_source_set("libark_client_set") { ] sources = [ - "../utils/utils.cpp", "domain/debugger_client.cpp", "domain/heapprofiler_client.cpp", "domain/profiler_client.cpp", @@ -47,7 +46,6 @@ ohos_source_set("libark_client_set") { deps += [ "$toolchain_root/websocket:websocket_client", - "..:libark_ecma_debugger", ] external_deps += [ @@ -58,7 +56,13 @@ ohos_source_set("libark_client_set") { "libuv:uv", ] - configs = [ "../..:ark_toolchain_common_config" ] + if (defined(ark_hybrid) && ark_hybrid) { + external_deps += [ "runtime_core:libarkruntime" ] + } else { + external_deps += [ "ets_runtime:libark_jsruntime" ] + } + + configs = [ "../../..:ark_toolchain_common_config" ] cflags_cc = [ "-Wno-vla-extension" ] @@ -68,7 +72,10 @@ ohos_source_set("libark_client_set") { ohos_shared_library("libark_client") { stack_protector_ret = true - deps = [ ":libark_client_set" ] + deps = [ + ":libark_client_set", + "../:libark_ecma_debugger_set", + ] install_enable = false if (!is_mingw && !is_mac) { @@ -83,5 +90,6 @@ ohos_shared_library("libark_client") { external_deps += [ "hilog:libhilog" ] } - subsystem_name = "test" + subsystem_name = "arkcompiler" + part_name = "toolchain" } diff --git a/tooling/client/ark_cli/BUILD.gn b/tooling/dynamic/client/ark_cli/BUILD.gn similarity index 85% rename from tooling/client/ark_cli/BUILD.gn rename to tooling/dynamic/client/ark_cli/BUILD.gn index 73f753d5..eceefabf 100644 --- a/tooling/client/ark_cli/BUILD.gn +++ b/tooling/dynamic/client/ark_cli/BUILD.gn @@ -20,13 +20,16 @@ ohos_executable("arkdb") { "./", "../", "../../base", - "../../../", - "../../../inspector", - "../../../tooling", - "../../../websocket", + "../../../../", + "../../../../inspector", + "../../../../tooling", + "../../../../websocket", ] - deps = [ "../:libark_client_set" ] + deps = [ + "../:libark_client_set", + "../../:libark_ecma_debugger_set", + ] external_deps = [ "bounds_checking_function:libsec_shared", diff --git a/tooling/client/ark_cli/main.cpp b/tooling/dynamic/client/ark_cli/main.cpp similarity index 98% rename from tooling/client/ark_cli/main.cpp rename to tooling/dynamic/client/ark_cli/main.cpp index 030bab0e..f1113f48 100644 --- a/tooling/client/ark_cli/main.cpp +++ b/tooling/dynamic/client/ark_cli/main.cpp @@ -13,8 +13,8 @@ * limitations under the License. */ -#include "tooling/client/utils/cli_command.h" -#include "tooling/client/tcpServer/tcp_server.h" +#include "tooling/dynamic/client/utils/cli_command.h" +#include "tooling/dynamic/client/tcpServer/tcp_server.h" #include "manager/message_manager.h" namespace OHOS::ArkCompiler::Toolchain { diff --git a/tooling/client/ark_multi/BUILD.gn b/tooling/dynamic/client/ark_multi/BUILD.gn similarity index 96% rename from tooling/client/ark_multi/BUILD.gn rename to tooling/dynamic/client/ark_multi/BUILD.gn index 439049c3..c0600b1f 100644 --- a/tooling/client/ark_multi/BUILD.gn +++ b/tooling/dynamic/client/ark_multi/BUILD.gn @@ -15,7 +15,7 @@ import("//arkcompiler/toolchain/toolchain.gni") ohos_executable("ark_multi") { sources = [ - "../../../common/log_wrapper.cpp", + "../../../../common/log_wrapper.cpp", "../../utils/utils.cpp", "main.cpp", ] diff --git a/tooling/client/ark_multi/ReadMe.md b/tooling/dynamic/client/ark_multi/ReadMe.md similarity index 100% rename from tooling/client/ark_multi/ReadMe.md rename to tooling/dynamic/client/ark_multi/ReadMe.md diff --git a/tooling/client/ark_multi/ReadMe_Zh.md b/tooling/dynamic/client/ark_multi/ReadMe_Zh.md similarity index 100% rename from tooling/client/ark_multi/ReadMe_Zh.md rename to tooling/dynamic/client/ark_multi/ReadMe_Zh.md diff --git a/tooling/client/ark_multi/main.cpp b/tooling/dynamic/client/ark_multi/main.cpp similarity index 99% rename from tooling/client/ark_multi/main.cpp rename to tooling/dynamic/client/ark_multi/main.cpp index 79bb02b4..96861ec7 100644 --- a/tooling/client/ark_multi/main.cpp +++ b/tooling/dynamic/client/ark_multi/main.cpp @@ -20,7 +20,7 @@ #include "ecmascript/napi/include/jsnapi_expo.h" #include "ecmascript/platform/file.h" #include "ecmascript/platform/mutex.h" -#include "tooling/utils/utils.h" +#include "tooling/dynamic/utils/utils.h" #ifdef PANDA_TARGET_MACOS #include #include diff --git a/tooling/client/domain/debugger_client.cpp b/tooling/dynamic/client/domain/debugger_client.cpp similarity index 99% rename from tooling/client/domain/debugger_client.cpp rename to tooling/dynamic/client/domain/debugger_client.cpp index 4d3fd7d4..91fce473 100644 --- a/tooling/client/domain/debugger_client.cpp +++ b/tooling/dynamic/client/domain/debugger_client.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ -#include "tooling/client/domain/debugger_client.h" +#include "tooling/dynamic/client/domain/debugger_client.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/session/session.h" using PtJson = panda::ecmascript::tooling::PtJson; namespace OHOS::ArkCompiler::Toolchain { diff --git a/tooling/client/domain/debugger_client.h b/tooling/dynamic/client/domain/debugger_client.h similarity index 98% rename from tooling/client/domain/debugger_client.h rename to tooling/dynamic/client/domain/debugger_client.h index 2320a928..1ebe7bdc 100644 --- a/tooling/client/domain/debugger_client.h +++ b/tooling/dynamic/client/domain/debugger_client.h @@ -19,7 +19,7 @@ #include #include -#include "tooling/base/pt_json.h" +#include "tooling/dynamic/base/pt_json.h" using PtJson = panda::ecmascript::tooling::PtJson; using Result = panda::ecmascript::tooling::Result; diff --git a/tooling/client/domain/heapprofiler_client.cpp b/tooling/dynamic/client/domain/heapprofiler_client.cpp similarity index 99% rename from tooling/client/domain/heapprofiler_client.cpp rename to tooling/dynamic/client/domain/heapprofiler_client.cpp index d8f8e3c4..6e76fe5b 100644 --- a/tooling/client/domain/heapprofiler_client.cpp +++ b/tooling/dynamic/client/domain/heapprofiler_client.cpp @@ -13,8 +13,8 @@ * limitations under the License. */ -#include "tooling/client/domain/heapprofiler_client.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/domain/heapprofiler_client.h" +#include "tooling/dynamic/client/session/session.h" using Result = panda::ecmascript::tooling::Result; namespace OHOS::ArkCompiler::Toolchain { diff --git a/tooling/client/domain/heapprofiler_client.h b/tooling/dynamic/client/domain/heapprofiler_client.h similarity index 97% rename from tooling/client/domain/heapprofiler_client.h rename to tooling/dynamic/client/domain/heapprofiler_client.h index b6a5fd66..c51f0e2f 100644 --- a/tooling/client/domain/heapprofiler_client.h +++ b/tooling/dynamic/client/domain/heapprofiler_client.h @@ -20,7 +20,7 @@ #include #include -#include "tooling/base/pt_json.h" +#include "tooling/dynamic/base/pt_json.h" using PtJson = panda::ecmascript::tooling::PtJson; diff --git a/tooling/client/domain/profiler_client.cpp b/tooling/dynamic/client/domain/profiler_client.cpp similarity index 98% rename from tooling/client/domain/profiler_client.cpp rename to tooling/dynamic/client/domain/profiler_client.cpp index 234c1ecc..f54ff44b 100644 --- a/tooling/client/domain/profiler_client.cpp +++ b/tooling/dynamic/client/domain/profiler_client.cpp @@ -13,8 +13,8 @@ * limitations under the License. */ -#include "tooling/client/domain/profiler_client.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/domain/profiler_client.h" +#include "tooling/dynamic/client/session/session.h" using Result = panda::ecmascript::tooling::Result; using Profile = panda::ecmascript::tooling::Profile; diff --git a/tooling/client/domain/profiler_client.h b/tooling/dynamic/client/domain/profiler_client.h similarity index 98% rename from tooling/client/domain/profiler_client.h rename to tooling/dynamic/client/domain/profiler_client.h index fcdc3f83..f9e6d18c 100644 --- a/tooling/client/domain/profiler_client.h +++ b/tooling/dynamic/client/domain/profiler_client.h @@ -21,7 +21,7 @@ #include -#include "tooling/base/pt_json.h" +#include "tooling/dynamic/base/pt_json.h" namespace OHOS::ArkCompiler::Toolchain { using PtJson = panda::ecmascript::tooling::PtJson; diff --git a/tooling/client/domain/runtime_client.cpp b/tooling/dynamic/client/domain/runtime_client.cpp similarity index 98% rename from tooling/client/domain/runtime_client.cpp rename to tooling/dynamic/client/domain/runtime_client.cpp index 0293330c..fa90ade5 100644 --- a/tooling/client/domain/runtime_client.cpp +++ b/tooling/dynamic/client/domain/runtime_client.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ -#include "tooling/client/domain/runtime_client.h" +#include "tooling/dynamic/client/domain/runtime_client.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/session/session.h" using PtJson = panda::ecmascript::tooling::PtJson; namespace OHOS::ArkCompiler::Toolchain { diff --git a/tooling/client/domain/runtime_client.h b/tooling/dynamic/client/domain/runtime_client.h similarity index 97% rename from tooling/client/domain/runtime_client.h rename to tooling/dynamic/client/domain/runtime_client.h index 12e12705..521304b2 100644 --- a/tooling/client/domain/runtime_client.h +++ b/tooling/dynamic/client/domain/runtime_client.h @@ -19,7 +19,7 @@ #include #include -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using PtJson = panda::ecmascript::tooling::PtJson; using Result = panda::ecmascript::tooling::Result; diff --git a/tooling/client/domain/test_client.cpp b/tooling/dynamic/client/domain/test_client.cpp similarity index 95% rename from tooling/client/domain/test_client.cpp rename to tooling/dynamic/client/domain/test_client.cpp index cc09b5bb..d773a649 100644 --- a/tooling/client/domain/test_client.cpp +++ b/tooling/dynamic/client/domain/test_client.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ -#include "tooling/client/domain/test_client.h" +#include "tooling/dynamic/client/domain/test_client.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/session/session.h" using PtJson = panda::ecmascript::tooling::PtJson; namespace OHOS::ArkCompiler::Toolchain { diff --git a/tooling/client/domain/test_client.h b/tooling/dynamic/client/domain/test_client.h similarity index 96% rename from tooling/client/domain/test_client.h rename to tooling/dynamic/client/domain/test_client.h index 6a768730..9a021ae2 100644 --- a/tooling/client/domain/test_client.h +++ b/tooling/dynamic/client/domain/test_client.h @@ -19,7 +19,7 @@ #include #include -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" using PtJson = panda::ecmascript::tooling::PtJson; using Result = panda::ecmascript::tooling::Result; diff --git a/tooling/client/manager/breakpoint_manager.cpp b/tooling/dynamic/client/manager/breakpoint_manager.cpp similarity index 95% rename from tooling/client/manager/breakpoint_manager.cpp rename to tooling/dynamic/client/manager/breakpoint_manager.cpp index f6df7c61..c704934c 100644 --- a/tooling/client/manager/breakpoint_manager.cpp +++ b/tooling/dynamic/client/manager/breakpoint_manager.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ -#include "tooling/client/manager/breakpoint_manager.h" +#include "tooling/dynamic/client/manager/breakpoint_manager.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/session/session.h" using PtJson = panda::ecmascript::tooling::PtJson; using Result = panda::ecmascript::tooling::Result; diff --git a/tooling/client/manager/breakpoint_manager.h b/tooling/dynamic/client/manager/breakpoint_manager.h similarity index 95% rename from tooling/client/manager/breakpoint_manager.h rename to tooling/dynamic/client/manager/breakpoint_manager.h index 76958898..85e84745 100644 --- a/tooling/client/manager/breakpoint_manager.h +++ b/tooling/dynamic/client/manager/breakpoint_manager.h @@ -22,8 +22,8 @@ #include #include -#include "tooling/base/pt_json.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_json.h" +#include "tooling/dynamic/base/pt_types.h" namespace OHOS::ArkCompiler::Toolchain { using PtJson = panda::ecmascript::tooling::PtJson; diff --git a/tooling/client/manager/domain_manager.cpp b/tooling/dynamic/client/manager/domain_manager.cpp similarity index 97% rename from tooling/client/manager/domain_manager.cpp rename to tooling/dynamic/client/manager/domain_manager.cpp index a5d8467f..927c1f44 100644 --- a/tooling/client/manager/domain_manager.cpp +++ b/tooling/dynamic/client/manager/domain_manager.cpp @@ -15,7 +15,7 @@ #include "domain_manager.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/session/session.h" using PtJson = panda::ecmascript::tooling::PtJson; using Result = panda::ecmascript::tooling::Result; diff --git a/tooling/client/manager/domain_manager.h b/tooling/dynamic/client/manager/domain_manager.h similarity index 88% rename from tooling/client/manager/domain_manager.h rename to tooling/dynamic/client/manager/domain_manager.h index 893a2fe3..ac58bc6b 100644 --- a/tooling/client/manager/domain_manager.h +++ b/tooling/dynamic/client/manager/domain_manager.h @@ -18,11 +18,11 @@ #include -#include "tooling/client/domain/debugger_client.h" -#include "tooling/client/domain/heapprofiler_client.h" -#include "tooling/client/domain/profiler_client.h" -#include "tooling/client/domain/runtime_client.h" -#include "tooling/client/domain/test_client.h" +#include "tooling/dynamic/client/domain/debugger_client.h" +#include "tooling/dynamic/client/domain/heapprofiler_client.h" +#include "tooling/dynamic/client/domain/profiler_client.h" +#include "tooling/dynamic/client/domain/runtime_client.h" +#include "tooling/dynamic/client/domain/test_client.h" namespace OHOS::ArkCompiler::Toolchain { class DomainManager { diff --git a/tooling/client/manager/message_manager.h b/tooling/dynamic/client/manager/message_manager.h similarity index 100% rename from tooling/client/manager/message_manager.h rename to tooling/dynamic/client/manager/message_manager.h diff --git a/tooling/client/manager/source_manager.cpp b/tooling/dynamic/client/manager/source_manager.cpp similarity index 98% rename from tooling/client/manager/source_manager.cpp rename to tooling/dynamic/client/manager/source_manager.cpp index fd621b43..61b045db 100644 --- a/tooling/client/manager/source_manager.cpp +++ b/tooling/dynamic/client/manager/source_manager.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ -#include "tooling/client/manager/source_manager.h" +#include "tooling/dynamic/client/manager/source_manager.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/session/session.h" using PtJson = panda::ecmascript::tooling::PtJson; using Result = panda::ecmascript::tooling::Result; diff --git a/tooling/client/manager/source_manager.h b/tooling/dynamic/client/manager/source_manager.h similarity index 95% rename from tooling/client/manager/source_manager.h rename to tooling/dynamic/client/manager/source_manager.h index 1421cf7f..b938ccf6 100644 --- a/tooling/client/manager/source_manager.h +++ b/tooling/dynamic/client/manager/source_manager.h @@ -21,8 +21,8 @@ #include #include -#include "tooling/base/pt_json.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_json.h" +#include "tooling/dynamic/base/pt_types.h" namespace OHOS::ArkCompiler::Toolchain { using PtJson = panda::ecmascript::tooling::PtJson; diff --git a/tooling/client/manager/stack_manager.cpp b/tooling/dynamic/client/manager/stack_manager.cpp similarity index 97% rename from tooling/client/manager/stack_manager.cpp rename to tooling/dynamic/client/manager/stack_manager.cpp index 7a5fb7cb..51ba11e4 100644 --- a/tooling/client/manager/stack_manager.cpp +++ b/tooling/dynamic/client/manager/stack_manager.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/client/manager/stack_manager.h" +#include "tooling/dynamic/client/manager/stack_manager.h" namespace OHOS::ArkCompiler::Toolchain { void StackManager::SetCallFrames(std::map> callFrames) diff --git a/tooling/client/manager/stack_manager.h b/tooling/dynamic/client/manager/stack_manager.h similarity index 95% rename from tooling/client/manager/stack_manager.h rename to tooling/dynamic/client/manager/stack_manager.h index 99c65e32..7817237c 100644 --- a/tooling/client/manager/stack_manager.h +++ b/tooling/dynamic/client/manager/stack_manager.h @@ -20,8 +20,8 @@ #include #include "common/log_wrapper.h" -#include "tooling/base/pt_json.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_json.h" +#include "tooling/dynamic/base/pt_types.h" using PtJson = panda::ecmascript::tooling::PtJson; using Result = panda::ecmascript::tooling::Result; diff --git a/tooling/client/manager/variable_manager.cpp b/tooling/dynamic/client/manager/variable_manager.cpp similarity index 99% rename from tooling/client/manager/variable_manager.cpp rename to tooling/dynamic/client/manager/variable_manager.cpp index 2812ecf0..d6b4f2d9 100644 --- a/tooling/client/manager/variable_manager.cpp +++ b/tooling/dynamic/client/manager/variable_manager.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/client/manager/variable_manager.h" +#include "tooling/dynamic/client/manager/variable_manager.h" using PtJson = panda::ecmascript::tooling::PtJson; namespace OHOS::ArkCompiler::Toolchain { diff --git a/tooling/client/manager/variable_manager.h b/tooling/dynamic/client/manager/variable_manager.h similarity index 95% rename from tooling/client/manager/variable_manager.h rename to tooling/dynamic/client/manager/variable_manager.h index 7bd72b7e..8d16af41 100644 --- a/tooling/client/manager/variable_manager.h +++ b/tooling/dynamic/client/manager/variable_manager.h @@ -19,10 +19,10 @@ #include #include -#include "tooling/client/manager/stack_manager.h" -#include "tooling/base/pt_json.h" -#include "tooling/base/pt_returns.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/client/manager/stack_manager.h" +#include "tooling/dynamic/base/pt_json.h" +#include "tooling/dynamic/base/pt_returns.h" +#include "tooling/dynamic/base/pt_types.h" using PtJson = panda::ecmascript::tooling::PtJson; using Result = panda::ecmascript::tooling::Result; diff --git a/tooling/client/manager/watch_manager.cpp b/tooling/dynamic/client/manager/watch_manager.cpp similarity index 98% rename from tooling/client/manager/watch_manager.cpp rename to tooling/dynamic/client/manager/watch_manager.cpp index 49191e70..caf457f1 100644 --- a/tooling/client/manager/watch_manager.cpp +++ b/tooling/dynamic/client/manager/watch_manager.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ -#include "tooling/client/manager/watch_manager.h" +#include "tooling/dynamic/client/manager/watch_manager.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/session/session.h" using PtJson = panda::ecmascript::tooling::PtJson; using Result = panda::ecmascript::tooling::Result; diff --git a/tooling/client/manager/watch_manager.h b/tooling/dynamic/client/manager/watch_manager.h similarity index 93% rename from tooling/client/manager/watch_manager.h rename to tooling/dynamic/client/manager/watch_manager.h index be0aea47..753d5cc7 100644 --- a/tooling/client/manager/watch_manager.h +++ b/tooling/dynamic/client/manager/watch_manager.h @@ -21,9 +21,9 @@ #include #include -#include "tooling/base/pt_json.h" -#include "tooling/base/pt_types.h" -#include "tooling/client/domain/runtime_client.h" +#include "tooling/dynamic/base/pt_json.h" +#include "tooling/dynamic/base/pt_types.h" +#include "tooling/dynamic/client/domain/runtime_client.h" namespace OHOS::ArkCompiler::Toolchain { using PtJson = panda::ecmascript::tooling::PtJson; diff --git a/tooling/client/session/session.cpp b/tooling/dynamic/client/session/session.cpp similarity index 98% rename from tooling/client/session/session.cpp rename to tooling/dynamic/client/session/session.cpp index db690148..8940d331 100755 --- a/tooling/client/session/session.cpp +++ b/tooling/dynamic/client/session/session.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/session/session.h" -#include "tooling/client/manager/message_manager.h" +#include "tooling/dynamic/client/manager/message_manager.h" using PtJson = panda::ecmascript::tooling::PtJson; using Result = panda::ecmascript::tooling::Result; diff --git a/tooling/client/session/session.h b/tooling/dynamic/client/session/session.h similarity index 92% rename from tooling/client/session/session.h rename to tooling/dynamic/client/session/session.h index a915b66f..b875553d 100755 --- a/tooling/client/session/session.h +++ b/tooling/dynamic/client/session/session.h @@ -24,12 +24,12 @@ #include #include -#include "tooling/client/manager/domain_manager.h" -#include "tooling/client/manager/breakpoint_manager.h" -#include "tooling/client/manager/source_manager.h" -#include "tooling/client/manager/stack_manager.h" -#include "tooling/client/manager/variable_manager.h" -#include "tooling/client/manager/watch_manager.h" +#include "tooling/dynamic/client/manager/domain_manager.h" +#include "tooling/dynamic/client/manager/breakpoint_manager.h" +#include "tooling/dynamic/client/manager/source_manager.h" +#include "tooling/dynamic/client/manager/stack_manager.h" +#include "tooling/dynamic/client/manager/variable_manager.h" +#include "tooling/dynamic/client/manager/watch_manager.h" #include "websocket/client/websocket_client.h" namespace OHOS::ArkCompiler::Toolchain { diff --git a/tooling/client/tcpServer/tcp_server.cpp b/tooling/dynamic/client/tcpServer/tcp_server.cpp similarity index 98% rename from tooling/client/tcpServer/tcp_server.cpp rename to tooling/dynamic/client/tcpServer/tcp_server.cpp index 3884ca15..4efd2853 100644 --- a/tooling/client/tcpServer/tcp_server.cpp +++ b/tooling/dynamic/client/tcpServer/tcp_server.cpp @@ -12,10 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "tooling/client/tcpServer/tcp_server.h" +#include "tooling/dynamic/client/tcpServer/tcp_server.h" #include "platform/file.h" -#include "tooling/utils/utils.h" +#include "tooling/dynamic/utils/utils.h" namespace OHOS::ArkCompiler::Toolchain { uv_async_t* g_inputSignal; diff --git a/tooling/client/tcpServer/tcp_server.h b/tooling/dynamic/client/tcpServer/tcp_server.h similarity index 100% rename from tooling/client/tcpServer/tcp_server.h rename to tooling/dynamic/client/tcpServer/tcp_server.h diff --git a/tooling/client/tcpServer/test/config.py b/tooling/dynamic/client/tcpServer/test/config.py similarity index 100% rename from tooling/client/tcpServer/test/config.py rename to tooling/dynamic/client/tcpServer/test/config.py diff --git a/tooling/client/tcpServer/test/js_test_base.py b/tooling/dynamic/client/tcpServer/test/js_test_base.py similarity index 100% rename from tooling/client/tcpServer/test/js_test_base.py rename to tooling/dynamic/client/tcpServer/test/js_test_base.py diff --git a/tooling/client/tcpServer/test/js_test_case/__init__.py b/tooling/dynamic/client/tcpServer/test/js_test_case/__init__.py similarity index 100% rename from tooling/client/tcpServer/test/js_test_case/__init__.py rename to tooling/dynamic/client/tcpServer/test/js_test_case/__init__.py diff --git a/tooling/client/tcpServer/test/js_test_case/js_test.py b/tooling/dynamic/client/tcpServer/test/js_test_case/js_test.py similarity index 100% rename from tooling/client/tcpServer/test/js_test_case/js_test.py rename to tooling/dynamic/client/tcpServer/test/js_test_case/js_test.py diff --git a/tooling/client/tcpServer/test/runtest.py b/tooling/dynamic/client/tcpServer/test/runtest.py similarity index 100% rename from tooling/client/tcpServer/test/runtest.py rename to tooling/dynamic/client/tcpServer/test/runtest.py diff --git a/tooling/client/utils/cli_command.cpp b/tooling/dynamic/client/utils/cli_command.cpp similarity index 99% rename from tooling/client/utils/cli_command.cpp rename to tooling/dynamic/client/utils/cli_command.cpp index 80810248..e6b88abd 100644 --- a/tooling/client/utils/cli_command.cpp +++ b/tooling/dynamic/client/utils/cli_command.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/client/utils/cli_command.h" +#include "tooling/dynamic/client/utils/cli_command.h" namespace OHOS::ArkCompiler::Toolchain { const std::string HELP_MSG = "usage: \n" diff --git a/tooling/client/utils/cli_command.h b/tooling/dynamic/client/utils/cli_command.h similarity index 91% rename from tooling/client/utils/cli_command.h rename to tooling/dynamic/client/utils/cli_command.h index b23667b7..0b0e7f46 100644 --- a/tooling/client/utils/cli_command.h +++ b/tooling/dynamic/client/utils/cli_command.h @@ -22,11 +22,11 @@ #include #include "common/log_wrapper.h" -#include "tooling/client/domain/heapprofiler_client.h" -#include "tooling/client/domain/profiler_client.h" -#include "tooling/client/manager/domain_manager.h" -#include "tooling/utils/utils.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/domain/heapprofiler_client.h" +#include "tooling/dynamic/client/domain/profiler_client.h" +#include "tooling/dynamic/client/manager/domain_manager.h" +#include "tooling/dynamic/utils/utils.h" +#include "tooling/dynamic/client/session/session.h" namespace OHOS::ArkCompiler::Toolchain { using StrPair = std::pair; diff --git a/tooling/debugger_service.cpp b/tooling/dynamic/debugger_service.cpp similarity index 100% rename from tooling/debugger_service.cpp rename to tooling/dynamic/debugger_service.cpp diff --git a/tooling/debugger_service.h b/tooling/dynamic/debugger_service.h similarity index 100% rename from tooling/debugger_service.h rename to tooling/dynamic/debugger_service.h diff --git a/tooling/dispatcher.cpp b/tooling/dynamic/dispatcher.cpp similarity index 100% rename from tooling/dispatcher.cpp rename to tooling/dynamic/dispatcher.cpp diff --git a/tooling/dispatcher.h b/tooling/dynamic/dispatcher.h similarity index 99% rename from tooling/dispatcher.h rename to tooling/dynamic/dispatcher.h index 88543cef..b2db05cf 100644 --- a/tooling/dispatcher.h +++ b/tooling/dynamic/dispatcher.h @@ -20,7 +20,7 @@ #include #include -#include "tooling/base/pt_returns.h" +#include "tooling/dynamic/base/pt_returns.h" #include "ecmascript/debugger/js_debugger_interface.h" #include "ecmascript/napi/include/jsnapi.h" diff --git a/tooling/protocol_channel.h b/tooling/dynamic/protocol_channel.h similarity index 94% rename from tooling/protocol_channel.h rename to tooling/dynamic/protocol_channel.h index adb52366..d4e4b543 100644 --- a/tooling/protocol_channel.h +++ b/tooling/dynamic/protocol_channel.h @@ -16,8 +16,8 @@ #ifndef ECMASCRIPT_TOOLING_PROTOCOL_CHANNEL_H #define ECMASCRIPT_TOOLING_PROTOCOL_CHANNEL_H -#include "tooling/base/pt_events.h" -#include "tooling/base/pt_returns.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/base/pt_returns.h" #include "dispatcher.h" #include "libpandabase/macros.h" diff --git a/tooling/protocol_handler.cpp b/tooling/dynamic/protocol_handler.cpp similarity index 100% rename from tooling/protocol_handler.cpp rename to tooling/dynamic/protocol_handler.cpp diff --git a/tooling/protocol_handler.h b/tooling/dynamic/protocol_handler.h similarity index 100% rename from tooling/protocol_handler.h rename to tooling/dynamic/protocol_handler.h diff --git a/tooling/test/BUILD.gn b/tooling/dynamic/test/BUILD.gn similarity index 97% rename from tooling/test/BUILD.gn rename to tooling/dynamic/test/BUILD.gn index ae5d327a..ed8586b0 100644 --- a/tooling/test/BUILD.gn +++ b/tooling/dynamic/test/BUILD.gn @@ -31,7 +31,7 @@ config("debug_api_test") { ] } -test_js_path = "//arkcompiler/toolchain/tooling/test/testcases/js/" +test_js_path = "//arkcompiler/toolchain/tooling/dynamic/test/testcases/js/" # When new js test file added, pls modify ohos_test.xml in test/resource accordingly. test_js_files = [ @@ -117,7 +117,7 @@ ohos_shared_library("jsdebugtest") { configs = [ ":debug_api_test", - "//arkcompiler/toolchain/tooling:ark_ecma_debugger_config", + "//arkcompiler/toolchain/tooling/dynamic:ark_ecma_debugger_config", ] test_abc_dir = "/data/test/" @@ -304,7 +304,7 @@ host_unittest_action("DebuggerClientTest") { deps = [ ":debugger_client_resource", "..:libark_ecma_debugger_test", - "../client:libark_client", + "../client:libark_client_set", ] # hiviewdfx libraries @@ -351,7 +351,7 @@ host_unittest_action("DebuggerCIntClientTest") { deps = [ ":debugger_client_resource", "..:libark_ecma_debugger_test", - "../client:libark_client", + "../client:libark_client_set", ] # hiviewdfx libraries @@ -380,7 +380,7 @@ group("debugger_entry_resource") { group("debugger_client_resource") { testonly = true - deps = [ "../../inspector:ark_debugger" ] + deps = [ "../../../inspector:ark_debugger" ] foreach(file, test_js_files) { deps += [ ":gen_${file}_abc" ] } diff --git a/tooling/test/animation_impl_test.cpp b/tooling/dynamic/test/animation_impl_test.cpp similarity index 100% rename from tooling/test/animation_impl_test.cpp rename to tooling/dynamic/test/animation_impl_test.cpp diff --git a/tooling/test/client_utils/test_actions.h b/tooling/dynamic/test/client_utils/test_actions.h similarity index 100% rename from tooling/test/client_utils/test_actions.h rename to tooling/dynamic/test/client_utils/test_actions.h diff --git a/tooling/test/client_utils/test_list.cpp b/tooling/dynamic/test/client_utils/test_list.cpp similarity index 61% rename from tooling/test/client_utils/test_list.cpp rename to tooling/dynamic/test/client_utils/test_list.cpp index fbb93774..0fba99ea 100644 --- a/tooling/test/client_utils/test_list.cpp +++ b/tooling/dynamic/test/client_utils/test_list.cpp @@ -13,69 +13,65 @@ * limitations under the License. */ -#include "tooling/test/client_utils/test_list.h" +#include "tooling/dynamic/test/client_utils/test_list.h" -#include "ecmascript/base/config.h" -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" // testcase list -#include "tooling/test/testcases/js_accelerate_launch_test.h" -#include "tooling/test/testcases/js_allocationtrack_loop_test.h" -#include "tooling/test/testcases/js_allocationtrack_recursion_test.h" -#include "tooling/test/testcases/js_allocationtrack_test.h" -#include "tooling/test/testcases/js_breakpoint_arrow_test.h" -#include "tooling/test/testcases/js_breakpoint_async_test.h" -#include "tooling/test/testcases/js_breakpoint_cannot_hit_test.h" -#include "tooling/test/testcases/js_breakpoint_in_different_branch.h" -#include "tooling/test/testcases/js_breakpoint_loop_test.h" -#include "tooling/test/testcases/js_breakpoint_recursion_test.h" -#include "tooling/test/testcases/js_breakpoint_switch_test.h" -#include "tooling/test/testcases/js_breakpoint_test.h" -#include "tooling/test/testcases/js_closure_scope_test.h" -#include "tooling/test/testcases/js_container_test.h" -#include "tooling/test/testcases/js_exception_test.h" -#include "tooling/test/testcases/js_heapdump_loop_test.h" -#include "tooling/test/testcases/js_heapdump_test.h" -#include "tooling/test/testcases/js_heapusage_async_test.h" -#include "tooling/test/testcases/js_heapusage_loop_test.h" -#include "tooling/test/testcases/js_heapusage_recursion_test.h" -#include "tooling/test/testcases/js_heapusage_step_test.h" -#include "tooling/test/testcases/js_heapusage_test.h" -#include "tooling/test/testcases/js_local_variable_scope_test.h" -#include "tooling/test/testcases/js_module_variable_test.h" -#include "tooling/test/testcases/js_multiple_breakpoint_in_function_test.h" -#include "tooling/test/testcases/js_multiple_common_breakpoint_test.h" -#include "tooling/test/testcases/js_smart_stepInto_test.h" -#include "tooling/test/testcases/js_source_test.h" -#include "tooling/test/testcases/js_special_location_breakpoint_test.h" -#include "tooling/test/testcases/js_stepinto_and_stepout_test.h" -#include "tooling/test/testcases/js_stepinto_arrow_test.h" -#include "tooling/test/testcases/js_stepinto_async_test.h" -#include "tooling/test/testcases/js_stepinto_loop_test.h" -#include "tooling/test/testcases/js_stepinto_recursion_test.h" -#include "tooling/test/testcases/js_stepinto_switch_test.h" -#include "tooling/test/testcases/js_stepinto_test.h" -#include "tooling/test/testcases/js_stepout_arrow_test.h" -#include "tooling/test/testcases/js_stepout_async_test.h" -#include "tooling/test/testcases/js_stepout_before_function_test.h" -#include "tooling/test/testcases/js_stepout_loop_test.h" -#include "tooling/test/testcases/js_stepout_recursion_test.h" -#include "tooling/test/testcases/js_stepout_switch_test.h" -#include "tooling/test/testcases/js_stepout_test.h" -#include "tooling/test/testcases/js_stepover_loop_test.h" -#include "tooling/test/testcases/js_stepover_recursion_test.h" -#include "tooling/test/testcases/js_stepover_switch_test.h" -#include "tooling/test/testcases/js_stepover_test.h" -#include "tooling/test/testcases/js_tracing_test.h" -#include "tooling/test/testcases/js_watch_basic_type_test.h" -#include "tooling/test/testcases/js_watch_closure_variable_test.h" -#include "tooling/test/testcases/js_watch_module_test.h" -#include "tooling/test/testcases/js_watch_other_type_test.h" -#include "tooling/test/testcases/js_watch_set_type_test.h" -#include "tooling/test/testcases/js_watch_test.h" -#include "tooling/test/testcases/js_watch_variable_test.h" -#include "tooling/test/testcases/js_asyn_stack_test.h" -#include "tooling/test/testcases/js_symbolbreakpoint_test.h" +#include "tooling/dynamic/test/testcases/js_accelerate_launch_test.h" +#include "tooling/dynamic/test/testcases/js_allocationtrack_loop_test.h" +#include "tooling/dynamic/test/testcases/js_allocationtrack_recursion_test.h" +#include "tooling/dynamic/test/testcases/js_allocationtrack_test.h" +#include "tooling/dynamic/test/testcases/js_breakpoint_arrow_test.h" +#include "tooling/dynamic/test/testcases/js_breakpoint_async_test.h" +#include "tooling/dynamic/test/testcases/js_breakpoint_cannot_hit_test.h" +#include "tooling/dynamic/test/testcases/js_breakpoint_in_different_branch.h" +#include "tooling/dynamic/test/testcases/js_breakpoint_loop_test.h" +#include "tooling/dynamic/test/testcases/js_breakpoint_recursion_test.h" +#include "tooling/dynamic/test/testcases/js_breakpoint_switch_test.h" +#include "tooling/dynamic/test/testcases/js_breakpoint_test.h" +#include "tooling/dynamic/test/testcases/js_closure_scope_test.h" +#include "tooling/dynamic/test/testcases/js_container_test.h" +#include "tooling/dynamic/test/testcases/js_exception_test.h" +#include "tooling/dynamic/test/testcases/js_heapdump_loop_test.h" +#include "tooling/dynamic/test/testcases/js_heapdump_test.h" +#include "tooling/dynamic/test/testcases/js_heapusage_async_test.h" +#include "tooling/dynamic/test/testcases/js_heapusage_loop_test.h" +#include "tooling/dynamic/test/testcases/js_heapusage_recursion_test.h" +#include "tooling/dynamic/test/testcases/js_heapusage_step_test.h" +#include "tooling/dynamic/test/testcases/js_heapusage_test.h" +#include "tooling/dynamic/test/testcases/js_local_variable_scope_test.h" +#include "tooling/dynamic/test/testcases/js_module_variable_test.h" +#include "tooling/dynamic/test/testcases/js_multiple_breakpoint_in_function_test.h" +#include "tooling/dynamic/test/testcases/js_multiple_common_breakpoint_test.h" +#include "tooling/dynamic/test/testcases/js_smart_stepInto_test.h" +#include "tooling/dynamic/test/testcases/js_source_test.h" +#include "tooling/dynamic/test/testcases/js_special_location_breakpoint_test.h" +#include "tooling/dynamic/test/testcases/js_stepinto_and_stepout_test.h" +#include "tooling/dynamic/test/testcases/js_stepinto_arrow_test.h" +#include "tooling/dynamic/test/testcases/js_stepinto_async_test.h" +#include "tooling/dynamic/test/testcases/js_stepinto_loop_test.h" +#include "tooling/dynamic/test/testcases/js_stepinto_recursion_test.h" +#include "tooling/dynamic/test/testcases/js_stepinto_switch_test.h" +#include "tooling/dynamic/test/testcases/js_stepinto_test.h" +#include "tooling/dynamic/test/testcases/js_stepout_arrow_test.h" +#include "tooling/dynamic/test/testcases/js_stepout_async_test.h" +#include "tooling/dynamic/test/testcases/js_stepout_before_function_test.h" +#include "tooling/dynamic/test/testcases/js_stepout_loop_test.h" +#include "tooling/dynamic/test/testcases/js_stepout_recursion_test.h" +#include "tooling/dynamic/test/testcases/js_stepout_switch_test.h" +#include "tooling/dynamic/test/testcases/js_stepout_test.h" +#include "tooling/dynamic/test/testcases/js_stepover_loop_test.h" +#include "tooling/dynamic/test/testcases/js_stepover_recursion_test.h" +#include "tooling/dynamic/test/testcases/js_stepover_switch_test.h" +#include "tooling/dynamic/test/testcases/js_stepover_test.h" +#include "tooling/dynamic/test/testcases/js_tracing_test.h" +#include "tooling/dynamic/test/testcases/js_watch_basic_type_test.h" +#include "tooling/dynamic/test/testcases/js_watch_closure_variable_test.h" +#include "tooling/dynamic/test/testcases/js_watch_other_type_test.h" +#include "tooling/dynamic/test/testcases/js_watch_set_type_test.h" +#include "tooling/dynamic/test/testcases/js_watch_test.h" +#include "tooling/dynamic/test/testcases/js_watch_variable_test.h" namespace panda::ecmascript::tooling::test { static std::string g_currentTestName = ""; diff --git a/tooling/test/client_utils/test_list.h b/tooling/dynamic/test/client_utils/test_list.h similarity index 100% rename from tooling/test/client_utils/test_list.h rename to tooling/dynamic/test/client_utils/test_list.h diff --git a/tooling/test/client_utils/test_util.cpp b/tooling/dynamic/test/client_utils/test_util.cpp similarity index 96% rename from tooling/test/client_utils/test_util.cpp rename to tooling/dynamic/test/client_utils/test_util.cpp index 3d045c2b..c39e7f05 100644 --- a/tooling/test/client_utils/test_util.cpp +++ b/tooling/dynamic/test/client_utils/test_util.cpp @@ -13,12 +13,12 @@ * limitations under the License. */ -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" -#include "tooling/client/domain/debugger_client.h" -#include "tooling/client/domain/runtime_client.h" -#include "tooling/client/utils/cli_command.h" -#include "tooling/client/session/session.h" +#include "tooling/dynamic/client/domain/debugger_client.h" +#include "tooling/dynamic/client/domain/runtime_client.h" +#include "tooling/dynamic/client/utils/cli_command.h" +#include "tooling/dynamic/client/session/session.h" #include "websocket/client/websocket_client.h" #include diff --git a/tooling/test/client_utils/test_util.h b/tooling/dynamic/test/client_utils/test_util.h similarity index 91% rename from tooling/test/client_utils/test_util.h rename to tooling/dynamic/test/client_utils/test_util.h index 5fe22bbe..7b3fdaf0 100644 --- a/tooling/test/client_utils/test_util.h +++ b/tooling/dynamic/test/client_utils/test_util.h @@ -16,11 +16,11 @@ #ifndef ECMASCRIPT_TOOLING_TEST_UTILS_TEST_UTIL_H #define ECMASCRIPT_TOOLING_TEST_UTILS_TEST_UTIL_H -#include "tooling/test/client_utils/test_actions.h" +#include "tooling/dynamic/test/client_utils/test_actions.h" -#include "tooling/client/domain/debugger_client.h" -#include "tooling/client/domain/runtime_client.h" -#include "tooling/client/manager/domain_manager.h" +#include "tooling/dynamic/client/domain/debugger_client.h" +#include "tooling/dynamic/client/domain/runtime_client.h" +#include "tooling/dynamic/client/manager/domain_manager.h" #include "ecmascript/jspandafile/js_pandafile_manager.h" #include "ecmascript/debugger/js_debugger.h" #include "os/mutex.h" diff --git a/tooling/test/debugger_cint_client_test.cpp b/tooling/dynamic/test/debugger_cint_client_test.cpp similarity index 95% rename from tooling/test/debugger_cint_client_test.cpp rename to tooling/dynamic/test/debugger_cint_client_test.cpp index c56746cc..9c225bb9 100644 --- a/tooling/test/debugger_cint_client_test.cpp +++ b/tooling/dynamic/test/debugger_cint_client_test.cpp @@ -18,8 +18,8 @@ #include "ecmascript/ecma_vm.h" #include "ecmascript/napi/include/jsnapi.h" #include "ecmascript/tests/test_helper.h" -#include "tooling/test/client_utils/test_list.h" -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_list.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { using panda::test::TestHelper; diff --git a/tooling/test/debugger_cinterp_test.cpp b/tooling/dynamic/test/debugger_cinterp_test.cpp similarity index 97% rename from tooling/test/debugger_cinterp_test.cpp rename to tooling/dynamic/test/debugger_cinterp_test.cpp index 3e7452fa..71940889 100644 --- a/tooling/test/debugger_cinterp_test.cpp +++ b/tooling/dynamic/test/debugger_cinterp_test.cpp @@ -16,7 +16,7 @@ #include "ecmascript/ecma_vm.h" #include "ecmascript/napi/include/jsnapi.h" #include "ecmascript/tests/test_helper.h" -#include "tooling/test/utils/test_list.h" +#include "tooling/dynamic/test/utils/test_list.h" #include "ecmascript/debugger/js_debugger.h" namespace panda::ecmascript::tooling::test { diff --git a/tooling/test/debugger_client_test.cpp b/tooling/dynamic/test/debugger_client_test.cpp similarity index 95% rename from tooling/test/debugger_client_test.cpp rename to tooling/dynamic/test/debugger_client_test.cpp index b4600761..d68fd1e9 100644 --- a/tooling/test/debugger_client_test.cpp +++ b/tooling/dynamic/test/debugger_client_test.cpp @@ -18,8 +18,8 @@ #include "ecmascript/ecma_vm.h" #include "ecmascript/napi/include/jsnapi.h" #include "ecmascript/tests/test_helper.h" -#include "tooling/test/client_utils/test_list.h" -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_list.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { using panda::test::TestHelper; diff --git a/tooling/test/debugger_commands_test.cpp b/tooling/dynamic/test/debugger_commands_test.cpp similarity index 95% rename from tooling/test/debugger_commands_test.cpp rename to tooling/dynamic/test/debugger_commands_test.cpp index 6a9fbdaf..8464391c 100644 --- a/tooling/test/debugger_commands_test.cpp +++ b/tooling/dynamic/test/debugger_commands_test.cpp @@ -19,8 +19,8 @@ #include "ecmascript/debugger/js_debugger.h" #include "ecmascript/tests/test_helper.h" -#include "tooling/base/pt_params.h" -#include "tooling/base/pt_returns.h" +#include "tooling/dynamic/base/pt_params.h" +#include "tooling/dynamic/base/pt_returns.h" #include "debugger_service.h" #include "dispatcher.h" diff --git a/tooling/test/debugger_entry_test.cpp b/tooling/dynamic/test/debugger_entry_test.cpp similarity index 97% rename from tooling/test/debugger_entry_test.cpp rename to tooling/dynamic/test/debugger_entry_test.cpp index 6710e86a..8d2ec89e 100644 --- a/tooling/test/debugger_entry_test.cpp +++ b/tooling/dynamic/test/debugger_entry_test.cpp @@ -16,7 +16,7 @@ #include "ecmascript/ecma_vm.h" #include "ecmascript/napi/include/jsnapi.h" #include "ecmascript/tests/test_helper.h" -#include "tooling/test/utils/test_list.h" +#include "tooling/dynamic/test/utils/test_list.h" #include "ecmascript/debugger/js_debugger.h" namespace panda::ecmascript::tooling::test { diff --git a/tooling/test/debugger_events_test.cpp b/tooling/dynamic/test/debugger_events_test.cpp similarity index 99% rename from tooling/test/debugger_events_test.cpp rename to tooling/dynamic/test/debugger_events_test.cpp index 08a344fe..248a30f1 100644 --- a/tooling/test/debugger_events_test.cpp +++ b/tooling/dynamic/test/debugger_events_test.cpp @@ -17,8 +17,8 @@ #include "ecmascript/js_tagged_value-inl.h" #include "ecmascript/object_factory.h" #include "ecmascript/tests/test_helper.h" -#include "tooling/base/pt_events.h" -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_events.h" +#include "tooling/dynamic/base/pt_types.h" #include "dispatcher.h" using namespace panda::ecmascript; diff --git a/tooling/test/debugger_impl_test.cpp b/tooling/dynamic/test/debugger_impl_test.cpp similarity index 100% rename from tooling/test/debugger_impl_test.cpp rename to tooling/dynamic/test/debugger_impl_test.cpp diff --git a/tooling/test/debugger_params_test.cpp b/tooling/dynamic/test/debugger_params_test.cpp similarity index 97% rename from tooling/test/debugger_params_test.cpp rename to tooling/dynamic/test/debugger_params_test.cpp index af06a80e..d432df4a 100644 --- a/tooling/test/debugger_params_test.cpp +++ b/tooling/dynamic/test/debugger_params_test.cpp @@ -13,8 +13,8 @@ * limitations under the License. */ -#include "tooling/base/pt_types.h" -#include "tooling/base/pt_params.h" +#include "tooling/dynamic/base/pt_types.h" +#include "tooling/dynamic/base/pt_params.h" #include "dispatcher.h" #include "ecmascript/js_array.h" diff --git a/tooling/test/debugger_returns_test.cpp b/tooling/dynamic/test/debugger_returns_test.cpp similarity index 99% rename from tooling/test/debugger_returns_test.cpp rename to tooling/dynamic/test/debugger_returns_test.cpp index abe1dfd4..ede1ba87 100644 --- a/tooling/test/debugger_returns_test.cpp +++ b/tooling/dynamic/test/debugger_returns_test.cpp @@ -13,8 +13,8 @@ * limitations under the License. */ -#include "tooling/base/pt_types.h" -#include "tooling/base/pt_returns.h" +#include "tooling/dynamic/base/pt_types.h" +#include "tooling/dynamic/base/pt_returns.h" #include "dispatcher.h" #include "ecmascript/js_array.h" diff --git a/tooling/test/debugger_script_test.cpp b/tooling/dynamic/test/debugger_script_test.cpp similarity index 96% rename from tooling/test/debugger_script_test.cpp rename to tooling/dynamic/test/debugger_script_test.cpp index 38562947..0251ff2b 100644 --- a/tooling/test/debugger_script_test.cpp +++ b/tooling/dynamic/test/debugger_script_test.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "tooling/base/pt_params.h" -#include "tooling/base/pt_returns.h" -#include "tooling/base/pt_script.h" +#include "tooling/dynamic/base/pt_params.h" +#include "tooling/dynamic/base/pt_returns.h" +#include "tooling/dynamic/base/pt_script.h" #include "debugger_service.h" #include "dispatcher.h" diff --git a/tooling/test/debugger_service_test.cpp b/tooling/dynamic/test/debugger_service_test.cpp similarity index 100% rename from tooling/test/debugger_service_test.cpp rename to tooling/dynamic/test/debugger_service_test.cpp diff --git a/tooling/test/debugger_types_test.cpp b/tooling/dynamic/test/debugger_types_test.cpp similarity index 99% rename from tooling/test/debugger_types_test.cpp rename to tooling/dynamic/test/debugger_types_test.cpp index ea33eba4..2d5d21f3 100644 --- a/tooling/test/debugger_types_test.cpp +++ b/tooling/dynamic/test/debugger_types_test.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" #include "dispatcher.h" #include "ecmascript/js_array.h" diff --git a/tooling/test/dispatcher_test.cpp b/tooling/dynamic/test/dispatcher_test.cpp similarity index 100% rename from tooling/test/dispatcher_test.cpp rename to tooling/dynamic/test/dispatcher_test.cpp diff --git a/tooling/test/dom_impl_test.cpp b/tooling/dynamic/test/dom_impl_test.cpp similarity index 100% rename from tooling/test/dom_impl_test.cpp rename to tooling/dynamic/test/dom_impl_test.cpp diff --git a/tooling/test/entry/test_debugger_entry.cpp b/tooling/dynamic/test/entry/test_debugger_entry.cpp similarity index 94% rename from tooling/test/entry/test_debugger_entry.cpp rename to tooling/dynamic/test/entry/test_debugger_entry.cpp index f425a638..57dad11f 100644 --- a/tooling/test/entry/test_debugger_entry.cpp +++ b/tooling/dynamic/test/entry/test_debugger_entry.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/test/utils/test_entry.h" +#include "tooling/dynamic/test/utils/test_entry.h" namespace panda::ecmascript::tooling::test { extern "C" bool StartDebug(const std::string &name, EcmaVM *vm, bool isDebugMode) diff --git a/tooling/test/heapprofiler_impl_test.cpp b/tooling/dynamic/test/heapprofiler_impl_test.cpp similarity index 100% rename from tooling/test/heapprofiler_impl_test.cpp rename to tooling/dynamic/test/heapprofiler_impl_test.cpp diff --git a/tooling/test/js_pt_hooks_test.cpp b/tooling/dynamic/test/js_pt_hooks_test.cpp similarity index 97% rename from tooling/test/js_pt_hooks_test.cpp rename to tooling/dynamic/test/js_pt_hooks_test.cpp index 5d261d31..34ea1dac 100755 --- a/tooling/test/js_pt_hooks_test.cpp +++ b/tooling/dynamic/test/js_pt_hooks_test.cpp @@ -15,8 +15,8 @@ #include "agent/debugger_impl.h" #include "backend/js_pt_hooks.h" -#include "tooling/base/pt_types.h" -#include "tooling/base/pt_events.h" +#include "tooling/dynamic/base/pt_types.h" +#include "tooling/dynamic/base/pt_events.h" #include "dispatcher.h" #include "ecmascript/debugger/js_debugger.h" diff --git a/tooling/test/overlay_impl_test.cpp b/tooling/dynamic/test/overlay_impl_test.cpp similarity index 100% rename from tooling/test/overlay_impl_test.cpp rename to tooling/dynamic/test/overlay_impl_test.cpp diff --git a/tooling/test/page_impl_test.cpp b/tooling/dynamic/test/page_impl_test.cpp similarity index 100% rename from tooling/test/page_impl_test.cpp rename to tooling/dynamic/test/page_impl_test.cpp diff --git a/tooling/test/profiler_impl_test.cpp b/tooling/dynamic/test/profiler_impl_test.cpp similarity index 100% rename from tooling/test/profiler_impl_test.cpp rename to tooling/dynamic/test/profiler_impl_test.cpp diff --git a/tooling/test/protocol_handler_test.cpp b/tooling/dynamic/test/protocol_handler_test.cpp similarity index 100% rename from tooling/test/protocol_handler_test.cpp rename to tooling/dynamic/test/protocol_handler_test.cpp diff --git a/tooling/test/pt_base64_test.cpp b/tooling/dynamic/test/pt_base64_test.cpp similarity index 99% rename from tooling/test/pt_base64_test.cpp rename to tooling/dynamic/test/pt_base64_test.cpp index d18c2e6e..dad1bacc 100644 --- a/tooling/test/pt_base64_test.cpp +++ b/tooling/dynamic/test/pt_base64_test.cpp @@ -14,7 +14,7 @@ */ #include "ecmascript/tests/test_helper.h" -#include "tooling/base/pt_base64.h" +#include "tooling/dynamic/base/pt_base64.h" using namespace panda::ecmascript::tooling; diff --git a/tooling/test/pt_json_test.cpp b/tooling/dynamic/test/pt_json_test.cpp similarity index 99% rename from tooling/test/pt_json_test.cpp rename to tooling/dynamic/test/pt_json_test.cpp index c128aedb..ac9fda13 100644 --- a/tooling/test/pt_json_test.cpp +++ b/tooling/dynamic/test/pt_json_test.cpp @@ -14,7 +14,7 @@ */ #include "ecmascript/tests/test_helper.h" -#include "tooling/base/pt_json.h" +#include "tooling/dynamic/base/pt_json.h" using namespace panda::ecmascript::tooling; diff --git a/tooling/test/pt_params_test.cpp b/tooling/dynamic/test/pt_params_test.cpp similarity index 99% rename from tooling/test/pt_params_test.cpp rename to tooling/dynamic/test/pt_params_test.cpp index 414158da..6b991262 100644 --- a/tooling/test/pt_params_test.cpp +++ b/tooling/dynamic/test/pt_params_test.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "tooling/base/pt_params.h" +#include "tooling/dynamic/base/pt_params.h" #include "ecmascript/tests/test_helper.h" #include "protocol_handler.h" diff --git a/tooling/test/pt_returns_test.cpp b/tooling/dynamic/test/pt_returns_test.cpp similarity index 99% rename from tooling/test/pt_returns_test.cpp rename to tooling/dynamic/test/pt_returns_test.cpp index 017ef1e6..4d26ac0e 100644 --- a/tooling/test/pt_returns_test.cpp +++ b/tooling/dynamic/test/pt_returns_test.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ -#include "tooling/base/pt_returns.h" +#include "tooling/dynamic/base/pt_returns.h" #include "ecmascript/tests/test_helper.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda::ecmascript; using namespace panda::ecmascript::tooling; diff --git a/tooling/test/pt_types_test.cpp b/tooling/dynamic/test/pt_types_test.cpp similarity index 99% rename from tooling/test/pt_types_test.cpp rename to tooling/dynamic/test/pt_types_test.cpp index 6f845595..10fd698a 100644 --- a/tooling/test/pt_types_test.cpp +++ b/tooling/dynamic/test/pt_types_test.cpp @@ -13,10 +13,11 @@ * limitations under the License. */ -#include "tooling/base/pt_types.h" +#include "tooling/dynamic/base/pt_types.h" #include "common_components/base/utf_helper.h" #include "ecmascript/js_regexp.h" #include "ecmascript/object_factory.h" + #include "ecmascript/tests/test_helper.h" #include "protocol_handler.h" diff --git a/tooling/test/runtime_impl_test.cpp b/tooling/dynamic/test/runtime_impl_test.cpp similarity index 97% rename from tooling/test/runtime_impl_test.cpp rename to tooling/dynamic/test/runtime_impl_test.cpp index 4fffbaad..f7d9d908 100644 --- a/tooling/test/runtime_impl_test.cpp +++ b/tooling/dynamic/test/runtime_impl_test.cpp @@ -15,7 +15,7 @@ #include "agent/runtime_impl.h" #include "ecmascript/tests/test_helper.h" -#include "tooling/protocol_handler.h" +#include "tooling/dynamic/protocol_handler.h" using namespace panda::ecmascript; using namespace panda::ecmascript::tooling; diff --git a/tooling/test/target_impl_test.cpp b/tooling/dynamic/test/target_impl_test.cpp similarity index 100% rename from tooling/test/target_impl_test.cpp rename to tooling/dynamic/test/target_impl_test.cpp diff --git a/tooling/test/testcases/js/arrow_func.js b/tooling/dynamic/test/testcases/js/arrow_func.js similarity index 100% rename from tooling/test/testcases/js/arrow_func.js rename to tooling/dynamic/test/testcases/js/arrow_func.js diff --git a/tooling/test/testcases/js/async_func.js b/tooling/dynamic/test/testcases/js/async_func.js similarity index 100% rename from tooling/test/testcases/js/async_func.js rename to tooling/dynamic/test/testcases/js/async_func.js diff --git a/tooling/test/testcases/js/branch.js b/tooling/dynamic/test/testcases/js/branch.js similarity index 100% rename from tooling/test/testcases/js/branch.js rename to tooling/dynamic/test/testcases/js/branch.js diff --git a/tooling/test/testcases/js/closure_scope.js b/tooling/dynamic/test/testcases/js/closure_scope.js similarity index 100% rename from tooling/test/testcases/js/closure_scope.js rename to tooling/dynamic/test/testcases/js/closure_scope.js diff --git a/tooling/test/testcases/js/closure_variable.js b/tooling/dynamic/test/testcases/js/closure_variable.js similarity index 100% rename from tooling/test/testcases/js/closure_variable.js rename to tooling/dynamic/test/testcases/js/closure_variable.js diff --git a/tooling/test/testcases/js/common_func.js b/tooling/dynamic/test/testcases/js/common_func.js similarity index 100% rename from tooling/test/testcases/js/common_func.js rename to tooling/dynamic/test/testcases/js/common_func.js diff --git a/tooling/test/testcases/js/container.js b/tooling/dynamic/test/testcases/js/container.js similarity index 100% rename from tooling/test/testcases/js/container.js rename to tooling/dynamic/test/testcases/js/container.js diff --git a/tooling/test/testcases/js/dropframe.js b/tooling/dynamic/test/testcases/js/dropframe.js similarity index 100% rename from tooling/test/testcases/js/dropframe.js rename to tooling/dynamic/test/testcases/js/dropframe.js diff --git a/tooling/test/testcases/js/exception.js b/tooling/dynamic/test/testcases/js/exception.js similarity index 100% rename from tooling/test/testcases/js/exception.js rename to tooling/dynamic/test/testcases/js/exception.js diff --git a/tooling/test/testcases/js/export_variable_first.js b/tooling/dynamic/test/testcases/js/export_variable_first.js similarity index 100% rename from tooling/test/testcases/js/export_variable_first.js rename to tooling/dynamic/test/testcases/js/export_variable_first.js diff --git a/tooling/test/testcases/js/export_variable_second.js b/tooling/dynamic/test/testcases/js/export_variable_second.js similarity index 100% rename from tooling/test/testcases/js/export_variable_second.js rename to tooling/dynamic/test/testcases/js/export_variable_second.js diff --git a/tooling/test/testcases/js/local_export.js b/tooling/dynamic/test/testcases/js/local_export.js similarity index 100% rename from tooling/test/testcases/js/local_export.js rename to tooling/dynamic/test/testcases/js/local_export.js diff --git a/tooling/test/testcases/js/local_variable_scope.js b/tooling/dynamic/test/testcases/js/local_variable_scope.js similarity index 100% rename from tooling/test/testcases/js/local_variable_scope.js rename to tooling/dynamic/test/testcases/js/local_variable_scope.js diff --git a/tooling/test/testcases/js/module_variable.js b/tooling/dynamic/test/testcases/js/module_variable.js similarity index 100% rename from tooling/test/testcases/js/module_variable.js rename to tooling/dynamic/test/testcases/js/module_variable.js diff --git a/tooling/test/testcases/js/module_watch.js b/tooling/dynamic/test/testcases/js/module_watch.js similarity index 100% rename from tooling/test/testcases/js/module_watch.js rename to tooling/dynamic/test/testcases/js/module_watch.js diff --git a/tooling/test/testcases/js/promise.js b/tooling/dynamic/test/testcases/js/promise.js similarity index 100% rename from tooling/test/testcases/js/promise.js rename to tooling/dynamic/test/testcases/js/promise.js diff --git a/tooling/test/testcases/js/range_error.js b/tooling/dynamic/test/testcases/js/range_error.js similarity index 100% rename from tooling/test/testcases/js/range_error.js rename to tooling/dynamic/test/testcases/js/range_error.js diff --git a/tooling/test/testcases/js/sample.js b/tooling/dynamic/test/testcases/js/sample.js similarity index 100% rename from tooling/test/testcases/js/sample.js rename to tooling/dynamic/test/testcases/js/sample.js diff --git a/tooling/test/testcases/js/smart_stepInto.js b/tooling/dynamic/test/testcases/js/smart_stepInto.js similarity index 100% rename from tooling/test/testcases/js/smart_stepInto.js rename to tooling/dynamic/test/testcases/js/smart_stepInto.js diff --git a/tooling/test/testcases/js/step.js b/tooling/dynamic/test/testcases/js/step.js similarity index 100% rename from tooling/test/testcases/js/step.js rename to tooling/dynamic/test/testcases/js/step.js diff --git a/tooling/test/testcases/js/syntax_exception.js b/tooling/dynamic/test/testcases/js/syntax_exception.js similarity index 100% rename from tooling/test/testcases/js/syntax_exception.js rename to tooling/dynamic/test/testcases/js/syntax_exception.js diff --git a/tooling/test/testcases/js/throw_exception.js b/tooling/dynamic/test/testcases/js/throw_exception.js similarity index 100% rename from tooling/test/testcases/js/throw_exception.js rename to tooling/dynamic/test/testcases/js/throw_exception.js diff --git a/tooling/test/testcases/js/variable_first.js b/tooling/dynamic/test/testcases/js/variable_first.js similarity index 100% rename from tooling/test/testcases/js/variable_first.js rename to tooling/dynamic/test/testcases/js/variable_first.js diff --git a/tooling/test/testcases/js/variable_second.js b/tooling/dynamic/test/testcases/js/variable_second.js similarity index 100% rename from tooling/test/testcases/js/variable_second.js rename to tooling/dynamic/test/testcases/js/variable_second.js diff --git a/tooling/test/testcases/js/watch_variable.js b/tooling/dynamic/test/testcases/js/watch_variable.js similarity index 100% rename from tooling/test/testcases/js/watch_variable.js rename to tooling/dynamic/test/testcases/js/watch_variable.js diff --git a/tooling/test/testcases/js_accelerate_launch_test.h b/tooling/dynamic/test/testcases/js_accelerate_launch_test.h similarity index 99% rename from tooling/test/testcases/js_accelerate_launch_test.h rename to tooling/dynamic/test/testcases/js_accelerate_launch_test.h index f73f632d..2bb890c7 100644 --- a/tooling/test/testcases/js_accelerate_launch_test.h +++ b/tooling/dynamic/test/testcases/js_accelerate_launch_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_ACCELERATE_LAUNCH_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_ACCELERATE_LAUNCH_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsAccelerateLaunchTest : public TestActions { diff --git a/tooling/test/testcases/js_allocationtrack_loop_test.h b/tooling/dynamic/test/testcases/js_allocationtrack_loop_test.h similarity index 99% rename from tooling/test/testcases/js_allocationtrack_loop_test.h rename to tooling/dynamic/test/testcases/js_allocationtrack_loop_test.h index d03802ec..7b576ce4 100644 --- a/tooling/test/testcases/js_allocationtrack_loop_test.h +++ b/tooling/dynamic/test/testcases/js_allocationtrack_loop_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_ALLOCATIONTRACK_LOOP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_ALLOCATIONTRACK_LOOP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsAllocationTrackLoopTest : public TestActions { diff --git a/tooling/test/testcases/js_allocationtrack_recursion_test.h b/tooling/dynamic/test/testcases/js_allocationtrack_recursion_test.h similarity index 99% rename from tooling/test/testcases/js_allocationtrack_recursion_test.h rename to tooling/dynamic/test/testcases/js_allocationtrack_recursion_test.h index 7b6c3d8b..3a123409 100644 --- a/tooling/test/testcases/js_allocationtrack_recursion_test.h +++ b/tooling/dynamic/test/testcases/js_allocationtrack_recursion_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_ALLOCATIONTRACK_RECURSION_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_ALLOCATIONTRACK_RECURSION_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsAllocationTrackRecursionTest : public TestActions { diff --git a/tooling/test/testcases/js_allocationtrack_test.h b/tooling/dynamic/test/testcases/js_allocationtrack_test.h similarity index 96% rename from tooling/test/testcases/js_allocationtrack_test.h rename to tooling/dynamic/test/testcases/js_allocationtrack_test.h index 4006309a..0876ce61 100755 --- a/tooling/test/testcases/js_allocationtrack_test.h +++ b/tooling/dynamic/test/testcases/js_allocationtrack_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_ALLOCATIONTRACK_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_ALLOCATIONTRACK_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsAllocationtrackTest : public TestActions { diff --git a/tooling/test/testcases/js_asyn_stack_test.h b/tooling/dynamic/test/testcases/js_asyn_stack_test.h similarity index 100% rename from tooling/test/testcases/js_asyn_stack_test.h rename to tooling/dynamic/test/testcases/js_asyn_stack_test.h diff --git a/tooling/test/testcases/js_breakpoint_arrow_test.h b/tooling/dynamic/test/testcases/js_breakpoint_arrow_test.h similarity index 98% rename from tooling/test/testcases/js_breakpoint_arrow_test.h rename to tooling/dynamic/test/testcases/js_breakpoint_arrow_test.h index 757ec0be..6d278002 100644 --- a/tooling/test/testcases/js_breakpoint_arrow_test.h +++ b/tooling/dynamic/test/testcases/js_breakpoint_arrow_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_ARROW_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_ARROW_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsBreakpointArrowTest : public TestActions { diff --git a/tooling/test/testcases/js_breakpoint_async_test.h b/tooling/dynamic/test/testcases/js_breakpoint_async_test.h similarity index 98% rename from tooling/test/testcases/js_breakpoint_async_test.h rename to tooling/dynamic/test/testcases/js_breakpoint_async_test.h index 1b033ec1..e6b2989f 100644 --- a/tooling/test/testcases/js_breakpoint_async_test.h +++ b/tooling/dynamic/test/testcases/js_breakpoint_async_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_ASYNC_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_ASYNC_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsBreakpointAsyncTest : public TestActions { diff --git a/tooling/test/testcases/js_breakpoint_cannot_hit_test.h b/tooling/dynamic/test/testcases/js_breakpoint_cannot_hit_test.h similarity index 98% rename from tooling/test/testcases/js_breakpoint_cannot_hit_test.h rename to tooling/dynamic/test/testcases/js_breakpoint_cannot_hit_test.h index 6a384b79..54363bf5 100755 --- a/tooling/test/testcases/js_breakpoint_cannot_hit_test.h +++ b/tooling/dynamic/test/testcases/js_breakpoint_cannot_hit_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_CANNOT_HIT_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_CANNOT_HIT_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsBreakpointCannotHitTest : public TestActions { diff --git a/tooling/test/testcases/js_breakpoint_in_different_branch.h b/tooling/dynamic/test/testcases/js_breakpoint_in_different_branch.h similarity index 98% rename from tooling/test/testcases/js_breakpoint_in_different_branch.h rename to tooling/dynamic/test/testcases/js_breakpoint_in_different_branch.h index bb3f4c0e..f632af66 100755 --- a/tooling/test/testcases/js_breakpoint_in_different_branch.h +++ b/tooling/dynamic/test/testcases/js_breakpoint_in_different_branch.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_IN_DIFFERENT_BRANCH_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_IN_DIFFERENT_BRANCH_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsBreakpointInDifferentBranchTest : public TestActions { diff --git a/tooling/test/testcases/js_breakpoint_loop_test.h b/tooling/dynamic/test/testcases/js_breakpoint_loop_test.h similarity index 99% rename from tooling/test/testcases/js_breakpoint_loop_test.h rename to tooling/dynamic/test/testcases/js_breakpoint_loop_test.h index 03f87e8d..bc5b4f2c 100644 --- a/tooling/test/testcases/js_breakpoint_loop_test.h +++ b/tooling/dynamic/test/testcases/js_breakpoint_loop_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_LOOP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_LOOP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsBreakpointLoopTest : public TestActions { diff --git a/tooling/test/testcases/js_breakpoint_recursion_test.h b/tooling/dynamic/test/testcases/js_breakpoint_recursion_test.h similarity index 99% rename from tooling/test/testcases/js_breakpoint_recursion_test.h rename to tooling/dynamic/test/testcases/js_breakpoint_recursion_test.h index 45c269e5..d89b2bea 100644 --- a/tooling/test/testcases/js_breakpoint_recursion_test.h +++ b/tooling/dynamic/test/testcases/js_breakpoint_recursion_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_RECURSION_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_RECURSION_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsBreakpointRecursionTest : public TestActions { diff --git a/tooling/test/testcases/js_breakpoint_switch_test.h b/tooling/dynamic/test/testcases/js_breakpoint_switch_test.h similarity index 99% rename from tooling/test/testcases/js_breakpoint_switch_test.h rename to tooling/dynamic/test/testcases/js_breakpoint_switch_test.h index 2fbcfa88..524ab31d 100644 --- a/tooling/test/testcases/js_breakpoint_switch_test.h +++ b/tooling/dynamic/test/testcases/js_breakpoint_switch_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_SWITCH_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_SWITCH_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsBreakpointSwitchTest : public TestActions { diff --git a/tooling/test/testcases/js_breakpoint_test.h b/tooling/dynamic/test/testcases/js_breakpoint_test.h similarity index 98% rename from tooling/test/testcases/js_breakpoint_test.h rename to tooling/dynamic/test/testcases/js_breakpoint_test.h index 219a6705..fbf66dcc 100644 --- a/tooling/test/testcases/js_breakpoint_test.h +++ b/tooling/dynamic/test/testcases/js_breakpoint_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_BREAKPOINT_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsBreakpointTest : public TestActions { diff --git a/tooling/test/testcases/js_closure_scope_test.h b/tooling/dynamic/test/testcases/js_closure_scope_test.h similarity index 99% rename from tooling/test/testcases/js_closure_scope_test.h rename to tooling/dynamic/test/testcases/js_closure_scope_test.h index 7ba2706b..fc167040 100644 --- a/tooling/test/testcases/js_closure_scope_test.h +++ b/tooling/dynamic/test/testcases/js_closure_scope_test.h @@ -17,7 +17,7 @@ #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CLOSURE_SCOPE_TEST_H #include -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsClosureScopeTest : public TestActions { diff --git a/tooling/test/testcases/js_container_test.h b/tooling/dynamic/test/testcases/js_container_test.h similarity index 99% rename from tooling/test/testcases/js_container_test.h rename to tooling/dynamic/test/testcases/js_container_test.h index 4d71bb84..ec1c971c 100644 --- a/tooling/test/testcases/js_container_test.h +++ b/tooling/dynamic/test/testcases/js_container_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CONTAINER_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CONTAINER_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsContainerTest : public TestActions { diff --git a/tooling/test/testcases/js_cpuprofile_async_test.h b/tooling/dynamic/test/testcases/js_cpuprofile_async_test.h similarity index 98% rename from tooling/test/testcases/js_cpuprofile_async_test.h rename to tooling/dynamic/test/testcases/js_cpuprofile_async_test.h index ab05794c..44182c1d 100755 --- a/tooling/test/testcases/js_cpuprofile_async_test.h +++ b/tooling/dynamic/test/testcases/js_cpuprofile_async_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CPUPROFILE_ASYNC_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CPUPROFILE_ASYNC_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsCpuprofileAsyncTest : public TestActions { diff --git a/tooling/test/testcases/js_cpuprofile_loop_test.h b/tooling/dynamic/test/testcases/js_cpuprofile_loop_test.h similarity index 98% rename from tooling/test/testcases/js_cpuprofile_loop_test.h rename to tooling/dynamic/test/testcases/js_cpuprofile_loop_test.h index 2cddcdbb..7daace2f 100644 --- a/tooling/test/testcases/js_cpuprofile_loop_test.h +++ b/tooling/dynamic/test/testcases/js_cpuprofile_loop_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CPUPROFILE_LOOP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CPUPROFILE_LOOP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsCpuprofileLoopTest : public TestActions { diff --git a/tooling/test/testcases/js_cpuprofile_recursion_test.h b/tooling/dynamic/test/testcases/js_cpuprofile_recursion_test.h similarity index 98% rename from tooling/test/testcases/js_cpuprofile_recursion_test.h rename to tooling/dynamic/test/testcases/js_cpuprofile_recursion_test.h index d2cfd3c1..3f5c7341 100644 --- a/tooling/test/testcases/js_cpuprofile_recursion_test.h +++ b/tooling/dynamic/test/testcases/js_cpuprofile_recursion_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CPUPROFILE_RECURSION_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CPUPROFILE_RECURSION_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsCpuprofileRecursionTest : public TestActions { diff --git a/tooling/test/testcases/js_cpuprofile_step_test.h b/tooling/dynamic/test/testcases/js_cpuprofile_step_test.h similarity index 99% rename from tooling/test/testcases/js_cpuprofile_step_test.h rename to tooling/dynamic/test/testcases/js_cpuprofile_step_test.h index 126ddf82..9eaaa7d1 100755 --- a/tooling/test/testcases/js_cpuprofile_step_test.h +++ b/tooling/dynamic/test/testcases/js_cpuprofile_step_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CPUPROFILE_STEP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CPUPROFILE_STEP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsCpuprofileStepTest : public TestActions { diff --git a/tooling/test/testcases/js_cpuprofile_test.h b/tooling/dynamic/test/testcases/js_cpuprofile_test.h similarity index 98% rename from tooling/test/testcases/js_cpuprofile_test.h rename to tooling/dynamic/test/testcases/js_cpuprofile_test.h index cf492e1d..3cb44a17 100755 --- a/tooling/test/testcases/js_cpuprofile_test.h +++ b/tooling/dynamic/test/testcases/js_cpuprofile_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CPUPROFILE_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_CPUPROFILE_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsCpuprofileTest : public TestActions { diff --git a/tooling/test/testcases/js_dropframe_test.h b/tooling/dynamic/test/testcases/js_dropframe_test.h similarity index 100% rename from tooling/test/testcases/js_dropframe_test.h rename to tooling/dynamic/test/testcases/js_dropframe_test.h diff --git a/tooling/test/testcases/js_exception_test.h b/tooling/dynamic/test/testcases/js_exception_test.h similarity index 99% rename from tooling/test/testcases/js_exception_test.h rename to tooling/dynamic/test/testcases/js_exception_test.h index ac64be7e..e314f2ec 100644 --- a/tooling/test/testcases/js_exception_test.h +++ b/tooling/dynamic/test/testcases/js_exception_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_EXCEPTION_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_EXCEPTION_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsExceptionTest : public TestActions { diff --git a/tooling/test/testcases/js_heapdump_loop_test.h b/tooling/dynamic/test/testcases/js_heapdump_loop_test.h similarity index 99% rename from tooling/test/testcases/js_heapdump_loop_test.h rename to tooling/dynamic/test/testcases/js_heapdump_loop_test.h index 6dc4e2a6..9bfd1adb 100644 --- a/tooling/test/testcases/js_heapdump_loop_test.h +++ b/tooling/dynamic/test/testcases/js_heapdump_loop_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPDUMP_LOOP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPDUMP_LOOP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsHeapdumpLoopTest : public TestActions { diff --git a/tooling/test/testcases/js_heapdump_test.h b/tooling/dynamic/test/testcases/js_heapdump_test.h similarity index 96% rename from tooling/test/testcases/js_heapdump_test.h rename to tooling/dynamic/test/testcases/js_heapdump_test.h index abfbc0a2..f9adf936 100755 --- a/tooling/test/testcases/js_heapdump_test.h +++ b/tooling/dynamic/test/testcases/js_heapdump_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPDUMP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPDUMP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsHeapdumpTest : public TestActions { diff --git a/tooling/test/testcases/js_heapprofiler_dump_test.h b/tooling/dynamic/test/testcases/js_heapprofiler_dump_test.h similarity index 98% rename from tooling/test/testcases/js_heapprofiler_dump_test.h rename to tooling/dynamic/test/testcases/js_heapprofiler_dump_test.h index 09331699..a9c3d2fb 100644 --- a/tooling/test/testcases/js_heapprofiler_dump_test.h +++ b/tooling/dynamic/test/testcases/js_heapprofiler_dump_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPPROFILER_DUMP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPPROFILER_DUMP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsHeapProfilerDumpTest : public TestActions { diff --git a/tooling/test/testcases/js_heapsampling_loop_test.h b/tooling/dynamic/test/testcases/js_heapsampling_loop_test.h similarity index 98% rename from tooling/test/testcases/js_heapsampling_loop_test.h rename to tooling/dynamic/test/testcases/js_heapsampling_loop_test.h index 3d37e3eb..a37f6c54 100644 --- a/tooling/test/testcases/js_heapsampling_loop_test.h +++ b/tooling/dynamic/test/testcases/js_heapsampling_loop_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPSAMPLING_LOOP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPSAMPLING_LOOP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsHeapSamplingLoopTest : public TestActions { diff --git a/tooling/test/testcases/js_heapsampling_test.h b/tooling/dynamic/test/testcases/js_heapsampling_test.h similarity index 98% rename from tooling/test/testcases/js_heapsampling_test.h rename to tooling/dynamic/test/testcases/js_heapsampling_test.h index 0ef339af..054e041b 100644 --- a/tooling/test/testcases/js_heapsampling_test.h +++ b/tooling/dynamic/test/testcases/js_heapsampling_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPSAMPLING_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPSAMPLING_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsHeapsamplingTest : public TestActions { diff --git a/tooling/test/testcases/js_heapusage_async_test.h b/tooling/dynamic/test/testcases/js_heapusage_async_test.h similarity index 98% rename from tooling/test/testcases/js_heapusage_async_test.h rename to tooling/dynamic/test/testcases/js_heapusage_async_test.h index 208a6688..79ddb988 100755 --- a/tooling/test/testcases/js_heapusage_async_test.h +++ b/tooling/dynamic/test/testcases/js_heapusage_async_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPUSAGE_ASYNC_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPUSAGE_ASYNC_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsHeapusageAsyncTest : public TestActions { diff --git a/tooling/test/testcases/js_heapusage_loop_test.h b/tooling/dynamic/test/testcases/js_heapusage_loop_test.h similarity index 98% rename from tooling/test/testcases/js_heapusage_loop_test.h rename to tooling/dynamic/test/testcases/js_heapusage_loop_test.h index 221df178..85ac9415 100644 --- a/tooling/test/testcases/js_heapusage_loop_test.h +++ b/tooling/dynamic/test/testcases/js_heapusage_loop_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPUSAGE_LOOP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPUSAGE_LOOP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsHeapusageLoopTest : public TestActions { diff --git a/tooling/test/testcases/js_heapusage_recursion_test.h b/tooling/dynamic/test/testcases/js_heapusage_recursion_test.h similarity index 98% rename from tooling/test/testcases/js_heapusage_recursion_test.h rename to tooling/dynamic/test/testcases/js_heapusage_recursion_test.h index 7930f49c..c5e13b9c 100644 --- a/tooling/test/testcases/js_heapusage_recursion_test.h +++ b/tooling/dynamic/test/testcases/js_heapusage_recursion_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPUSAGE_RECURSION_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPUSAGE_RECURSION_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsHeapusageRecursionTest : public TestActions { diff --git a/tooling/test/testcases/js_heapusage_step_test.h b/tooling/dynamic/test/testcases/js_heapusage_step_test.h similarity index 99% rename from tooling/test/testcases/js_heapusage_step_test.h rename to tooling/dynamic/test/testcases/js_heapusage_step_test.h index 698d3e5a..e0748d40 100755 --- a/tooling/test/testcases/js_heapusage_step_test.h +++ b/tooling/dynamic/test/testcases/js_heapusage_step_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPUSAGE_STEP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPUSAGE_STEP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsHeapusageStepTest : public TestActions { diff --git a/tooling/test/testcases/js_heapusage_test.h b/tooling/dynamic/test/testcases/js_heapusage_test.h similarity index 99% rename from tooling/test/testcases/js_heapusage_test.h rename to tooling/dynamic/test/testcases/js_heapusage_test.h index 542c9c58..4a3baa2f 100755 --- a/tooling/test/testcases/js_heapusage_test.h +++ b/tooling/dynamic/test/testcases/js_heapusage_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPUSAGE_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_HEAPUSAGE_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsHeapusageTest : public TestActions { diff --git a/tooling/test/testcases/js_local_variable_scope_test.h b/tooling/dynamic/test/testcases/js_local_variable_scope_test.h similarity index 99% rename from tooling/test/testcases/js_local_variable_scope_test.h rename to tooling/dynamic/test/testcases/js_local_variable_scope_test.h index 4f7187be..943850f0 100644 --- a/tooling/test/testcases/js_local_variable_scope_test.h +++ b/tooling/dynamic/test/testcases/js_local_variable_scope_test.h @@ -17,7 +17,7 @@ #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_LOCAL_VARIABLE_SCOPE_TEST_H #include -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsLocalVariableScopeTest : public TestActions { diff --git a/tooling/test/testcases/js_module_variable_test.h b/tooling/dynamic/test/testcases/js_module_variable_test.h similarity index 99% rename from tooling/test/testcases/js_module_variable_test.h rename to tooling/dynamic/test/testcases/js_module_variable_test.h index 52424f86..5fe34472 100644 --- a/tooling/test/testcases/js_module_variable_test.h +++ b/tooling/dynamic/test/testcases/js_module_variable_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_MODULE_VARIABLE_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_MODULE_VARIABLE_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsModuleVariableTest : public TestActions { diff --git a/tooling/test/testcases/js_multiple_breakpoint_in_function_test.h b/tooling/dynamic/test/testcases/js_multiple_breakpoint_in_function_test.h similarity index 99% rename from tooling/test/testcases/js_multiple_breakpoint_in_function_test.h rename to tooling/dynamic/test/testcases/js_multiple_breakpoint_in_function_test.h index eca5003e..12546ee6 100755 --- a/tooling/test/testcases/js_multiple_breakpoint_in_function_test.h +++ b/tooling/dynamic/test/testcases/js_multiple_breakpoint_in_function_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_MULTIPLE_BREAKPOINT_IN_FUNCTION_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_MULTIPLE_BREAKPOINT_IN_FUNCTION_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsMultipleBreakpointInFunctionTest : public TestActions { diff --git a/tooling/test/testcases/js_multiple_common_breakpoint_test.h b/tooling/dynamic/test/testcases/js_multiple_common_breakpoint_test.h similarity index 99% rename from tooling/test/testcases/js_multiple_common_breakpoint_test.h rename to tooling/dynamic/test/testcases/js_multiple_common_breakpoint_test.h index 0b8e8fba..285093c3 100755 --- a/tooling/test/testcases/js_multiple_common_breakpoint_test.h +++ b/tooling/dynamic/test/testcases/js_multiple_common_breakpoint_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_MULTIPLE_COMMON_BREAKPOINT_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_MULTIPLE_COMMON_BREAKPOINT_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsMultipleCommonBreakpointTest : public TestActions { diff --git a/tooling/test/testcases/js_range_error_test.h b/tooling/dynamic/test/testcases/js_range_error_test.h similarity index 100% rename from tooling/test/testcases/js_range_error_test.h rename to tooling/dynamic/test/testcases/js_range_error_test.h diff --git a/tooling/test/testcases/js_single_step_test.h b/tooling/dynamic/test/testcases/js_single_step_test.h similarity index 100% rename from tooling/test/testcases/js_single_step_test.h rename to tooling/dynamic/test/testcases/js_single_step_test.h diff --git a/tooling/test/testcases/js_smart_stepInto_test.h b/tooling/dynamic/test/testcases/js_smart_stepInto_test.h similarity index 99% rename from tooling/test/testcases/js_smart_stepInto_test.h rename to tooling/dynamic/test/testcases/js_smart_stepInto_test.h index 5616afe9..5b9d515d 100644 --- a/tooling/test/testcases/js_smart_stepInto_test.h +++ b/tooling/dynamic/test/testcases/js_smart_stepInto_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_SMART_STEPINTO_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_SMART_STEPINTO_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsSmartStepoutTest : public TestActions { diff --git a/tooling/test/testcases/js_source_test.h b/tooling/dynamic/test/testcases/js_source_test.h similarity index 98% rename from tooling/test/testcases/js_source_test.h rename to tooling/dynamic/test/testcases/js_source_test.h index e02cf9bc..1cc7117d 100644 --- a/tooling/test/testcases/js_source_test.h +++ b/tooling/dynamic/test/testcases/js_source_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_SOURCE_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_SOURCE_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsSourceTest : public TestActions { diff --git a/tooling/test/testcases/js_special_location_breakpoint_test.h b/tooling/dynamic/test/testcases/js_special_location_breakpoint_test.h similarity index 99% rename from tooling/test/testcases/js_special_location_breakpoint_test.h rename to tooling/dynamic/test/testcases/js_special_location_breakpoint_test.h index 373ba198..6141800c 100755 --- a/tooling/test/testcases/js_special_location_breakpoint_test.h +++ b/tooling/dynamic/test/testcases/js_special_location_breakpoint_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_SPECIAL_LOCATION_BREAKPOINT_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_SPECIAL_LOCATION_BREAKPOINT_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsSpecialLocationBreakpointTest : public TestActions { diff --git a/tooling/test/testcases/js_step_into_test.h b/tooling/dynamic/test/testcases/js_step_into_test.h similarity index 100% rename from tooling/test/testcases/js_step_into_test.h rename to tooling/dynamic/test/testcases/js_step_into_test.h diff --git a/tooling/test/testcases/js_step_out_test.h b/tooling/dynamic/test/testcases/js_step_out_test.h similarity index 100% rename from tooling/test/testcases/js_step_out_test.h rename to tooling/dynamic/test/testcases/js_step_out_test.h diff --git a/tooling/test/testcases/js_step_over_test.h b/tooling/dynamic/test/testcases/js_step_over_test.h similarity index 100% rename from tooling/test/testcases/js_step_over_test.h rename to tooling/dynamic/test/testcases/js_step_over_test.h diff --git a/tooling/test/testcases/js_stepinto_and_stepout_test.h b/tooling/dynamic/test/testcases/js_stepinto_and_stepout_test.h similarity index 99% rename from tooling/test/testcases/js_stepinto_and_stepout_test.h rename to tooling/dynamic/test/testcases/js_stepinto_and_stepout_test.h index ca3eaf1d..ab8dbbf1 100755 --- a/tooling/test/testcases/js_stepinto_and_stepout_test.h +++ b/tooling/dynamic/test/testcases/js_stepinto_and_stepout_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_AND_STEPOUT_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_AND_STEPOUT_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepintoAndStepoutTest : public TestActions { diff --git a/tooling/test/testcases/js_stepinto_arrow_test.h b/tooling/dynamic/test/testcases/js_stepinto_arrow_test.h similarity index 99% rename from tooling/test/testcases/js_stepinto_arrow_test.h rename to tooling/dynamic/test/testcases/js_stepinto_arrow_test.h index cc813a51..f8b5dea7 100755 --- a/tooling/test/testcases/js_stepinto_arrow_test.h +++ b/tooling/dynamic/test/testcases/js_stepinto_arrow_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_ARROW_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_ARROW_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepintoArrowTest : public TestActions { diff --git a/tooling/test/testcases/js_stepinto_async_test.h b/tooling/dynamic/test/testcases/js_stepinto_async_test.h similarity index 99% rename from tooling/test/testcases/js_stepinto_async_test.h rename to tooling/dynamic/test/testcases/js_stepinto_async_test.h index a0a68792..3faccecc 100755 --- a/tooling/test/testcases/js_stepinto_async_test.h +++ b/tooling/dynamic/test/testcases/js_stepinto_async_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_ASYNC_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_ASYNC_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepintoAsyncTest : public TestActions { diff --git a/tooling/test/testcases/js_stepinto_loop_test.h b/tooling/dynamic/test/testcases/js_stepinto_loop_test.h similarity index 99% rename from tooling/test/testcases/js_stepinto_loop_test.h rename to tooling/dynamic/test/testcases/js_stepinto_loop_test.h index 0aff1fb2..690b8d57 100644 --- a/tooling/test/testcases/js_stepinto_loop_test.h +++ b/tooling/dynamic/test/testcases/js_stepinto_loop_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_LOOP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_LOOP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepintoLoopTest : public TestActions { diff --git a/tooling/test/testcases/js_stepinto_recursion_test.h b/tooling/dynamic/test/testcases/js_stepinto_recursion_test.h similarity index 99% rename from tooling/test/testcases/js_stepinto_recursion_test.h rename to tooling/dynamic/test/testcases/js_stepinto_recursion_test.h index d3cebe6a..c040f792 100644 --- a/tooling/test/testcases/js_stepinto_recursion_test.h +++ b/tooling/dynamic/test/testcases/js_stepinto_recursion_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_RECURSION_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_RECURSION_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepintoRecursionTest : public TestActions { diff --git a/tooling/test/testcases/js_stepinto_switch_test.h b/tooling/dynamic/test/testcases/js_stepinto_switch_test.h similarity index 99% rename from tooling/test/testcases/js_stepinto_switch_test.h rename to tooling/dynamic/test/testcases/js_stepinto_switch_test.h index be4f1cf6..9d78242e 100644 --- a/tooling/test/testcases/js_stepinto_switch_test.h +++ b/tooling/dynamic/test/testcases/js_stepinto_switch_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_SWITCH_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_SWITCH_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepintoSwitchTest : public TestActions { diff --git a/tooling/test/testcases/js_stepinto_test.h b/tooling/dynamic/test/testcases/js_stepinto_test.h similarity index 99% rename from tooling/test/testcases/js_stepinto_test.h rename to tooling/dynamic/test/testcases/js_stepinto_test.h index a0f1caf4..a7955562 100755 --- a/tooling/test/testcases/js_stepinto_test.h +++ b/tooling/dynamic/test/testcases/js_stepinto_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPINTO_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepintoTest : public TestActions { diff --git a/tooling/test/testcases/js_stepout_arrow_test.h b/tooling/dynamic/test/testcases/js_stepout_arrow_test.h similarity index 99% rename from tooling/test/testcases/js_stepout_arrow_test.h rename to tooling/dynamic/test/testcases/js_stepout_arrow_test.h index f487f896..db36cdeb 100755 --- a/tooling/test/testcases/js_stepout_arrow_test.h +++ b/tooling/dynamic/test/testcases/js_stepout_arrow_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_ARROW_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_ARROW_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoutArrowTest : public TestActions { diff --git a/tooling/test/testcases/js_stepout_async_test.h b/tooling/dynamic/test/testcases/js_stepout_async_test.h similarity index 99% rename from tooling/test/testcases/js_stepout_async_test.h rename to tooling/dynamic/test/testcases/js_stepout_async_test.h index 665435cb..0a8d0787 100755 --- a/tooling/test/testcases/js_stepout_async_test.h +++ b/tooling/dynamic/test/testcases/js_stepout_async_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_ASYNC_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_ASYNC_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoutAsyncTest : public TestActions { diff --git a/tooling/test/testcases/js_stepout_before_function_test.h b/tooling/dynamic/test/testcases/js_stepout_before_function_test.h similarity index 99% rename from tooling/test/testcases/js_stepout_before_function_test.h rename to tooling/dynamic/test/testcases/js_stepout_before_function_test.h index 6056cde3..c11f48f1 100755 --- a/tooling/test/testcases/js_stepout_before_function_test.h +++ b/tooling/dynamic/test/testcases/js_stepout_before_function_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_BEFORE_FUNCTION_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_BEFORE_FUNCTION_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoutBeforeFunctionTest : public TestActions { diff --git a/tooling/test/testcases/js_stepout_loop_test.h b/tooling/dynamic/test/testcases/js_stepout_loop_test.h similarity index 99% rename from tooling/test/testcases/js_stepout_loop_test.h rename to tooling/dynamic/test/testcases/js_stepout_loop_test.h index 9953a9cd..945ee5b6 100644 --- a/tooling/test/testcases/js_stepout_loop_test.h +++ b/tooling/dynamic/test/testcases/js_stepout_loop_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_LOOP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_LOOP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoutLoopTest : public TestActions { diff --git a/tooling/test/testcases/js_stepout_recursion_test.h b/tooling/dynamic/test/testcases/js_stepout_recursion_test.h similarity index 99% rename from tooling/test/testcases/js_stepout_recursion_test.h rename to tooling/dynamic/test/testcases/js_stepout_recursion_test.h index 49b77151..47401010 100644 --- a/tooling/test/testcases/js_stepout_recursion_test.h +++ b/tooling/dynamic/test/testcases/js_stepout_recursion_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_RECURSION_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_RECURSION_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoutRecursionTest : public TestActions { diff --git a/tooling/test/testcases/js_stepout_switch_test.h b/tooling/dynamic/test/testcases/js_stepout_switch_test.h similarity index 99% rename from tooling/test/testcases/js_stepout_switch_test.h rename to tooling/dynamic/test/testcases/js_stepout_switch_test.h index 98c73583..3f983d8b 100644 --- a/tooling/test/testcases/js_stepout_switch_test.h +++ b/tooling/dynamic/test/testcases/js_stepout_switch_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_SWITCH_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_SWITCH_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoutSwitchTest : public TestActions { diff --git a/tooling/test/testcases/js_stepout_test.h b/tooling/dynamic/test/testcases/js_stepout_test.h similarity index 99% rename from tooling/test/testcases/js_stepout_test.h rename to tooling/dynamic/test/testcases/js_stepout_test.h index c21d7e2f..f99cbf08 100755 --- a/tooling/test/testcases/js_stepout_test.h +++ b/tooling/dynamic/test/testcases/js_stepout_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOUT_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoutTest : public TestActions { diff --git a/tooling/test/testcases/js_stepover_loop_test.h b/tooling/dynamic/test/testcases/js_stepover_loop_test.h similarity index 99% rename from tooling/test/testcases/js_stepover_loop_test.h rename to tooling/dynamic/test/testcases/js_stepover_loop_test.h index f5bf6006..36cce6ae 100644 --- a/tooling/test/testcases/js_stepover_loop_test.h +++ b/tooling/dynamic/test/testcases/js_stepover_loop_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOVER_LOOP_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOVER_LOOP_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoverLoopTest : public TestActions { diff --git a/tooling/test/testcases/js_stepover_recursion_test.h b/tooling/dynamic/test/testcases/js_stepover_recursion_test.h similarity index 99% rename from tooling/test/testcases/js_stepover_recursion_test.h rename to tooling/dynamic/test/testcases/js_stepover_recursion_test.h index ace2cd33..dfb30211 100644 --- a/tooling/test/testcases/js_stepover_recursion_test.h +++ b/tooling/dynamic/test/testcases/js_stepover_recursion_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOVER_RECURSION_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOVER_RECURSION_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoverRecursionTest : public TestActions { diff --git a/tooling/test/testcases/js_stepover_switch_test.h b/tooling/dynamic/test/testcases/js_stepover_switch_test.h similarity index 99% rename from tooling/test/testcases/js_stepover_switch_test.h rename to tooling/dynamic/test/testcases/js_stepover_switch_test.h index 78731100..2b77b003 100644 --- a/tooling/test/testcases/js_stepover_switch_test.h +++ b/tooling/dynamic/test/testcases/js_stepover_switch_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOVER_SWITCH_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOVER_SWITCH_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoverSwitchTest : public TestActions { diff --git a/tooling/test/testcases/js_stepover_test.h b/tooling/dynamic/test/testcases/js_stepover_test.h similarity index 99% rename from tooling/test/testcases/js_stepover_test.h rename to tooling/dynamic/test/testcases/js_stepover_test.h index a5eaf15e..95f04b90 100755 --- a/tooling/test/testcases/js_stepover_test.h +++ b/tooling/dynamic/test/testcases/js_stepover_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOVER_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_STEPOVER_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsStepoverTest : public TestActions { diff --git a/tooling/test/testcases/js_symbolbreakpoint_test.h b/tooling/dynamic/test/testcases/js_symbolbreakpoint_test.h similarity index 100% rename from tooling/test/testcases/js_symbolbreakpoint_test.h rename to tooling/dynamic/test/testcases/js_symbolbreakpoint_test.h diff --git a/tooling/test/testcases/js_syntax_exception_test.h b/tooling/dynamic/test/testcases/js_syntax_exception_test.h similarity index 100% rename from tooling/test/testcases/js_syntax_exception_test.h rename to tooling/dynamic/test/testcases/js_syntax_exception_test.h diff --git a/tooling/test/testcases/js_throw_exception_test.h b/tooling/dynamic/test/testcases/js_throw_exception_test.h similarity index 100% rename from tooling/test/testcases/js_throw_exception_test.h rename to tooling/dynamic/test/testcases/js_throw_exception_test.h diff --git a/tooling/test/testcases/js_tracing_test.h b/tooling/dynamic/test/testcases/js_tracing_test.h similarity index 98% rename from tooling/test/testcases/js_tracing_test.h rename to tooling/dynamic/test/testcases/js_tracing_test.h index 2b21a273..c2a0ba77 100644 --- a/tooling/test/testcases/js_tracing_test.h +++ b/tooling/dynamic/test/testcases/js_tracing_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_TRACING_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_TRACING_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsTracingTest : public TestActions { diff --git a/tooling/test/testcases/js_variable_first_test.h b/tooling/dynamic/test/testcases/js_variable_first_test.h similarity index 100% rename from tooling/test/testcases/js_variable_first_test.h rename to tooling/dynamic/test/testcases/js_variable_first_test.h diff --git a/tooling/test/testcases/js_variable_second_test.h b/tooling/dynamic/test/testcases/js_variable_second_test.h similarity index 100% rename from tooling/test/testcases/js_variable_second_test.h rename to tooling/dynamic/test/testcases/js_variable_second_test.h diff --git a/tooling/test/testcases/js_watch_basic_type_test.h b/tooling/dynamic/test/testcases/js_watch_basic_type_test.h similarity index 99% rename from tooling/test/testcases/js_watch_basic_type_test.h rename to tooling/dynamic/test/testcases/js_watch_basic_type_test.h index ff453b6c..ea3a2919 100644 --- a/tooling/test/testcases/js_watch_basic_type_test.h +++ b/tooling/dynamic/test/testcases/js_watch_basic_type_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_BASIC_TYPE_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_BASIC_TYPE_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsWatchBasicTypeTest : public TestActions { diff --git a/tooling/test/testcases/js_watch_closure_variable_test.h b/tooling/dynamic/test/testcases/js_watch_closure_variable_test.h similarity index 99% rename from tooling/test/testcases/js_watch_closure_variable_test.h rename to tooling/dynamic/test/testcases/js_watch_closure_variable_test.h index 56d7e0dc..1d6b7716 100644 --- a/tooling/test/testcases/js_watch_closure_variable_test.h +++ b/tooling/dynamic/test/testcases/js_watch_closure_variable_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_CLOSURE_VARIABLE_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_CLOSURE_VARIABLE_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsWatchClosureVariableTest : public TestActions { diff --git a/tooling/test/testcases/js_watch_module_test.h b/tooling/dynamic/test/testcases/js_watch_module_test.h similarity index 100% rename from tooling/test/testcases/js_watch_module_test.h rename to tooling/dynamic/test/testcases/js_watch_module_test.h diff --git a/tooling/test/testcases/js_watch_other_type_test.h b/tooling/dynamic/test/testcases/js_watch_other_type_test.h similarity index 99% rename from tooling/test/testcases/js_watch_other_type_test.h rename to tooling/dynamic/test/testcases/js_watch_other_type_test.h index 0fd734e9..dce705c8 100644 --- a/tooling/test/testcases/js_watch_other_type_test.h +++ b/tooling/dynamic/test/testcases/js_watch_other_type_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_OTHER_TYPE_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_OTHER_TYPE_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsWatchOtherTypeTest : public TestActions { diff --git a/tooling/test/testcases/js_watch_set_type_test.h b/tooling/dynamic/test/testcases/js_watch_set_type_test.h similarity index 99% rename from tooling/test/testcases/js_watch_set_type_test.h rename to tooling/dynamic/test/testcases/js_watch_set_type_test.h index 0ca66a21..01548409 100644 --- a/tooling/test/testcases/js_watch_set_type_test.h +++ b/tooling/dynamic/test/testcases/js_watch_set_type_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_SET_TYPE_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_SET_TYPE_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsWatchSetTypeTest : public TestActions { diff --git a/tooling/test/testcases/js_watch_test.h b/tooling/dynamic/test/testcases/js_watch_test.h similarity index 99% rename from tooling/test/testcases/js_watch_test.h rename to tooling/dynamic/test/testcases/js_watch_test.h index a5fa7d15..d48da689 100644 --- a/tooling/test/testcases/js_watch_test.h +++ b/tooling/dynamic/test/testcases/js_watch_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsWatchTest : public TestActions { diff --git a/tooling/test/testcases/js_watch_variable_test.h b/tooling/dynamic/test/testcases/js_watch_variable_test.h similarity index 99% rename from tooling/test/testcases/js_watch_variable_test.h rename to tooling/dynamic/test/testcases/js_watch_variable_test.h index 61013e4c..c8a62bdf 100755 --- a/tooling/test/testcases/js_watch_variable_test.h +++ b/tooling/dynamic/test/testcases/js_watch_variable_test.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_VARIABLE_TEST_H #define ECMASCRIPT_TOOLING_TEST_TESTCASES_JS_WATCH_VARIABLE_TEST_H -#include "tooling/test/client_utils/test_util.h" +#include "tooling/dynamic/test/client_utils/test_util.h" namespace panda::ecmascript::tooling::test { class JsWatchVariableTest : public TestActions { diff --git a/tooling/test/tracing_impl_test.cpp b/tooling/dynamic/test/tracing_impl_test.cpp similarity index 100% rename from tooling/test/tracing_impl_test.cpp rename to tooling/dynamic/test/tracing_impl_test.cpp diff --git a/tooling/test/utils/test_channel.h b/tooling/dynamic/test/utils/test_channel.h similarity index 97% rename from tooling/test/utils/test_channel.h rename to tooling/dynamic/test/utils/test_channel.h index e92a1b95..655c4105 100644 --- a/tooling/test/utils/test_channel.h +++ b/tooling/dynamic/test/utils/test_channel.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_TOOLING_TEST_UTILS_TEST_CHANNEL_H #define ECMASCRIPT_TOOLING_TEST_UTILS_TEST_CHANNEL_H -#include "tooling/protocol_channel.h" +#include "tooling/dynamic/protocol_channel.h" namespace panda::ecmascript::tooling { class TestChannel : public ProtocolChannel { diff --git a/tooling/test/utils/test_entry.cpp b/tooling/dynamic/test/utils/test_entry.cpp similarity index 100% rename from tooling/test/utils/test_entry.cpp rename to tooling/dynamic/test/utils/test_entry.cpp diff --git a/tooling/test/utils/test_entry.h b/tooling/dynamic/test/utils/test_entry.h similarity index 100% rename from tooling/test/utils/test_entry.h rename to tooling/dynamic/test/utils/test_entry.h diff --git a/tooling/test/utils/test_events.h b/tooling/dynamic/test/utils/test_events.h similarity index 100% rename from tooling/test/utils/test_events.h rename to tooling/dynamic/test/utils/test_events.h diff --git a/tooling/test/utils/test_extractor.cpp b/tooling/dynamic/test/utils/test_extractor.cpp similarity index 100% rename from tooling/test/utils/test_extractor.cpp rename to tooling/dynamic/test/utils/test_extractor.cpp diff --git a/tooling/test/utils/test_extractor.h b/tooling/dynamic/test/utils/test_extractor.h similarity index 100% rename from tooling/test/utils/test_extractor.h rename to tooling/dynamic/test/utils/test_extractor.h diff --git a/tooling/test/utils/test_hooks.h b/tooling/dynamic/test/utils/test_hooks.h similarity index 100% rename from tooling/test/utils/test_hooks.h rename to tooling/dynamic/test/utils/test_hooks.h diff --git a/tooling/test/utils/test_list.cpp b/tooling/dynamic/test/utils/test_list.cpp similarity index 100% rename from tooling/test/utils/test_list.cpp rename to tooling/dynamic/test/utils/test_list.cpp diff --git a/tooling/test/utils/test_list.h b/tooling/dynamic/test/utils/test_list.h similarity index 100% rename from tooling/test/utils/test_list.h rename to tooling/dynamic/test/utils/test_list.h diff --git a/tooling/test/utils/test_util.cpp b/tooling/dynamic/test/utils/test_util.cpp similarity index 100% rename from tooling/test/utils/test_util.cpp rename to tooling/dynamic/test/utils/test_util.cpp diff --git a/tooling/test/utils/test_util.h b/tooling/dynamic/test/utils/test_util.h similarity index 100% rename from tooling/test/utils/test_util.h rename to tooling/dynamic/test/utils/test_util.h diff --git a/tooling/utils/utils.cpp b/tooling/dynamic/utils/utils.cpp similarity index 99% rename from tooling/utils/utils.cpp rename to tooling/dynamic/utils/utils.cpp index c49c5117..88802c42 100644 --- a/tooling/utils/utils.cpp +++ b/tooling/dynamic/utils/utils.cpp @@ -15,7 +15,7 @@ #include #include "common/log_wrapper.h" -#include "tooling/utils/utils.h" +#include "tooling/dynamic/utils/utils.h" namespace OHOS::ArkCompiler::Toolchain { bool Utils::GetCurrentTime(char *date, char *tim, size_t size) diff --git a/tooling/utils/utils.h b/tooling/dynamic/utils/utils.h similarity index 100% rename from tooling/utils/utils.h rename to tooling/dynamic/utils/utils.h diff --git a/tooling/static/BUILD.gn b/tooling/static/BUILD.gn new file mode 100644 index 00000000..1e1decd2 --- /dev/null +++ b/tooling/static/BUILD.gn @@ -0,0 +1,75 @@ +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../toolchain.gni") + +libarkinspector_sources = [ + "connection/endpoint_base.cpp", + "connection/event_loop.cpp", + "connection/ohos_ws/ohos_ws_server.cpp", + "connection/ohos_ws/ohos_ws_server_endpoint.cpp", + "connection/server_endpoint_base.cpp", + "debugger/breakpoint.cpp", + "debugger/breakpoint_storage.cpp", + "debugger/conditional_breakpoint.cpp", + "debugger/debug_info_cache.cpp", + "debugger/debuggable_thread.cpp", + "debugger/object_repository.cpp", + "debugger/thread_state.cpp", + "error.cpp", + "evaluation/evaluation_engine.cpp", + "init.cpp", + "inspector.cpp", + "inspector_server.cpp", + "json_serialization/jrpc_error.cpp", + "session_manager.cpp", + "source_manager.cpp", + "types/custom_url_breakpoint_response.cpp", + "types/debugger_call_function_on_request.cpp", + "types/debugger_evaluation_request.cpp", + "types/exception_details.cpp", + "types/location.cpp", + "types/object_preview.cpp", + "types/profile_result.cpp", + "types/remote_object.cpp", + "types/scope.cpp", + "types/url_breakpoint_request.cpp", + "types/url_breakpoint_response.cpp", +] + +config("libarkinspector_config") { + cflags_cc = [ + "-fexceptions", + "-Wno-invalid-offsetof", + "-Wno-null-pointer-subtraction", + "-Wno-error=unknown-warning-option", + ] + + # required for arkcompiler_toolchain compilation + if (is_ohos) { + defines = [ "OHOS_PLATFORM" ] + } +} + +ohos_static_library("libark_tooling_plus_static") { + sources = libarkinspector_sources + external_deps = hiviewdfx_ext_deps + + if (is_mingw || is_win) { + output_extension = "dll" + } else { + output_extension = "so" + } + part_name = "toolchain" + subsystem_name = "arkcompiler" +} \ No newline at end of file diff --git a/tooling/static/CMakeLists.txt b/tooling/static/CMakeLists.txt new file mode 100644 index 00000000..0773e218 --- /dev/null +++ b/tooling/static/CMakeLists.txt @@ -0,0 +1,135 @@ +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.10) + +project(arkinspector) + +set(ARKINSPECTOR_ROOTS + connection/endpoint_base.cpp + connection/event_loop.cpp + connection/server_endpoint_base.cpp + debugger/breakpoint.cpp + debugger/breakpoint_storage.cpp + debugger/conditional_breakpoint.cpp + debugger/debug_info_cache.cpp + debugger/debuggable_thread.cpp + debugger/object_repository.cpp + debugger/thread_state.cpp + error.cpp + evaluation/evaluation_engine.cpp + init.cpp + inspector.cpp + inspector_server.cpp + json_serialization/jrpc_error.cpp + session_manager.cpp + source_manager.cpp + types/custom_url_breakpoint_response.cpp + types/debugger_evaluation_request.cpp + types/debugger_call_function_on_request.cpp + types/exception_details.cpp + types/location.cpp + types/profile_result.cpp + types/remote_object.cpp + types/object_preview.cpp + types/scope.cpp + types/url_breakpoint_request.cpp + types/url_breakpoint_response.cpp +) +set(ARKINSPECTOR_LINKED_LIBRARIES + arkbase + arkdisassembler + arkfile + arkruntime +) +set(ARKINSPECTOR_DEFINITIONS + "" +) + +# required for arkcompiler_toolchain compilation +if(PANDA_TARGET_OHOS) + list(APPEND ARKINSPECTOR_DEFINITIONS -DOHOS_PLATFORM) +endif() + +if(PANDA_TOOLING_ASIO) + list(APPEND ARKINSPECTOR_ROOTS + connection/asio/asio_server.cpp + connection/asio/ws_logger.cpp + ) + set(ARKINSPECTOR_INCLUDES + ${PANDA_THIRD_PARTY_SOURCES_DIR}/asio/asio/include/ + ${PANDA_THIRD_PARTY_SOURCES_DIR}/websocketpp/ + ) + list(APPEND ARKINSPECTOR_DEFINITIONS + -DPANDA_TOOLING_ASIO + -DASIO_NO_TYPEID + -DASIO_STANDALONE + ) +else() + list(APPEND ARKINSPECTOR_ROOTS + connection/ohos_ws/ohos_ws_server_endpoint.cpp + connection/ohos_ws/ohos_ws_server.cpp + ) + list(APPEND ARKINSPECTOR_LINKED_LIBRARIES toolchain_websocket) + set(ARKINSPECTOR_INCLUDES + ${PANDA_THIRD_PARTY_SOURCES_DIR}/arkcompiler/toolchain/ + ${PANDA_ROOT}/runtime/tooling/ + ) +endif() + + +panda_add_library(${PROJECT_NAME} SHARED ${ARKINSPECTOR_ROOTS}) + +panda_target_compile_definitions(${PROJECT_NAME} PUBLIC ${ARKINSPECTOR_DEFINITIONS}) + +panda_target_compile_options(${PROJECT_NAME} PUBLIC -fexceptions -Wno-invalid-offsetof) + +add_dependencies(${PROJECT_NAME} arkruntime) + +panda_target_include_directories(${PROJECT_NAME} + PUBLIC ${PANDA_ROOT}/runtime/include/ + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} +) + +panda_target_include_directories(${PROJECT_NAME} SYSTEM + PUBLIC ${ARKINSPECTOR_INCLUDES} +) + +panda_target_link_libraries(${PROJECT_NAME} + ${ARKINSPECTOR_LINKED_LIBRARIES} +) + +panda_add_sanitizers(TARGET ${PROJECT_NAME} SANITIZERS ${PANDA_SANITIZERS_LIST}) + +panda_add_gtest( + NAME arkinspector_tests + NO_CORES + SOURCES + tests/base64.cpp + tests/debug_info_cache.cpp + tests/inspector_server.cpp + tests/json_object_matcher.cpp + tests/object_repository.cpp + tests/session_manager.cpp + tests/source_manager.cpp + tests/thread_state.cpp + INCLUDE_DIRS + ${PANDA_ROOT}/runtime/tooling/inspector + LIBRARIES + arkassembler + ${PROJECT_NAME} + arkruntime + gmock + SANITIZERS + ${PANDA_SANITIZERS_LIST} +) diff --git a/tooling/static/common.h b/tooling/static/common.h new file mode 100644 index 00000000..fb005456 --- /dev/null +++ b/tooling/static/common.h @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef PANDA_TOOLING_INSPECTOR_COMMON_H +#define PANDA_TOOLING_INSPECTOR_COMMON_H + +#include +#include + +namespace ark::tooling::inspector { +using SourceFileFilter = std::function; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_COMMON_H diff --git a/tooling/static/connection/asio/asio_config.h b/tooling/static/connection/asio/asio_config.h new file mode 100644 index 00000000..6afe109c --- /dev/null +++ b/tooling/static/connection/asio/asio_config.h @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_ASIO_CONFIG_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_ASIO_CONFIG_H + +#include "websocketpp/config/asio_no_tls.hpp" +#include "websocketpp/logger/levels.hpp" +#include "websocketpp/transport/asio/endpoint.hpp" + +#include "connection/asio/ws_logger.h" + +namespace ark::tooling::inspector { +// NOLINTBEGIN(readability-identifier-naming) +struct AsioConfig : websocketpp::config::asio { + static const websocketpp::log::level alog_level = websocketpp::log::alevel::access_core; + + using alog_type = WsLogger; + using elog_type = WsLogger; + + struct transport_config : websocketpp::config::asio::transport_config { + using alog_type = AsioConfig::alog_type; + using elog_type = AsioConfig::elog_type; + }; + + using transport_type = websocketpp::transport::asio::endpoint; +}; +// NOLINTEND(readability-identifier-naming) +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_ASIO_CONFIG_H diff --git a/tooling/static/connection/asio/asio_server.cpp b/tooling/static/connection/asio/asio_server.cpp new file mode 100644 index 00000000..d7f0af57 --- /dev/null +++ b/tooling/static/connection/asio/asio_server.cpp @@ -0,0 +1,182 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "connection/asio/asio_server.h" + +#include +#include +#include + +#include "websocketpp/close.hpp" +#include "websocketpp/http/constants.hpp" +#include "websocketpp/uri.hpp" + +#include "utils/json_builder.h" +#include "utils/logger.h" + +#include "connection/asio/asio_config.h" + +#define CONFIG AsioConfig // NOLINT(cppcoreguidelines-macro-usage) +#include "server_endpoint-inl.h" +#undef CONFIG + +namespace ark::tooling::inspector { +template +static void HandleHttpRequest(ConnectionPtr conn) +{ + static constexpr std::string_view GET = "GET"; + static constexpr std::string_view JSON_URI = "/json"; + static constexpr std::string_view JSON_LIST_URI = "/json/list"; + static constexpr std::string_view JSON_VERSION_URI = "/json/version"; + + const auto &req = conn->get_request(); + const auto &uri = req.get_uri(); + if (req.get_method() != GET) { + CloseConnection(conn); + return; + } + + if (uri == JSON_URI || uri == JSON_LIST_URI) { + HandleJsonList(conn); + } else if (uri == JSON_VERSION_URI) { + HandleJsonVersion(conn); + } else { + CloseConnection(conn); + return; + } + conn->append_header("Content-Type", "application/json; charset=UTF-8"); + conn->append_header("Cache-Control", "no-cache"); + conn->set_status(websocketpp::http::status_code::value::ok); +} + +template +static void HandleJsonVersion(ConnectionPtr conn) +{ + JsonObjectBuilder builder; + builder.AddProperty("browser", "ArkTS"); + builder.AddProperty("protocol-version", "1.1"); + AddWebSocketDebuggerUrl(conn, builder); + conn->set_body(std::move(builder).Build()); +} + +template +static void HandleJsonList(ConnectionPtr conn) +{ + auto buildJson = [conn](JsonObjectBuilder &builder) { + builder.AddProperty("description", "ArkTS"); + // Empty "id" corresponds to constructed URLs + builder.AddProperty("id", ""); + builder.AddProperty("type", "node"); + // Do not add "url" fields as it dummy value might confuse some clients + AddWebSocketDebuggerUrl(conn, builder); + std::stringstream ss; + // CC-OFFNXT(WordsTool.74) fixed protocol url + ss << "devtools://devtools/bundled/devtools_app.html?ws=" << conn->get_host() << ':' + << static_cast(conn->get_port()); + builder.AddProperty("devToolsFrontendUrl", ss.str()); + }; + JsonArrayBuilder arrayBuilder; + arrayBuilder.Add(std::move(buildJson)); + conn->set_body(std::move(arrayBuilder).Build()); +} + +template +static void CloseConnection(ConnectionPtr conn) +{ + std::error_code ec; + conn->close(websocketpp::close::status::protocol_error, "", ec); + if (ec) { + LOG(WARNING, DEBUGGER) << "Failed to close invalid HTTP connection"; + } +} + +template +static void AddWebSocketDebuggerUrl(ConnectionPtr conn, JsonObjectBuilder &builder) +{ + std::stringstream ss; + ss << "ws://" << conn->get_host() << ':' << conn->get_port(); + builder.AddProperty("webSocketDebuggerUrl", ss.str()); +} + +bool AsioServer::Initialize() +{ + if (initialized_) { + return true; + } + + // Do JSON handshake, as it is expected by some debugger clients + endpoint_.set_http_handler([this](auto hdl) { HandleHttpRequest(endpoint_.get_con_from_hdl(hdl)); }); + + std::error_code ec; + endpoint_.init_asio(ec); + if (ec) { + LOG(ERROR, DEBUGGER) << "Failed to initialize endpoint"; + return false; + } + + endpoint_.set_reuse_addr(true); + initialized_ = true; + return true; +} + +websocketpp::uri_ptr AsioServer::Start(uint32_t port) +{ + if (!Initialize()) { + return nullptr; + } + + std::error_code ec; + + endpoint_.listen(port, ec); + if (ec) { + LOG(ERROR, DEBUGGER) << "Failed to bind Inspector server on port " << port; + return nullptr; + } + + endpoint_.start_accept(ec); + + if (!ec) { + auto ep = endpoint_.get_local_endpoint(ec); + + if (!ec) { + LOG(INFO, DEBUGGER) << "Inspector server listening on " << ep; + return std::make_shared(false, ep.address().to_string(), ep.port(), "/"); + } + + LOG(ERROR, DEBUGGER) << "Failed to get the TCP endpoint"; + } else { + LOG(ERROR, DEBUGGER) << "Failed to start Inspector connection acceptance loop"; + } + + endpoint_.stop_listening(ec); + return nullptr; +} + +bool AsioServer::Stop() +{ + if (!Initialize()) { + return false; + } + + // Stop accepting new connections. + Kill(); + // Close the current connection. + Close(); + + std::error_code ec; + endpoint_.stop_listening(ec); + return !ec; +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/connection/asio/asio_server.h b/tooling/static/connection/asio/asio_server.h new file mode 100644 index 00000000..04df5ddc --- /dev/null +++ b/tooling/static/connection/asio/asio_server.h @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_ASIO_SERVER_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_ASIO_SERVER_H + +#include + +#include "websocketpp/uri.hpp" + +#include "connection/asio/asio_config.h" +#include "connection/asio/server_endpoint.h" + +namespace ark::tooling::inspector { +// NOLINTNEXTLINE(fuchsia-multiple-inheritance) +class AsioServer final : public ServerEndpoint { +public: + bool RunOne() override + { + return endpoint_.run_one() != 0; + } + + websocketpp::uri_ptr Start(uint32_t port = 0); + bool Stop(); + +private: + bool Initialize(); + +private: + bool initialized_ {false}; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_ASIO_SERVER_H diff --git a/tooling/static/connection/asio/server_endpoint-inl.h b/tooling/static/connection/asio/server_endpoint-inl.h new file mode 100644 index 00000000..5277d2d3 --- /dev/null +++ b/tooling/static/connection/asio/server_endpoint-inl.h @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_SERVER_ENDPOINT_INL_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_SERVER_ENDPOINT_INL_H + +#ifndef CONFIG +#error Define CONFIG before including this header +#endif + +#include "connection/asio/server_endpoint.h" + +namespace ark::tooling::inspector { +template <> // NOLINTNEXTLINE(misc-definitions-in-headers) +ServerEndpoint::ServerEndpoint() noexcept +{ + endpoint_.set_message_handler( + [this](auto /* hdl */, auto message) { this->HandleMessage(message->get_payload()); }); + + endpoint_.set_validate_handler([this](auto hdl) { + onValidate_(); + + if (Pin(hdl)) { + return true; + } + + endpoint_.get_con_from_hdl(hdl)->set_body("Another debug session is in progress"); + return false; + }); + + endpoint_.set_open_handler([this](auto) { onOpen_(); }); + endpoint_.set_fail_handler([this](auto hdl) { + onFail_(); + Unpin(hdl); + }); + + endpoint_.set_close_handler([this](auto hdl) { Unpin(hdl); }); +} + +template <> // NOLINTNEXTLINE(misc-definitions-in-headers) +bool ServerEndpoint::Close() +{ + if (auto connection = GetPinnedConnection()) { + std::error_code ec; + connection->close(websocketpp::close::status::going_away, "", ec); + if (ec) { + LOG(ERROR, DEBUGGER) << "Error closing websocket connection: " << ec.message(); + return false; + } + } + return true; +} +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_SERVER_ENDPOINT_INL_H diff --git a/tooling/static/connection/asio/server_endpoint.h b/tooling/static/connection/asio/server_endpoint.h new file mode 100644 index 00000000..1da60093 --- /dev/null +++ b/tooling/static/connection/asio/server_endpoint.h @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_SERVER_ENDPOINT_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_SERVER_ENDPOINT_H + +#include "websocketpp/common/connection_hdl.hpp" +#include "websocketpp/frame.hpp" +#include "websocketpp/server.hpp" + +#include "connection/server_endpoint_base.h" + +namespace ark::tooling::inspector { +// Server endpoint based on websocketpp implementation. +// NOLINTNEXTLINE(fuchsia-multiple-inheritance) +template +class ServerEndpoint : public ServerEndpointBase { +protected: + using Endpoint = websocketpp::server; + using ConnectionPtr = typename Endpoint::connection_ptr; + +public: + ServerEndpoint() noexcept; + +protected: + ConnectionPtr GetPinnedConnection() + { + return connection_; + } + + bool Pin(const websocketpp::connection_hdl &hdl) + { + ConnectionPtr expected; + // set new connection only if there is no already existing one + return std::atomic_compare_exchange_strong(&connection_, &expected, endpoint_.get_con_from_hdl(hdl)); + } + + void Unpin(const websocketpp::connection_hdl &hdl) + { + auto expected = endpoint_.get_con_from_hdl(hdl); + // expect that the given connection is the one already stored + std::atomic_compare_exchange_strong(&connection_, &expected, {}); + } + + bool Close(); + + Endpoint endpoint_; // NOLINT(misc-non-private-member-variables-in-classes) + +private: + void SendMessage(const std::string &message) override + { + if (auto connection = GetPinnedConnection()) { + connection->send(message, websocketpp::frame::opcode::text); + } else { + LOG(INFO, DEBUGGER) << "Did not send message: " << message; + } + } + + ConnectionPtr connection_; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_SERVER_ENDPOINT_H diff --git a/tooling/static/connection/asio/ws_logger.cpp b/tooling/static/connection/asio/ws_logger.cpp new file mode 100644 index 00000000..8b895ba5 --- /dev/null +++ b/tooling/static/connection/asio/ws_logger.cpp @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "connection/asio/ws_logger.h" + +#include "websocketpp/logger/levels.hpp" + +#include "macros.h" +#include "utils/logger.h" + +namespace ark::tooling::inspector { +void WsLogger::set_channels(Level channels) +{ + if (channels != 0) { + dynamicChannels_ |= channels & staticChannels_; + } else { + dynamicChannels_ = 0; + } +} + +void WsLogger::write(Level channel, const std::string &string) const +{ + if (!dynamic_test(channel)) { + return; + } + + auto level = channel_log_level(channel); + auto component = Logger::Component::DEBUGGER; + + if (!Logger::IsLoggingOnOrAbort(level, component)) { + return; + } + +#ifndef NDEBUG + if (Logger::IsMessageSuppressed(level, component)) { + return; + } +#endif + + Logger::Message message(level, component, false); + auto &ms = message.GetStream(); + + if (channelType_ == websocketpp::log::channel_type_hint::access) { + ms << websocketpp::log::alevel::channel_name(channel) << ": "; + } + + ms << string; +} + +Logger::Level WsLogger::channel_log_level(Level channel) const +{ + if (channelType_ != websocketpp::log::channel_type_hint::error) { + return Logger::Level::INFO; + } + + switch (channel) { + case websocketpp::log::elevel::devel: + return Logger::Level::DEBUG; + + case websocketpp::log::elevel::library: + case websocketpp::log::elevel::info: + return Logger::Level::INFO; + + case websocketpp::log::elevel::warn: + return Logger::Level::WARNING; + + case websocketpp::log::elevel::rerror: + return Logger::Level::ERROR; + + case websocketpp::log::elevel::fatal: + return Logger::Level::FATAL; + + default: + UNREACHABLE(); + } +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/connection/asio/ws_logger.h b/tooling/static/connection/asio/ws_logger.h new file mode 100644 index 00000000..b5ecbf41 --- /dev/null +++ b/tooling/static/connection/asio/ws_logger.h @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_WS_LOGGER_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_WS_LOGGER_H + +#include + +#include "websocketpp/logger/levels.hpp" + +#include "utils/logger.h" + +namespace ark::tooling::inspector { +class WsLogger { + using ChannelType = websocketpp::log::channel_type_hint::value; + using Level = websocketpp::log::level; + +public: + WsLogger(Level staticChannels, ChannelType channelType) : channelType_(channelType), staticChannels_(staticChannels) + { + } + + // NOLINTNEXTLINE(readability-identifier-naming) + void set_channels(Level channels); + // NOLINTNEXTLINE(readability-identifier-naming) + bool static_test(Level channel) const + { + return (channel & staticChannels_) == channel; + } + // NOLINTNEXTLINE(readability-identifier-naming) + bool dynamic_test(Level channel) const + { + return (channel & dynamicChannels_) == channel; + } + // NOLINTNEXTLINE(readability-identifier-naming) + void write(Level channel, const std::string &string) const; + +private: + // NOLINTNEXTLINE(readability-identifier-naming) + Logger::Level channel_log_level(Level channel) const; + + const ChannelType channelType_; + const Level staticChannels_; + Level dynamicChannels_ {0}; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_ASIO_WS_LOGGER_H diff --git a/tooling/static/connection/endpoint_base.cpp b/tooling/static/connection/endpoint_base.cpp new file mode 100644 index 00000000..5f06a37a --- /dev/null +++ b/tooling/static/connection/endpoint_base.cpp @@ -0,0 +1,104 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "connection/endpoint_base.h" + +#include + +#include "utils/json_builder.h" +#include "utils/json_parser.h" +#include "utils/logger.h" + +namespace ark::tooling::inspector { +void EndpointBase::OnCall(const char *method, EndpointBase::MethodHandler &&handler) +{ + os::memory::LockHolder lock(methodHandlersMutex_); + methodHandlers_[method] = std::move(handler); +} + +void EndpointBase::HandleMessage(const std::string &message) +{ + JsonObject request(message); + if (!request.IsValid()) { + LOG(INFO, DEBUGGER) << "Invalid request: " << message; + return; + } + + LOG(DEBUG, DEBUGGER) << "Received " << message; + + auto sessionId = request.GetValue("sessionId"); + auto id = request.GetValue("id"); + auto method = request.GetValue("method"); + auto result = request.GetValue("result"); + + if (method != nullptr && result == nullptr) { + os::memory::LockHolder lock(methodHandlersMutex_); + + auto optId = id != nullptr ? std::make_optional(*id) : std::nullopt; + if (auto handler = methodHandlers_.find(*method); handler != methodHandlers_.end()) { + auto *params = request.GetValue("params"); + + JsonObject empty; + + handler->second(sessionId != nullptr ? *sessionId : std::string(), optId, + params != nullptr ? **params : empty); + } else { + LOG(WARNING, DEBUGGER) << "Unsupported method: " << message; + HandleUnsupportedMethod(optId, *method); + } + } else if (result != nullptr && method == nullptr) { + if (id == nullptr) { + LOG(INFO, DEBUGGER) << "Response object with no \"id\": " << message; + return; + } + + if (auto handler = resultHandlers_.extract(*id)) { + handler.mapped()(**result); + } + } else { + LOG(INFO, DEBUGGER) << "Expected either 'method' or 'result' parameter"; + } +} + +void EndpointBase::Call(const std::string &sessionId, std::optional id, const char *method, + std::function &¶ms) +{ + Send([&sessionId, id, method, ¶ms](JsonObjectBuilder &call) { + if (id) { + call.AddProperty("id", *id); + } + + call.AddProperty("method", method); + call.AddProperty("params", std::move(params)); + + if (!sessionId.empty()) { + call.AddProperty("sessionId", sessionId); + } + }); +} + +void EndpointBase::HandleUnsupportedMethod(std::optional optId, const std::string &method) +{ + Send([&optId, &method](JsonObjectBuilder &builder) { + if (optId) { + builder.AddProperty("id", *optId); + } + builder.AddProperty("error", [&method](JsonObjectBuilder &errorBuilder) { + errorBuilder.AddProperty("code", static_cast(InspectorErrorCode::METHOD_NOT_FOUND)); + errorBuilder.AddProperty("message", "Unsupported method: " + method); + }); + }); +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/connection/endpoint_base.h b/tooling/static/connection/endpoint_base.h new file mode 100644 index 00000000..629bd741 --- /dev/null +++ b/tooling/static/connection/endpoint_base.h @@ -0,0 +1,118 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_ENDPOINT_BASE_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_ENDPOINT_BASE_H + +#include +#include +#include +#include +#include +#include + +#include "utils/json_builder.h" +#include "utils/logger.h" + +#include "json_serialization/jrpc_error.h" + +namespace ark { +class JsonObject; +} // namespace ark + +namespace ark::tooling::inspector { +enum class InspectorErrorCode { + PARSE_ERROR = -32700, + INTERNAL_ERROR = -32603, + INVALID_PARAMS = -32602, + METHOD_NOT_FOUND = -32601, + INVALID_REQUEST = -32600, + SESSION_NOT_FOUND = -32001, + SERVER_ERROR = -32000, +}; + +// Base class implementation of JSON-RPC endpoint handling the Inspector protocol. +class EndpointBase { +public: + using Id = double; + +private: + using MethodHandler = std::function, const JsonObject &)>; + using ResultHandler = std::function; + +public: + void OnCall(const char *method, MethodHandler &&handler); + +protected: + void HandleMessage(const std::string &message); + + void OnResult(Id id, ResultHandler &&handler) + { + resultHandlers_[id] = std::move(handler); + } + + void Call( + const std::string &sessionId, std::optional id, const char *method, + std::function &¶ms = [](JsonObjectBuilder & /* builder */) {}); + + template + void Reply(const std::string &sessionId, Id id, Result &&result) + { + Send([&sessionId, id, &result](JsonObjectBuilder &reply) { + reply.AddProperty("id", id); + reply.AddProperty("result", std::forward(result)); + + if (!sessionId.empty()) { + reply.AddProperty("sessionId", sessionId); + } + }); + } + + void ReplyError(const std::string &sessionId, Id id, JRPCError &&error) + { + Send([&sessionId, id, &error](JsonObjectBuilder &reply) { + reply.AddProperty("id", id); + reply.AddProperty("error", std::move(error)); + + if (!sessionId.empty()) { + reply.AddProperty("sessionId", sessionId); + } + }); + } + +private: + /// Send JSON message. + virtual void SendMessage(const std::string &message) = 0; + + /// Send JSON message created with the provided build function. + template + void Send(BuildFunction &&build) + { + JsonObjectBuilder builder; + build(builder); + auto message = std::move(builder).Build(); + LOG(DEBUG, DEBUGGER) << "Sending " << message; + SendMessage(message); + } + + void HandleUnsupportedMethod(std::optional optId, const std::string &method); + + os::memory::Mutex methodHandlersMutex_; + std::unordered_map methodHandlers_ GUARDED_BY(methodHandlersMutex_); + std::unordered_map resultHandlers_; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_ENDPOINT_BASE_H diff --git a/tooling/static/connection/event_loop.cpp b/tooling/static/connection/event_loop.cpp new file mode 100644 index 00000000..a9940f42 --- /dev/null +++ b/tooling/static/connection/event_loop.cpp @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "connection/event_loop.h" + +#include "macros.h" + +namespace ark::tooling::inspector { +bool EventLoop::Kill() +{ + return running_.exchange(false); +} + +void EventLoop::Run() +{ + ASSERT_PRINT(!running_, "Event loop is already running"); + + for (running_ = true; running_;) { + os::memory::WriteLockHolder lock(taskExecution_); + RunOne(); + } +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/connection/event_loop.h b/tooling/static/connection/event_loop.h new file mode 100644 index 00000000..06b7e668 --- /dev/null +++ b/tooling/static/connection/event_loop.h @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_EVENT_LOOP_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_EVENT_LOOP_H + +#include + +#include "os/mutex.h" + +namespace ark::tooling::inspector { +class EventLoop { +public: + // Notify the running event loop to stop. + bool Kill(); + + // Run the event loop until paused. + void Run(); + + // Run at most one event loop handler, may block. + virtual bool RunOne() = 0; + + // Pause the event loop. Wait for the current task to finish. + void Pause() ACQUIRE_SHARED(taskExecution_) + { + taskExecution_.ReadLock(); + } + + // Notify the event loop to continue. + void Continue() RELEASE_GENERIC(taskExecution_) + { + taskExecution_.Unlock(); + } + +private: + std::atomic running_ {false}; + os::memory::RWLock taskExecution_; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_EVENT_LOOP_H diff --git a/tooling/static/connection/ohos_ws/ohos_ws_server.cpp b/tooling/static/connection/ohos_ws/ohos_ws_server.cpp new file mode 100644 index 00000000..3d7894d6 --- /dev/null +++ b/tooling/static/connection/ohos_ws/ohos_ws_server.cpp @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "connection/ohos_ws/ohos_ws_server.h" + +#include + +#include "os/thread.h" +#include "utils/logger.h" + +namespace ark::tooling::inspector { +[[maybe_unused]] static constexpr std::string_view G_ARK_TS_INSPECTOR_NAME = "ArkEtsDebugger"; + +bool OhosWsServer::RunOne() +{ + if (!endpoint_.IsConnected() && !AcceptNewWsConnection()) { + LOG(WARNING, DEBUGGER) << "Inspector server is unable to establish a new connection, exiting"; + return false; + } + + auto message = endpoint_.Decode(); + if (!message.empty()) { + if (Endpoint::IsDecodeDisconnectMsg(message)) { + LOG(WARNING, DEBUGGER) << "Inspector server received `disconnect`, exiting"; + return false; + } + HandleMessage(message); + } + return true; +} + +bool OhosWsServer::Start([[maybe_unused]] uint32_t port) +{ + bool succeeded = false; + +#if !defined(PANDA_TARGET_OHOS) + succeeded = endpoint_.InitTcpWebSocket(port); + uint32_t name = port; +#else + auto pid = os::thread::GetPid(); + std::string name = std::to_string(pid) + std::string(G_ARK_TS_INSPECTOR_NAME); + succeeded = endpoint_.InitUnixWebSocket(name); +#endif + if (succeeded) { + LOG(INFO, DEBUGGER) << "Inspector server listening on " << name; + return true; + } + LOG(ERROR, DEBUGGER) << "Failed to bind Inspector server on " << name; + return false; +} + +bool OhosWsServer::Stop() +{ + // Stop event loop before closing endpoint server. + Kill(); + endpoint_.Close(); + socketpairMode_ = false; + return true; +} + +bool OhosWsServer::StartForSocketpair(int socketfd) +{ + bool succeeded = endpoint_.InitUnixWebSocket(socketfd); + if (succeeded) { + LOG(INFO, DEBUGGER) << "Inspector server listening on " << socketfd; + socketpairMode_ = true; + return true; + } + + LOG(ERROR, DEBUGGER) << "Failed to bind Inspector server on " << socketfd; + return false; +} + +bool OhosWsServer::AcceptNewWsConnection() +{ + if (socketpairMode_) { + return endpoint_.ConnectUnixWebSocketBySocketpair(); + } + return endpoint_.AcceptNewConnection(); +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/connection/ohos_ws/ohos_ws_server.h b/tooling/static/connection/ohos_ws/ohos_ws_server.h new file mode 100644 index 00000000..870b8cc1 --- /dev/null +++ b/tooling/static/connection/ohos_ws/ohos_ws_server.h @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_OHOS_OHOS_WS_SERVER_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_OHOS_OHOS_WS_SERVER_H + +#include "connection/ohos_ws/ohos_ws_server_endpoint.h" + +namespace ark::tooling::inspector { +// JSON-RPC server processing only one connection at time. +// Based on OHOS websocket protocol implementation. +// NOLINTNEXTLINE(fuchsia-multiple-inheritance) +class OhosWsServer final : public OhosWsServerEndpoint { +public: + bool RunOne() override; + + // Creates socket and starts listening + bool Start(uint32_t port = 0); + bool Stop(); + bool StartForSocketpair(int socketfd); + +private: + bool socketpairMode_ {false}; + + bool AcceptNewWsConnection(); +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_OHOS_OHOS_WS_SERVER_H diff --git a/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.cpp b/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.cpp new file mode 100644 index 00000000..8a6ef8a8 --- /dev/null +++ b/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.cpp @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "connection/ohos_ws/ohos_ws_server_endpoint.h" + +namespace ark::tooling::inspector { +OhosWsServerEndpoint::OhosWsServerEndpoint() noexcept +{ + endpoint_.SetValidateConnectionCallback([this](auto) { + // a new connection will be accepted only after the prior is finished, + // which is ensured by websocket implementation + onValidate_(); + return true; + }); + + endpoint_.SetOpenConnectionCallback([this] { onOpen_(); }); + endpoint_.SetFailConnectionCallback([this] { onFail_(); }); +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.h b/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.h new file mode 100644 index 00000000..3ab4b77e --- /dev/null +++ b/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.h @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_OHOS_WS_OHOS_WS_SERVER_ENDPOINT_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_OHOS_WS_OHOS_WS_SERVER_ENDPOINT_H + +#include "server/websocket_server.h" + +#include "connection/server_endpoint_base.h" + +namespace ark::tooling::inspector { +// Server endpoint based on OHOS websocket implementation +// NOLINTNEXTLINE(fuchsia-multiple-inheritance) +class OhosWsServerEndpoint : public ServerEndpointBase { +protected: + using Endpoint = OHOS::ArkCompiler::Toolchain::WebSocketServer; + +public: + OhosWsServerEndpoint() noexcept; + +protected: + Endpoint endpoint_; // NOLINT(misc-non-private-member-variables-in-classes) + +private: + void SendMessage(const std::string &message) override + { + auto wasSent = false; + if (endpoint_.IsConnected()) { + wasSent = endpoint_.SendReply(message); + } + if (!wasSent) { + LOG(INFO, DEBUGGER) << "Did not send message: " << message; + } + } +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_OHOS_WS_OHOS_WS_SERVER_ENDPOINT_H diff --git a/tooling/static/connection/server.h b/tooling/static/connection/server.h new file mode 100644 index 00000000..46ef13fd --- /dev/null +++ b/tooling/static/connection/server.h @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_SERVER_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_SERVER_H + +#include + +#include "json_serialization/serializable.h" +#include "libpandabase/utils/expected.h" +#include "libpandabase/utils/json_builder.h" + +#include "connection/event_loop.h" +#include "json_serialization/jrpc_error.h" + +namespace ark { +class JsonObject; +class JsonObjectBuilder; +} // namespace ark + +namespace ark::tooling::inspector { +class Server : public virtual EventLoop { // NOLINT(fuchsia-virtual-inheritance) +public: + using MethodResponse = Expected, JRPCError>; + using Handler = std::function; + +public: + virtual void OnValidate(std::function &&handler) = 0; + virtual void OnOpen(std::function &&handler) = 0; + virtual void OnFail(std::function &&handler) = 0; + + virtual void Call(const std::string &sessionId, const char *method, + std::function &¶ms) = 0; + + void Call(const char *method, std::function &¶ms) + { + Call({}, method, std::move(params)); + } + + void Call(const std::string &sessionId, const char *method) + { + Call(sessionId, method, [](JsonObjectBuilder & /* builder */) {}); + } + + void Call(const char *method) + { + Call({}, method, [](JsonObjectBuilder & /* builder */) {}); + } + + virtual void OnCall(const char *method, Handler &&handler) = 0; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_SERVER_H diff --git a/tooling/static/connection/server_endpoint_base.cpp b/tooling/static/connection/server_endpoint_base.cpp new file mode 100644 index 00000000..bedbc976 --- /dev/null +++ b/tooling/static/connection/server_endpoint_base.cpp @@ -0,0 +1,63 @@ +/** + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "connection/server_endpoint_base.h" + +#include "utils/logger.h" + +namespace ark::tooling::inspector { + +/// Empty response, returned on success +class EmptyResponse final : public JsonSerializable { +public: + EmptyResponse() = default; + + DEFAULT_COPY_SEMANTIC(EmptyResponse); + DEFAULT_MOVE_SEMANTIC(EmptyResponse); + + ~EmptyResponse() override = default; + + void Serialize([[maybe_unused]] JsonObjectBuilder &builder) const override {} +}; + +void ServerEndpointBase::Call(const std::string &sessionId, const char *method, + std::function &¶ms) +{ + EndpointBase::Call(sessionId, std::nullopt, method, std::move(params)); +} + +void ServerEndpointBase::OnCall(const char *method, Handler &&handler) +{ + EndpointBase::OnCall(method, [this, handler = std::move(handler)](auto &sessionId, auto id, auto ¶ms) { + if (!id) { + LOG(INFO, DEBUGGER) << "Invalid request: request has no \"id\""; + return; + } + + // Execute the handler's code + auto optResult = handler(sessionId, params); + if (optResult) { + if (*optResult) { + JsonSerializable &res = **optResult; + Reply(sessionId, *id, res); + } else { + Reply(sessionId, *id, EmptyResponse()); + } + } else { + ReplyError(sessionId, *id, std::move(optResult.Error())); + } + }); +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/connection/server_endpoint_base.h b/tooling/static/connection/server_endpoint_base.h new file mode 100644 index 00000000..96ebe5d6 --- /dev/null +++ b/tooling/static/connection/server_endpoint_base.h @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONNECTION_SERVER_ENDPOINT_BASE_H +#define PANDA_TOOLING_INSPECTOR_CONNECTION_SERVER_ENDPOINT_BASE_H + +#include + +#include "connection/endpoint_base.h" +#include "connection/server.h" + +namespace ark::tooling::inspector { +// Base class for server endpoints implementations. +// Provides callbacks to be executed during client connections handling. +// NOLINTNEXTLINE(fuchsia-multiple-inheritance) +class ServerEndpointBase : public EndpointBase, public Server { +public: + using MethodResponse = Expected, JRPCError>; + using Handler = std::function; + +public: + void OnValidate(std::function &&handler) override + { + onValidate_ = std::move(handler); + } + + void OnOpen(std::function &&handler) override + { + onOpen_ = std::move(handler); + } + + void OnFail(std::function &&handler) override + { + onFail_ = std::move(handler); + } + + using Server::Call; + void Call(const std::string &sessionId, const char *method, + std::function &¶ms) override; + + void OnCall(const char *method, Handler &&handler) override; + +protected: + std::function onValidate_ = []() {}; // NOLINT(misc-non-private-member-variables-in-classes) + std::function onOpen_ = []() {}; // NOLINT(misc-non-private-member-variables-in-classes) + std::function onFail_ = []() {}; // NOLINT(misc-non-private-member-variables-in-classes) +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONNECTION_SERVER_ENDPOINT_BASE_H diff --git a/tooling/static/debugger/breakpoint.cpp b/tooling/static/debugger/breakpoint.cpp new file mode 100644 index 00000000..91e2cee9 --- /dev/null +++ b/tooling/static/debugger/breakpoint.cpp @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "breakpoint.h" + +#include "debug_info_extractor.h" +#include "error.h" +#include "evaluation/evaluation_engine.h" + +namespace ark::tooling::inspector { + +bool Breakpoint::SetLocations(std::set &sourceFiles, const DebugInfoCache &debugCache, + std::unordered_multimap &breakpointLocations) +{ + locations_ = debugCache.GetBreakpointLocations(sourceFileFilter_, lineNumber_, sourceFiles); + if (locations_.empty()) { + LOG(WARNING, DEBUGGER) << "Pending breakpoint, 0 locations resolved currently, id = " << GetId(); + return true; + } + + for (auto &location : locations_) { + breakpointLocations.emplace(location, GetId()); + } + Resolve(); + return true; +} + +void Breakpoint::TryResolveImpl(const panda_file::File &file, const panda_file::DebugInfoExtractor *debugInfo, + std::unordered_multimap &breakpointLocations) +{ + auto lineHandler = [this, &breakpointLocations](const auto &pandaFile, auto methodId, auto &entry) { + if (entry.line == lineNumber_) { + auto [it, _] = locations_.emplace(pandaFile.GetFilename().data(), methodId, entry.offset); + breakpointLocations.emplace(*it, GetId()); + Resolve(); + // Must choose the first found bytecode location in each method + return false; + } + // Continue search + return true; + }; + + for (const auto &methodId : debugInfo->GetMethodIdList()) { + if (!sourceFileFilter_(debugInfo->GetSourceFile(methodId))) { + continue; + } + + auto &table = debugInfo->GetLineNumberTable(methodId); + for (auto &entry : table) { + if (!lineHandler(file, methodId, entry)) { + break; + } + } + } +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/debugger/breakpoint.h b/tooling/static/debugger/breakpoint.h new file mode 100644 index 00000000..3d7721e0 --- /dev/null +++ b/tooling/static/debugger/breakpoint.h @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_BREAKPOINT_H +#define PANDA_TOOLING_INSPECTOR_BREAKPOINT_H + +#include +#include +#include + +#include "breakpoint_base.h" + +namespace ark::tooling::inspector { +class EvaluationEngine; + +/// @brief Breakpoint without condition, can be set in multiple locations +class Breakpoint final : public BreakpointBase { +public: + explicit Breakpoint(BreakpointId id, SourceFileFilter &&filter, size_t line, bool isUrlPattern) + : BreakpointBase(id), sourceFileFilter_(std::move(filter)), lineNumber_(line), isUrlPattern_(isUrlPattern) + { + } + + NO_COPY_SEMANTIC(Breakpoint); + NO_MOVE_SEMANTIC(Breakpoint); + + ~Breakpoint() override = default; + + bool SetLocations(std::set &sourceFiles, const DebugInfoCache &debugCache, + std::unordered_multimap &breakpointLocations) override; + + void EnumerateLocations(const std::function &func) override + { + for (const auto &loc : locations_) { + if (!func(GetId(), loc)) { + return; + } + } + } + + bool ShouldStopAt(const PtLocation &location, [[maybe_unused]] EvaluationEngine &engine) override + { + if (!IsResolved()) { + return false; + } + return std::any_of(locations_.begin(), locations_.end(), + [location](const auto &loc) { return loc == location; }); + } + + bool IsUrlPattern() + { + return isUrlPattern_; + } + +protected: + void TryResolveImpl(const panda_file::File &file, const panda_file::DebugInfoExtractor *debugInfo, + std::unordered_multimap &breakpointLocations) override; + +private: + std::unordered_set locations_; + SourceFileFilter sourceFileFilter_; + size_t lineNumber_ {0}; + bool isUrlPattern_ {false}; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_BREAKPOINT_H diff --git a/tooling/static/debugger/breakpoint_base.h b/tooling/static/debugger/breakpoint_base.h new file mode 100644 index 00000000..da39a327 --- /dev/null +++ b/tooling/static/debugger/breakpoint_base.h @@ -0,0 +1,113 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_BREAKPOINT_BASE_H +#define PANDA_TOOLING_INSPECTOR_BREAKPOINT_BASE_H + +#include +#include +#include + +#include "common.h" +#include "debug_info_cache.h" +#include "tooling/debugger.h" +#include "types/numeric_id.h" + +namespace ark::tooling::inspector { +class EvaluationEngine; + +/// @brief Base breakpoint class +class BreakpointBase { +public: + explicit BreakpointBase(BreakpointId id) : id_(id) {} + + DEFAULT_COPY_SEMANTIC(BreakpointBase); + DEFAULT_MOVE_SEMANTIC(BreakpointBase); + + virtual ~BreakpointBase() = default; + + /** + * @brief Get breakpoint id + * @returns BreakpointId + */ + BreakpointId GetId() const + { + return id_; + } + + /** + * @brief If breakpoint resolved and can be hit + * @returns true/false + */ + bool IsResolved() const + { + return resolved_; + } + + /** + * @brief Tries to resolve breakpoint, shuould be called on load new panda file + * @param[in] file loaded panda file + * @param[in] debugInfo extractor with already added file + * @returns Was breakpoint resolved + */ + bool TryResolve(const panda_file::File &file, const panda_file::DebugInfoExtractor *debugInfo, + std::unordered_multimap &breakpointLocations) + { + TryResolveImpl(file, debugInfo, breakpointLocations); + return IsResolved(); + } + + /** + * @brief Applies function to every breakpoint location + * @param[in] func function to apply to every breakpoint + */ + virtual void EnumerateLocations(const std::function &func) = 0; + + /** + * @brief Check if should stop at location + * @param[in] location + * @param[in] engine to evaluate conditions for conditional breakpoint + * @returns true/false + */ + virtual bool ShouldStopAt(const PtLocation &location, EvaluationEngine &engine) = 0; + + /** + * @brief Set locations for current breakpoint + * @param[out] sourceFiles returns sourceFiles where breakpoint was set + * @param[in] debugCache debug cache to link src files with bytecode executable + * @param[out] breakpointLocations map of breakpoint locations from storage + * @returns BreakpointId of set breakpoint. + */ + virtual bool SetLocations(std::set &sourceFiles, const DebugInfoCache &debugCache, + std::unordered_multimap &breakpointLocations) = 0; + +protected: + virtual void TryResolveImpl( + const panda_file::File &file, const panda_file::DebugInfoExtractor *debugInfo, + std::unordered_multimap &breakpointLocations) = 0; + + void Resolve() + { + resolved_ = true; + } + +private: + BreakpointId id_; + bool resolved_ {false}; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_BREAKPOINT_BASE_H diff --git a/tooling/static/debugger/breakpoint_storage.cpp b/tooling/static/debugger/breakpoint_storage.cpp new file mode 100644 index 00000000..f0a7185f --- /dev/null +++ b/tooling/static/debugger/breakpoint_storage.cpp @@ -0,0 +1,147 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "breakpoint_storage.h" + +#include "breakpoint.h" +#include "conditional_breakpoint.h" +#include "os/mutex.h" + +namespace ark::tooling::inspector { + +bool BreakpointStorage::ShouldStopAtBreakpoint(const PtLocation &location, EvaluationEngine &engine) +{ + os::memory::ReadLockHolder lock(lock_); + + if (!breakpointsActive_) { + return false; + } + + auto rng = breakpointLocations_.equal_range(location); + + for (auto iter = rng.first; iter != rng.second; ++iter) { + BreakpointId bpId = iter->second; + bool shouldStop = breakpointStorage_[bpId]->ShouldStopAt(location, engine); + if (shouldStop) { + return true; + } + } + return false; +} + +void BreakpointStorage::ResolveBreakpoints(const panda_file::File &file, + const panda_file::DebugInfoExtractor *debugInfoCache) +{ + os::memory::ReadLockHolder lock(lock_); + + for (auto &[_, bp] : breakpointStorage_) { + bp->TryResolve(file, debugInfoCache, breakpointLocations_); + // if bp resolved add locations + } +} + +void BreakpointStorage::RemoveBreakpoint(BreakpointId id) +{ + os::memory::WriteLockHolder lock(lock_); + + for (auto it = breakpointLocations_.begin(); it != breakpointLocations_.end();) { + if (it->second == id) { + it = breakpointLocations_.erase(it); + } else { + ++it; + } + } + breakpointStorage_.erase(id); +} + +std::optional BreakpointStorage::SetBreakpoint(SourceFileFilter &&sourceFilesFilter, size_t lineNumber, + std::set &sourceFiles, + const std::string *condition, + const DebugInfoCache &debugCache) +{ + os::memory::WriteLockHolder lock(lock_); + + auto id = nextBreakpointId_; + std::unique_ptr bbp; + + if (condition == nullptr) { + bbp = std::make_unique(id, std::move(sourceFilesFilter), lineNumber, true); + } else { + bbp = std::make_unique(id, std::move(sourceFilesFilter), lineNumber, condition); + } + + if (!bbp->SetLocations(sourceFiles, debugCache, breakpointLocations_)) { + // Only if many locations for conditional bp, it will be destroyed, no need to increase id. + return std::nullopt; + } + // bp with correct locations, or pending with no locations + ++nextBreakpointId_; + breakpointStorage_[id] = std::move(bbp); + return id; +} + +void BreakpointStorage::Reset() +{ + os::memory::WriteLockHolder lock(lock_); + + breakpointsActive_ = true; + nextBreakpointId_ = 0; + breakpointLocations_.clear(); + breakpointStorage_.clear(); +} + +void BreakpointStorage::SetBreakpointsActive(bool active) +{ + os::memory::WriteLockHolder lock(lock_); + + breakpointsActive_ = active; +} + +std::vector BreakpointStorage::GetBreakpointsByLocation(const PtLocation &location) const +{ + os::memory::ReadLockHolder lock(lock_); + + std::vector hitBreakpoints; + + auto range = breakpointLocations_.equal_range(location); + std::transform(range.first, range.second, std::back_inserter(hitBreakpoints), [](auto &p) { return p.second; }); + + return hitBreakpoints; +} + +void BreakpointStorage::RemoveBreakpoints(const std::function &filter) +{ + os::memory::WriteLockHolder lock(lock_); + + std::vector breakpointsToRemove; + for (const auto &[loc, id] : breakpointLocations_) { + if (filter(loc)) { + breakpointsToRemove.emplace_back(id); + } + } + + for (auto id : breakpointsToRemove) { + for (auto it = breakpointLocations_.begin(); it != breakpointLocations_.end();) { + if (it->second == id) { + it = breakpointLocations_.erase(it); + } else { + ++it; + } + } + breakpointStorage_.erase(id); + } +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/debugger/breakpoint_storage.h b/tooling/static/debugger/breakpoint_storage.h new file mode 100644 index 00000000..36ec95d0 --- /dev/null +++ b/tooling/static/debugger/breakpoint_storage.h @@ -0,0 +1,107 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_BREAKPOINT_STORAGE_H +#define PANDA_TOOLING_INSPECTOR_BREAKPOINT_STORAGE_H + +#include +#include +#include + +#include "breakpoint_base.h" +#include "types/numeric_id.h" + +namespace ark::tooling::inspector { + +/** + * @brief Blocking breakpoint storage class, adds functionality to add/remove/enable/disable breakpoints, + * Allows threads to check if it should stop at location + */ +class BreakpointStorage final { +public: + BreakpointStorage() = default; + + NO_COPY_SEMANTIC(BreakpointStorage); + NO_MOVE_SEMANTIC(BreakpointStorage); + + ~BreakpointStorage() = default; + + /** + * @brief Enable/disable breakpoints + * @param[in] active bool arg + */ + void SetBreakpointsActive(bool active); + + /** + * @brief Get breakpoint id vector by location + * @param[in] location + * @returns std::vector of ids + */ + std::vector GetBreakpointsByLocation(const PtLocation &location) const; + + /** + * @brief Set a breakpoint with optional condition. + * @param[in] sourceFilesFilter handler to filter src files. + * @param[in] lineNumber line in filtered src files. + * @param[out] sourceFiles returns sourceFiles where breakpoint was set + * @param[in] condition code fragment to compiled and evaluated for conditional bp + * @param[in] debugCache debug cache to link src files with bytecode executable + * @returns BreakpointId of set breakpoint. + */ + std::optional SetBreakpoint(SourceFileFilter &&sourceFilesFilter, size_t lineNumber, + std::set &sourceFiles, const std::string *condition, + const DebugInfoCache &debugCache); + + /** + * @brief Removes breakpoint by id + * @param[in] id + */ + void RemoveBreakpoint(BreakpointId id); + + /** + * @brief Check if should stop at location + * @param[in] location + * @param[in] engine to evaluate conditions for conditional breakpoint + * @returns true/false + */ + bool ShouldStopAtBreakpoint(const PtLocation &location, EvaluationEngine &engine); + + /** + * @brief Resolves pending breakpoints on new pandafile load + * @param[in] file loaded file + * @param[in] debugInfoCache debugcache with already added file + */ + void ResolveBreakpoints(const panda_file::File &file, const panda_file::DebugInfoExtractor *debugInfoCache); + + /// @brief Resets storage to empty state + void Reset(); + + /** + * @brief Removes breakpoint by filter function + * @param[in] filter function to apply to every breakpoint + */ + void RemoveBreakpoints(const std::function &filter); + +private: + mutable os::memory::RWLock lock_; + bool breakpointsActive_ GUARDED_BY(lock_) {true}; + BreakpointId nextBreakpointId_ GUARDED_BY(lock_) = 0; + std::unordered_multimap breakpointLocations_ GUARDED_BY(lock_); + std::unordered_map> breakpointStorage_ GUARDED_BY(lock_); +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_BREAKPOINT_STORAGE_H diff --git a/tooling/static/debugger/conditional_breakpoint.cpp b/tooling/static/debugger/conditional_breakpoint.cpp new file mode 100644 index 00000000..e49c80ba --- /dev/null +++ b/tooling/static/debugger/conditional_breakpoint.cpp @@ -0,0 +1,97 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "conditional_breakpoint.h" + +#include "debug_info_extractor.h" +#include "error.h" +#include "evaluation/evaluation_engine.h" + +namespace ark::tooling::inspector { + +bool ConditionalBreakpoint::ShouldStopAt(const PtLocation &location, EvaluationEngine &engine) +{ + if (!location_.has_value() || !(*location_ == location)) { + return false; + } + // Condition is evaluated in the context of top frame + auto evalRes = engine.EvaluateExpression(0, bytecode_, &method_); + if (!evalRes) { + HandleError(evalRes.Error()); + return false; + } + if (evalRes.Value().second != nullptr) { + LOG(WARNING, DEBUGGER) << "Breakpoint #" << GetId() << " condition evaluated with an exception"; + return false; + } + return evalRes.Value().first.GetAsU1(); +} + +bool ConditionalBreakpoint::SetLocations( + std::set &sourceFiles, const DebugInfoCache &debugCache, + std::unordered_multimap &breakpointLocations) +{ + auto locations = debugCache.GetBreakpointLocations(sourceFileFilter_, lineNumber_, sourceFiles); + if (locations.size() > 1) { + LOG(WARNING, DEBUGGER) << "Will not set conditional breakpoint for more than one location"; + return false; + } + + if (locations.empty()) { + LOG(WARNING, DEBUGGER) << "Pending breakpoint, 0 locations resolved currently, id = " << GetId(); + return true; + } + + location_ = *locations.begin(); + breakpointLocations.emplace(location_.value(), GetId()); + Resolve(); + return true; +} + +void ConditionalBreakpoint::TryResolveImpl( + const panda_file::File &file, const panda_file::DebugInfoExtractor *debugInfo, + std::unordered_multimap &breakpointLocations) +{ + if (IsResolved()) { + return; + } + + auto lineHandler = [this, &breakpointLocations](const auto &pandaFile, auto methodId, auto &entry) { + if (entry.line == lineNumber_) { + location_.emplace(pandaFile.GetFilename().data(), methodId, entry.offset); + breakpointLocations.emplace(location_.value(), GetId()); + Resolve(); + // Must choose the first found bytecode location in each method + return false; + } + // Continue search + return true; + }; + + for (const auto &methodId : debugInfo->GetMethodIdList()) { + if (!sourceFileFilter_(debugInfo->GetSourceFile(methodId))) { + continue; + } + + auto &table = debugInfo->GetLineNumberTable(methodId); + for (auto &entry : table) { + if (!lineHandler(file, methodId, entry)) { + break; + } + } + } +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/debugger/conditional_breakpoint.h b/tooling/static/debugger/conditional_breakpoint.h new file mode 100644 index 00000000..aa412f0e --- /dev/null +++ b/tooling/static/debugger/conditional_breakpoint.h @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_CONDITIONAL_BREAKPOINT_H +#define PANDA_TOOLING_INSPECTOR_CONDITIONAL_BREAKPOINT_H + +#include +#include +#include + +#include "breakpoint_base.h" + +namespace ark::tooling::inspector { +class EvaluationEngine; + +/// @brief Conditional breakpoint, allows only one location, condition is evaluated on breakpoint hit +class ConditionalBreakpoint final : public BreakpointBase { +public: + explicit ConditionalBreakpoint(BreakpointId id, SourceFileFilter &&filter, size_t line, const std::string *bytecode) + : BreakpointBase(id), sourceFileFilter_(std::move(filter)), lineNumber_(line), bytecode_(*bytecode) + { + } + + NO_COPY_SEMANTIC(ConditionalBreakpoint); + NO_MOVE_SEMANTIC(ConditionalBreakpoint); + + ~ConditionalBreakpoint() override = default; + + bool SetLocations(std::set &sourceFiles, const DebugInfoCache &debugCache, + std::unordered_multimap &breakpointLocations) override; + + void EnumerateLocations(const std::function &func) override + { + if (location_) { + func(GetId(), *location_); + } + } + + bool ShouldStopAt(const PtLocation &location, EvaluationEngine &engine) override; + +protected: + void TryResolveImpl(const panda_file::File &file, const panda_file::DebugInfoExtractor *debugInfo, + std::unordered_multimap &breakpointLocations) override; + +private: + std::optional location_; + SourceFileFilter sourceFileFilter_; + size_t lineNumber_ {0}; + std::string bytecode_; + Method *method_ {nullptr}; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_CONDITIONAL_BREAKPOINT_H diff --git a/tooling/static/debugger/debug_info_cache.cpp b/tooling/static/debugger/debug_info_cache.cpp new file mode 100644 index 00000000..af65685f --- /dev/null +++ b/tooling/static/debugger/debug_info_cache.cpp @@ -0,0 +1,422 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "debug_info_cache.h" + +#include "debug_info_extractor.h" +#include "include/tooling/pt_location.h" +#include "libpandabase/utils/bit_utils.h" +#include "method_data_accessor.h" +#include "os/mutex.h" + +namespace ark::tooling::inspector { +void DebugInfoCache::AddPandaFile(const panda_file::File &file) +{ + os::memory::LockHolder lock(debugInfosMutex_); + const auto &debugInfo = + debugInfos_ + .emplace(std::piecewise_construct, std::forward_as_tuple(&file), + std::forward_as_tuple(file, + [this, &file](auto methodId, auto sourceName) { + os::memory::LockHolder l(disassembliesMutex_); + disassemblies_.emplace(std::piecewise_construct, + std::forward_as_tuple(sourceName), + std::forward_as_tuple(file, methodId)); + })) + .first->second; + + // For all methods add non-empty source code read from debug-info + for (auto methodId : debugInfo.GetMethodIdList()) { + std::string_view sourceRelativePath = debugInfo.GetSourceFile(methodId); + std::string_view sourceCode = debugInfo.GetSourceCode(methodId); + if (!sourceCode.empty()) { + auto inserted = fileToSourceCode_.try_emplace(sourceRelativePath, sourceCode).second; + if (!inserted) { + LOG(WARNING, DEBUGGER) << "Duplicate source code in debug info for file \"" << sourceRelativePath + << '"'; + } + } + } +} + +void DebugInfoCache::GetSourceLocation(const PtFrame &frame, std::string_view &sourceFile, std::string_view &methodName, + size_t &lineNumber) +{ + auto method = frame.GetMethod(); + auto pandaFile = method->GetPandaFile(); + auto debugInfo = GetDebugInfo(pandaFile); + if (debugInfo == nullptr) { + lineNumber = 1; + return; + } + sourceFile = debugInfo->GetSourceFile(method->GetFileId()); + + methodName = utf::Mutf8AsCString(method->GetName().data); + + // Line number entry corresponding to the bytecode location is + // the last such entry for which the bytecode offset is not greater than + // the given offset. Use `std::upper_bound` to find the first entry + // for which the condition is not true, and then step back. + auto &table = debugInfo->GetLineNumberTable(method->GetFileId()); + auto lineNumberIter = std::upper_bound(table.begin(), table.end(), frame.GetBytecodeOffset(), + [](auto offset, auto &entry) { return offset < entry.offset; }); + ASSERT(lineNumberIter != table.begin()); + lineNumber = std::prev(lineNumberIter)->line; +} + +std::unordered_set DebugInfoCache::GetCurrentLineLocations(const PtFrame &frame) +{ + std::unordered_set locations; + + auto method = frame.GetMethod(); + auto pandaFile = method->GetPandaFile(); + auto methodId = method->GetFileId(); + auto &table = GetDebugInfo(pandaFile)->GetLineNumberTable(methodId); + auto it = std::upper_bound(table.begin(), table.end(), frame.GetBytecodeOffset(), + [](auto offset, auto entry) { return offset < entry.offset; }); + if (it == table.begin()) { + return locations; + } + auto lineNumber = (--it)->line; + + for (it = table.begin(); it != table.end(); ++it) { + if (it->line != lineNumber) { + continue; + } + + auto next = it + 1; + auto nextOffset = next != table.end() ? next->offset : method->GetCodeSize(); + for (auto o = it->offset; o < nextOffset; o++) { + locations.emplace(pandaFile->GetFilename().c_str(), methodId, o); + } + } + + return locations; +} + +std::unordered_set DebugInfoCache::GetContinueToLocations(std::string_view sourceFile, + size_t lineNumber) +{ + std::unordered_set locations; + EnumerateLineEntries( + [](auto, auto &) { return true; }, + [sourceFile](auto, auto &debugInfo, auto methodId) { return debugInfo.GetSourceFile(methodId) == sourceFile; }, + [lineNumber, &locations](auto pandaFile, auto &, auto methodId, auto &entry, auto next) { + if (entry.line != lineNumber) { + // continue enumeration + return true; + } + + uint32_t nextOffset; + if (next == nullptr) { + panda_file::MethodDataAccessor mda(*pandaFile, methodId); + if (auto codeId = mda.GetCodeId()) { + nextOffset = panda_file::CodeDataAccessor(*pandaFile, *codeId).GetCodeSize(); + } else { + nextOffset = 0; + } + } else { + nextOffset = next->offset; + } + + for (auto o = entry.offset; o < nextOffset; o++) { + locations.emplace(pandaFile->GetFilename().data(), methodId, o); + } + return true; + }); + return locations; +} + +std::unordered_set DebugInfoCache::GetBreakpointLocations( + const std::function &sourceFileFilter, size_t lineNumber, + std::set &sourceFiles) const +{ + std::unordered_set locations; + sourceFiles.clear(); + // clang-format off + EnumerateLineEntries( + [](auto, auto &) { return true; }, + [&sourceFileFilter](auto, auto &debugInfo, auto methodId) { + return sourceFileFilter(debugInfo.GetSourceFile(methodId)); + }, + [lineNumber, &sourceFiles, &locations](auto pandaFile, auto &debugInfo, auto methodId, + auto &entry, auto /* next */) { + if (entry.line == lineNumber) { + sourceFiles.insert(debugInfo.GetSourceFile(methodId)); + locations.emplace(pandaFile->GetFilename().data(), methodId, entry.offset); + // Must choose the first found bytecode location in each method + return false; + } + // Continue search + return true; + }); + // clang-format on + return locations; +} + +std::set DebugInfoCache::GetValidLineNumbers(std::string_view sourceFile, size_t startLine, size_t endLine, + bool restrictToFunction) +{ + std::set lineNumbers; + auto lineHandler = [startLine, endLine, &lineNumbers](auto, auto &, auto, auto &entry, auto /* next */) { + if (entry.line >= startLine && entry.line < endLine) { + lineNumbers.insert(entry.line); + } + + return true; + }; + if (!restrictToFunction) { + EnumerateLineEntries([](auto, auto &) { return true; }, + [sourceFile](auto, auto &debugInfo, auto methodId) { + return (debugInfo.GetSourceFile(methodId) == sourceFile); + }, + lineHandler); + return lineNumbers; + } + + auto methodFilter = [sourceFile, startLine](auto, auto &debugInfo, auto methodId) { + if (debugInfo.GetSourceFile(methodId) != sourceFile) { + return false; + } + + bool hasLess = false; + bool hasGreater = false; + for (auto &entry : debugInfo.GetLineNumberTable(methodId)) { + if (entry.line <= startLine) { + hasLess = true; + } + + if (entry.line >= startLine) { + hasGreater = true; + } + + if (hasLess && hasGreater) { + break; + } + } + + return hasLess && hasGreater; + }; + EnumerateLineEntries([](auto, auto &) { return true; }, methodFilter, lineHandler); + return lineNumbers; +} + +// NOLINTBEGIN(readability-magic-numbers) +static TypedValue CreateTypedValueFromReg(uint64_t reg, panda_file::Type::TypeId type) +{ + switch (type) { + case panda_file::Type::TypeId::INVALID: + return TypedValue::Invalid(); + case panda_file::Type::TypeId::VOID: + return TypedValue::Void(); + case panda_file::Type::TypeId::U1: + return TypedValue::U1(static_cast(ExtractBits(reg, 0U, 1U))); + case panda_file::Type::TypeId::I8: + return TypedValue::I8(static_cast(ExtractBits(reg, 0U, 8U))); + case panda_file::Type::TypeId::U8: + return TypedValue::U8(static_cast(ExtractBits(reg, 0U, 8U))); + case panda_file::Type::TypeId::I16: + return TypedValue::I16(static_cast(ExtractBits(reg, 0U, 16U))); + case panda_file::Type::TypeId::U16: + return TypedValue::U16(static_cast(ExtractBits(reg, 0U, 16U))); + case panda_file::Type::TypeId::I32: + return TypedValue::I32(static_cast(ExtractBits(reg, 0U, 32U))); + case panda_file::Type::TypeId::U32: + return TypedValue::U32(static_cast(ExtractBits(reg, 0U, 32U))); + case panda_file::Type::TypeId::F32: + return TypedValue::F32(bit_cast(static_cast(ExtractBits(reg, 0U, 32U)))); + case panda_file::Type::TypeId::F64: + return TypedValue::F64(bit_cast(reg)); + case panda_file::Type::TypeId::I64: + return TypedValue::I64(reg); + case panda_file::Type::TypeId::U64: + return TypedValue::U64(reg); + case panda_file::Type::TypeId::REFERENCE: + return TypedValue::Reference(reinterpret_cast(reg)); + case panda_file::Type::TypeId::TAGGED: + return TypedValue::Tagged(coretypes::TaggedValue(static_cast(reg))); + default: + UNREACHABLE(); + return TypedValue::Invalid(); + } +} +// NOLINTEND(readability-magic-numbers) + +static panda_file::Type::TypeId GetTypeIdBySignature(char signature) +{ + switch (signature) { + case 'V': + return panda_file::Type::TypeId::VOID; + case 'Z': + return panda_file::Type::TypeId::U1; + case 'B': + return panda_file::Type::TypeId::I8; + case 'H': + return panda_file::Type::TypeId::U8; + case 'S': + return panda_file::Type::TypeId::I16; + case 'C': + return panda_file::Type::TypeId::U16; + case 'I': + return panda_file::Type::TypeId::I32; + case 'U': + return panda_file::Type::TypeId::U32; + case 'F': + return panda_file::Type::TypeId::F32; + case 'D': + return panda_file::Type::TypeId::F64; + case 'J': + return panda_file::Type::TypeId::I64; + case 'Q': + return panda_file::Type::TypeId::U64; + case 'A': + return panda_file::Type::TypeId::TAGGED; + case 'L': + case '[': + return panda_file::Type::TypeId::REFERENCE; + default: + return panda_file::Type::TypeId::INVALID; + } +} + +std::map DebugInfoCache::GetLocals(const PtFrame &frame) +{ + std::map result; + + auto localHandler = [&result](const std::string &name, const std::string &signature, uint64_t reg, + PtFrame::RegisterKind kind) { + auto type = signature.empty() ? panda_file::Type::TypeId::INVALID : GetTypeIdBySignature(signature[0]); + if (type == panda_file::Type::TypeId::INVALID) { + switch (kind) { + case PtFrame::RegisterKind::PRIMITIVE: + type = panda_file::Type::TypeId::U64; + break; + case PtFrame::RegisterKind::REFERENCE: + type = panda_file::Type::TypeId::REFERENCE; + break; + case PtFrame::RegisterKind::TAGGED: + type = panda_file::Type::TypeId::TAGGED; + break; + default: + UNREACHABLE(); + break; + } + } + + result.emplace(name, CreateTypedValueFromReg(reg, type)); + }; + + auto method = frame.GetMethod(); + auto methodId = method->GetFileId(); + auto debugInfo = GetDebugInfo(method->GetPandaFile()); + if (debugInfo == nullptr) { + return result; + } + auto ¶meters = debugInfo->GetParameterInfo(methodId); + for (auto i = 0U; i < parameters.size(); i++) { + auto ¶meter = parameters[i]; + localHandler(parameter.name, parameter.signature, frame.GetArgument(i), frame.GetArgumentKind(i)); + } + + auto &variables = debugInfo->GetLocalVariableTable(methodId); + auto frameOffset = frame.GetBytecodeOffset(); + for (auto &variable : variables) { + if (variable.IsAccessibleAt(frameOffset)) { + localHandler(variable.name, variable.typeSignature, + // We introduced a hack in DisasmBackedDebugInfoExtractor, assigning -1 to Accumulator + variable.regNumber == -1 ? frame.GetAccumulator() : frame.GetVReg(variable.regNumber), + variable.regNumber == -1 ? frame.GetAccumulatorKind() : frame.GetVRegKind(variable.regNumber)); + } + } + + return result; +} + +std::string DebugInfoCache::GetSourceCode(std::string_view sourceFile) +{ + { + os::memory::LockHolder lock(disassembliesMutex_); + + auto it = disassemblies_.find(sourceFile); + if (it != disassemblies_.end()) { + return GetDebugInfo(&it->second.first)->GetSourceCode(it->second.second); + } + } + + // Try to get source code read from debug info + { + os::memory::LockHolder lock(debugInfosMutex_); + + auto iter = fileToSourceCode_.find(sourceFile); + if (iter != fileToSourceCode_.end()) { + return std::string(iter->second); + } + } + + if (!os::file::File::IsRegularFile(sourceFile.data())) { + return {}; + } + + std::string result; + + std::stringstream buffer; + buffer << std::ifstream(sourceFile.data()).rdbuf(); + + result = buffer.str(); + if (!result.empty() && result.back() != '\n') { + result += "\n"; + } + + return result; +} + +std::vector DebugInfoCache::GetPandaFiles(const std::function &sourceFileFilter) +{ + std::vector pandaFiles; + // clang-format off + EnumerateLineEntries( + [](auto, auto &) { return true; }, + [&sourceFileFilter](auto, auto &debugInfo, auto methodId) { + return sourceFileFilter(debugInfo.GetSourceFile(methodId)); + }, + [&pandaFiles](const auto *pf, auto &, auto, auto &, auto) { + pandaFiles.emplace_back(pf->GetFilename()); + return false; + }); + // clang-format on + return pandaFiles; +} + +const panda_file::DebugInfoExtractor *DebugInfoCache::GetDebugInfo(const panda_file::File *file) const +{ + os::memory::LockHolder lock(debugInfosMutex_); + auto it = debugInfos_.find(file); + if (it == debugInfos_.end()) { + return nullptr; + } + return &it->second; +} + +const char *DebugInfoCache::GetSourceFile(Method *method) +{ + auto pandaFile = method->GetPandaFile(); + auto debugInfo = GetDebugInfo(pandaFile); + if (debugInfo == nullptr) { + return nullptr; + } + return debugInfo->GetSourceFile(method->GetFileId()); +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/debugger/debug_info_cache.h b/tooling/static/debugger/debug_info_cache.h new file mode 100644 index 00000000..27b8dce3 --- /dev/null +++ b/tooling/static/debugger/debug_info_cache.h @@ -0,0 +1,112 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_DEBUG_INFO_CACHE_H +#define PANDA_TOOLING_INSPECTOR_DEBUG_INFO_CACHE_H + +#include +#include +#include +#include +#include + +#include "disassembler/disasm_backed_debug_info_extractor.h" +#include "include/typed_value.h" +#include "runtime/tooling/debugger.h" + +namespace ark::tooling::inspector { +class DebugInfoCache final { +public: + DebugInfoCache() = default; + ~DebugInfoCache() = default; + + NO_COPY_SEMANTIC(DebugInfoCache); + NO_MOVE_SEMANTIC(DebugInfoCache); + + void AddPandaFile(const panda_file::File &file); + void GetSourceLocation(const PtFrame &frame, std::string_view &sourceFile, std::string_view &methodName, + size_t &lineNumber); + std::unordered_set GetCurrentLineLocations(const PtFrame &frame); + std::unordered_set GetContinueToLocations(std::string_view sourceFile, size_t lineNumber); + std::unordered_set GetBreakpointLocations( + const std::function &sourceFileFilter, size_t lineNumber, + std::set &sourceFiles) const; + std::set GetValidLineNumbers(std::string_view sourceFile, size_t startLine, size_t endLine, + bool restrictToFunction); + + std::map GetLocals(const PtFrame &frame); + + std::string GetSourceCode(std::string_view sourceFile); + + std::vector GetPandaFiles(const std::function &sourceFileFilter); + + const char *GetSourceFile(Method *method); + + const panda_file::DebugInfoExtractor *GetDebugInfo(const panda_file::File *file) const; + +private: + template + void EnumerateLineEntries(PFF &&pandaFileFilter, MF &&methodFilter, H &&handler) const + { + os::memory::LockHolder lock(debugInfosMutex_); + + for (auto &[file, debugInfo] : debugInfos_) { + if (!pandaFileFilter(file, debugInfo)) { + continue; + } + + EnumerateLineEntries(file, debugInfo, std::forward(methodFilter), std::forward(handler)); + } + } + + template + void EnumerateLineEntries(const panda_file::File *file, const disasm::DisasmBackedDebugInfoExtractor &debugInfo, + MF &&methodFilter, H &&handler) const REQUIRES(debugInfosMutex_) + { + for (const auto &methodId : debugInfo.GetMethodIdList()) { + if (!methodFilter(file, debugInfo, methodId)) { + continue; + } + + EnumerateLineEntries(file, debugInfo, methodId, std::forward(handler)); + } + } + + template + void EnumerateLineEntries(const panda_file::File *file, const disasm::DisasmBackedDebugInfoExtractor &debugInfo, + panda_file::File::EntityId methodId, H &&handler) const REQUIRES(debugInfosMutex_) + { + auto &table = debugInfo.GetLineNumberTable(methodId); + for (auto it = table.begin(); it != table.end(); ++it) { + auto next = it + 1; + if (!handler(file, debugInfo, methodId, *it, next != table.end() ? &*next : nullptr)) { + break; + } + } + } + + mutable os::memory::Mutex debugInfosMutex_; + std::unordered_map debugInfos_ + GUARDED_BY(debugInfosMutex_); + + os::memory::Mutex disassembliesMutex_; + std::unordered_map> disassemblies_ + GUARDED_BY(disassembliesMutex_); + + std::unordered_map fileToSourceCode_ GUARDED_BY(debugInfosMutex_); +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_DEBUG_INFO_CACHE_H diff --git a/tooling/static/debugger/debuggable_thread.cpp b/tooling/static/debugger/debuggable_thread.cpp new file mode 100644 index 00000000..c5057449 --- /dev/null +++ b/tooling/static/debugger/debuggable_thread.cpp @@ -0,0 +1,289 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "debuggable_thread.h" + +#include "breakpoint_storage.h" +#include "error.h" +#include "include/method.h" +#include "types/numeric_id.h" + +namespace ark::tooling::inspector { +DebuggableThread::DebuggableThread(ManagedThread *thread, DebugInterface *debugger, SuspensionCallbacks &&callbacks, + BreakpointStorage &bpStorage) + : PtThreadEvaluationEngine(debugger, thread), callbacks_(std::move(callbacks)), state_(*this, bpStorage) +{ +} + +void DebuggableThread::Reset() +{ + os::memory::LockHolder lock(mutex_); + state_.Reset(); +} + +void DebuggableThread::BreakOnStart() +{ + os::memory::LockHolder lock(mutex_); + state_.BreakOnStart(); +} + +void DebuggableThread::Continue() +{ + os::memory::LockHolder lock(mutex_); + state_.Continue(); + Resume(); +} + +void DebuggableThread::ContinueTo(std::unordered_set locations) +{ + os::memory::LockHolder lock(mutex_); + state_.ContinueTo(std::move(locations)); + Resume(); +} + +void DebuggableThread::StepInto(std::unordered_set locations) +{ + os::memory::LockHolder lock(mutex_); + state_.StepInto(std::move(locations)); + Resume(); +} + +void DebuggableThread::StepOver(std::unordered_set locations) +{ + os::memory::LockHolder lock(mutex_); + state_.StepOver(std::move(locations)); + Resume(); +} + +void DebuggableThread::StepOut() +{ + os::memory::LockHolder lock(mutex_); + state_.StepOut(); + Resume(); +} + +bool DebuggableThread::IsPaused() +{ + os::memory::LockHolder lock(mutex_); + return suspended_; +} + +void DebuggableThread::Touch() +{ + os::memory::LockHolder lock(mutex_); + Resume(); +} + +void DebuggableThread::Pause() +{ + os::memory::LockHolder lock(mutex_); + state_.Pause(); +} + +void DebuggableThread::SetSkipAllPauses(bool skip) +{ + os::memory::LockHolder lock(mutex_); + state_.SetSkipAllPauses(skip); +} + +void DebuggableThread::SetMixedDebugEnabled(bool mixedDebugEnabled) +{ + os::memory::LockHolder lock(mutex_); + state_.SetMixedDebugEnabled(mixedDebugEnabled); +} + +void DebuggableThread::SetPauseOnExceptions(PauseOnExceptionsState state) +{ + os::memory::LockHolder lock(mutex_); + state_.SetPauseOnExceptions(state); +} + +bool DebuggableThread::RequestToObjectRepository(std::function request) +{ + os::memory::LockHolder lock(mutex_); + + ASSERT(!request_.has_value()); + + if (!suspended_) { + return false; + } + + ASSERT(GetManagedThread()->IsSuspended()); + + request_ = std::move(request); + GetManagedThread()->Resume(); + + while (request_) { + requestDone_.Wait(&mutex_); + } + + ASSERT(suspended_); + ASSERT(GetManagedThread()->IsSuspended()); + + return true; +} + +Expected>, std::string> DebuggableThread::EvaluateExpression( + uint32_t frameNumber, const ExpressionWrapper &bytecode) +{ + std::optional optResult; + std::optional optException; + std::optional optError; + RequestToObjectRepository( + [this, frameNumber, &bytecode, &optResult, &optException, &optError](ObjectRepository &objectRepo) { + Method *method = nullptr; + auto res = EvaluateExpression(frameNumber, bytecode, &method); + if (!res) { + HandleError(res.Error()); + optError = res.Error(); + return; + } + + auto [result, exc] = res.Value(); + optResult.emplace(objectRepo.CreateObject(result)); + if (exc != nullptr) { + optException.emplace(objectRepo.CreateObject(TypedValue::Reference(exc))); + } + }); + if (optError) { + ASSERT(!optResult); + return Unexpected(optError->GetMessage()); + } + return std::make_pair(*optResult, optException); +} + +void DebuggableThread::OnException(bool uncaught) +{ + if (IsEvaluating()) { + return; + } + os::memory::LockHolder lock(mutex_); + state_.OnException(uncaught); + while (state_.IsPaused()) { + ObjectRepository objectRepository; + Suspend(objectRepository, {}, GetManagedThread()->GetException(), state_.GetPauseReason()); + } +} + +void DebuggableThread::OnFramePop() +{ + if (IsEvaluating()) { + return; + } + os::memory::LockHolder lock(mutex_); + state_.OnFramePop(); +} + +bool DebuggableThread::OnMethodEntry() +{ + if (IsEvaluating()) { + return false; + } + os::memory::LockHolder lock(mutex_); + return state_.OnMethodEntry(); +} + +void DebuggableThread::OnSingleStep(const PtLocation &location, const char *sourceFile) +{ + if (IsEvaluating()) { + return; + } + os::memory::LockHolder lock(mutex_); + state_.OnSingleStep(location, sourceFile); + while (state_.IsPaused()) { + ObjectRepository objectRepository; + auto hitBreakpoints = state_.GetBreakpointsByLocation(location); + Suspend(objectRepository, hitBreakpoints, {}, state_.GetPauseReason()); + } +} + +std::vector DebuggableThread::OnConsoleCall(const PandaVector &arguments) +{ + std::vector result; + + ObjectRepository objectRepository; + std::transform(arguments.begin(), arguments.end(), std::back_inserter(result), + [&objectRepository](auto value) { return objectRepository.CreateObject(value); }); + + return result; +} + +void DebuggableThread::Suspend(ObjectRepository &objectRepository, const std::vector &hitBreakpoints, + ObjectHeader *exception, PauseReason pauseReason) +{ + ASSERT(ManagedThread::GetCurrent() == GetManagedThread()); + + ASSERT(!suspended_); + ASSERT(!request_.has_value()); + + callbacks_.preSuspend(objectRepository, hitBreakpoints, exception); + + suspended_ = true; + GetManagedThread()->Suspend(); + + callbacks_.postSuspend(objectRepository, hitBreakpoints, exception, pauseReason); + + while (suspended_) { + mutex_.Unlock(); + + callbacks_.preWaitSuspension(); + GetManagedThread()->WaitSuspension(); + callbacks_.postWaitSuspension(); + + mutex_.Lock(); + + // We have three levels of suspension: + // - state_.IsPaused() - tells if the thread is paused on breakpoint or step; + // - suspended_ - tells if the thread generally sleeps (but could execute object repository requests); + // - GetManagedThread()->IsSuspended() - tells if the thread is actually sleeping + // + // If we are here, then the latter is false (thread waked up). The following variants are possible: + // - not paused and not suspended - e.g. continue / stepping action was performed; + // - not paused and suspended - invalid; + // - paused and not suspended - touch was performed, resume and sleep back + // (used to notify about the state on `runIfWaitingForDebugger`); + // - paused and suspended - object repository request was made. + + ASSERT(suspended_ == request_.has_value()); + + if (request_) { + (*request_)(objectRepository); + + request_.reset(); + GetManagedThread()->Suspend(); + + requestDone_.Signal(); + } + } +} + +void DebuggableThread::Resume() +{ + ASSERT(!request_.has_value()); + + if (!suspended_) { + return; + } + + ASSERT(GetManagedThread()->IsSuspended()); + + callbacks_.preResume(); + + suspended_ = false; + GetManagedThread()->Resume(); + + callbacks_.postResume(); +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/debugger/debuggable_thread.h b/tooling/static/debugger/debuggable_thread.h new file mode 100644 index 00000000..e3395d20 --- /dev/null +++ b/tooling/static/debugger/debuggable_thread.h @@ -0,0 +1,149 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_DEBUGGABLE_THREAD_H +#define PANDA_TOOLING_INSPECTOR_DEBUGGABLE_THREAD_H + +#include "common.h" +#include "debug_info_cache.h" +#include "include/managed_thread.h" +#include "include/tooling/pt_location.h" + +#include "evaluation/evaluation_engine.h" +#include "object_repository.h" +#include "thread_state.h" +#include "types/numeric_id.h" +#include "types/pause_on_exceptions_state.h" + +namespace ark::tooling::inspector { +/** + * @brief Application thread abstraction. + * Note that private inheritance is used in order not to expose evaluation-related state details. + */ +class DebuggableThread final : private PtThreadEvaluationEngine { +public: + struct SuspensionCallbacks final { + std::function &, ObjectHeader *)> preSuspend; + std::function &, ObjectHeader *, PauseReason)> + postSuspend; + std::function preWaitSuspension; + std::function postWaitSuspension; + std::function preResume; + std::function postResume; + }; + +public: + DebuggableThread(ManagedThread *thread, DebugInterface *debugger, SuspensionCallbacks &&callbacks, + BreakpointStorage &bpStorage); + ~DebuggableThread() override = default; + + NO_COPY_SEMANTIC(DebuggableThread); + NO_MOVE_SEMANTIC(DebuggableThread); + + /// The following methods should be called on the server thread + + // Resets the state on a new connection + void Reset(); + + // Tells a newly created thread to pause on the next step + void BreakOnStart(); + + // Continues execution of a paused thread + void Continue(); + + // Continues execution of a paused thread until it reaches one of the locations + void ContinueTo(std::unordered_set locations); + + // Tells a paused thread to perform a step into + void StepInto(std::unordered_set locations); + + // Tells a paused thread to perform a step over + void StepOver(std::unordered_set locations); + + // Tells a paused thread to perform a step out + void StepOut(); + + // Checks if application thread is currently paused. + // Used by server thread for validation before executing stepping requests. + bool IsPaused(); + + // Makes a paused thread to resume and suspend back (does nothing for running threads). + // Used to notify about thread's state when processing `runIfWaitingForDebugger` + void Touch(); + + // Tells a running thread to pause on the next step + void Pause(); + + // Enables or disables skipping all pauses + void SetSkipAllPauses(bool skip); + + // Enables or disables mixdebug && mixstack + void SetMixedDebugEnabled(bool mixedDebugEnabled); + + // Tells when stops should be made on exceptions + void SetPauseOnExceptions(PauseOnExceptionsState state); + + // Executes a request to object repository on a paused thread (does nothing for running threads) + bool RequestToObjectRepository(std::function request); + + /// The following methods should be called on an application thread + + // Notification that an exception was thrown. Pauses the thread if necessary + void OnException(bool uncaught); + + // Notification that an "interesting" frame was popped + void OnFramePop(); + + // Notification that a new frame was pushed. Returns true if we want to be notified about the frame is popped + // (i.e. the frame is "interesting"), false otherwise + bool OnMethodEntry(); + + // Notification that a next step will be performed. Pauses the thread if necessary + void OnSingleStep(const PtLocation &location, const char *sourceFile); + + // Notification that a call to console was performed. Returns its arguments presented as remote objects + std::vector OnConsoleCall(const PandaVector &arguments); + + /** + * @brief Evaluates the given bytecode expression. + * @param frameNumber frame depth to evaluate expression in. + * @param bytecode fragment with expression. + * @returns pair of result (might be void) and optional exception objects OR error message + */ + Expected>, std::string> EvaluateExpression( + uint32_t frameNumber, const ExpressionWrapper &bytecode); + +private: + using PtThreadEvaluationEngine::EvaluateExpression; + + // Suspends a paused thread. Should be called on an application thread + void Suspend(ObjectRepository &objectRepository, const std::vector &hitBreakpoints, + ObjectHeader *exception, PauseReason pauseReason) REQUIRES(mutex_); + + // Marks a paused thread as not suspended. Should be called on the server thread + void Resume() REQUIRES(mutex_); + +private: + SuspensionCallbacks callbacks_; + + os::memory::Mutex mutex_; + ThreadState state_ GUARDED_BY(mutex_); + bool suspended_ GUARDED_BY(mutex_) {false}; + std::optional> request_ GUARDED_BY(mutex_); + os::memory::ConditionVariable requestDone_ GUARDED_BY(mutex_); +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_DEBUGGABLE_THREAD_H diff --git a/tooling/static/debugger/object_repository.cpp b/tooling/static/debugger/object_repository.cpp new file mode 100644 index 00000000..93b2d41e --- /dev/null +++ b/tooling/static/debugger/object_repository.cpp @@ -0,0 +1,222 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "object_repository.h" + +#include "include/tooling/pt_lang_extension.h" +#include "runtime/handle_scope-inl.h" + +namespace ark::tooling::inspector { +ObjectRepository::ObjectRepository() + : extension_(ManagedThread::GetCurrent()->GetLanguageContext().CreatePtLangExt()), + scope_(ManagedThread::GetCurrent()) +{ +} + +RemoteObject ObjectRepository::CreateGlobalObject() +{ + return RemoteObject::Object("[Global]", GLOBAL_OBJECT_ID, "Global object"); +} + +RemoteObject ObjectRepository::CreateFrameObject(const PtFrame &frame, const std::map &locals, + std::optional &objThis) +{ + ASSERT(ManagedThread::GetCurrent()->GetMutatorLock()->HasLock()); + + std::vector properties; + properties.reserve(locals.size()); + auto thisParamName = extension_->GetThisParameterName(); + for (const auto &[paramName, value] : locals) { + auto obj = CreateObject(value); + if (paramName == thisParamName) { + objThis.emplace(std::move(obj)); + } else { + properties.emplace_back(paramName, std::move(obj)); + } + } + + auto id = counter_++; + frames_.emplace(id, std::move(properties)); + + return RemoteObject::Object("", id, "Frame #" + std::to_string(frame.GetFrameId())); +} + +RemoteObject ObjectRepository::CreateObject(TypedValue value) +{ + ASSERT(ManagedThread::GetCurrent()->GetMutatorLock()->HasLock()); + + switch (value.GetType()) { + case panda_file::Type::TypeId::INVALID: + case panda_file::Type::TypeId::VOID: + return RemoteObject::Undefined(); + case panda_file::Type::TypeId::U1: + return RemoteObject::Boolean(value.GetAsU1()); + case panda_file::Type::TypeId::I8: + return RemoteObject::Number(value.GetAsI8()); + case panda_file::Type::TypeId::U8: + return RemoteObject::Number(value.GetAsU8()); + case panda_file::Type::TypeId::I16: + return RemoteObject::Number(value.GetAsI16()); + case panda_file::Type::TypeId::U16: + return RemoteObject::Number(value.GetAsU16()); + case panda_file::Type::TypeId::I32: + return RemoteObject::Number(value.GetAsI32()); + case panda_file::Type::TypeId::U32: + return RemoteObject::Number(value.GetAsU32()); + case panda_file::Type::TypeId::F32: + return RemoteObject::Number(value.GetAsF32()); + case panda_file::Type::TypeId::F64: + return RemoteObject::Number(value.GetAsF64()); + case panda_file::Type::TypeId::I64: + return RemoteObject::Number(value.GetAsI64()); + case panda_file::Type::TypeId::U64: + return RemoteObject::Number(value.GetAsU64()); + case panda_file::Type::TypeId::REFERENCE: + return CreateObject(value.GetAsReference()); + case panda_file::Type::TypeId::TAGGED: + return CreateObject(value.GetAsTagged()); + } + UNREACHABLE(); +} + +std::vector ObjectRepository::GetProperties(RemoteObjectId id, bool generatePreview) +{ + ASSERT(ManagedThread::GetCurrent()->GetMutatorLock()->HasLock()); + + auto properties = GetProperties(id); + + if (generatePreview) { + for (auto &property : properties) { + if (property.IsAccessor()) { + continue; + } + + RemoteObject &value = property.GetValue(); + auto preview = CreateObjectPreview(value); + if (preview.has_value()) { + value.SetObjectPreview(std::move(*preview)); + } + } + } + + return properties; +} + +std::optional ObjectRepository::CreateObjectPreview(RemoteObject &remobj) +{ + auto valueId = remobj.GetObjectId(); + if (!valueId.has_value()) { + return {}; + } + + ObjectPreview preview(remobj.GetType(), GetProperties(*valueId)); + + return preview; +} + +RemoteObject ObjectRepository::CreateObject(coretypes::TaggedValue value) +{ + if (value.IsHeapObject()) { + return CreateObject(value.GetHeapObject()); + } + if (value.IsUndefined() || value.IsHole()) { + return RemoteObject::Undefined(); + } + if (value.IsNull()) { + return RemoteObject::Null(); + } + if (value.IsBoolean()) { + return RemoteObject::Boolean(value.IsTrue()); + } + if (value.IsInt()) { + return RemoteObject::Number(value.GetInt()); + } + if (value.IsDouble()) { + return RemoteObject::Number(value.GetDouble()); + } + UNREACHABLE(); +} + +RemoteObject ObjectRepository::CreateObject(ObjectHeader *object) +{ + ASSERT(ManagedThread::GetCurrent()->GetMutatorLock()->HasLock()); + + if (object == nullptr) { + return RemoteObject::Null(); + } + + if (auto str = extension_->GetAsString(object)) { + return RemoteObject::String(*str); + } + + RemoteObjectId id; + + // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) + auto it = std::find_if(objects_.begin(), objects_.end(), [object](auto &p) { return p.second.GetPtr() == object; }); + if (it == objects_.end()) { + id = counter_++; + + objects_.emplace(std::piecewise_construct, std::forward_as_tuple(id), + std::forward_as_tuple(ManagedThread::GetCurrent(), object)); + } else { + id = it->first; + } + + // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) + if (auto arrayLen = extension_->GetLengthIfArray(object)) { + // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) + return RemoteObject::Array(extension_->GetClassName(object), *arrayLen, id); + } + + // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) + return RemoteObject::Object(extension_->GetClassName(object), id); +} + +std::vector ObjectRepository::GetProperties(RemoteObjectId id) +{ + ASSERT(ManagedThread::GetCurrent()->GetMutatorLock()->HasLock()); + + auto fIt = frames_.find(id); + if (fIt != frames_.end()) { + ASSERT(objects_.find(id) == objects_.end()); + return fIt->second; + } + + std::vector properties; + auto propertyHandler = [this, &properties](auto &name, auto value, auto isFinal, auto isAccessor) { + auto property = isAccessor ? PropertyDescriptor::Accessor(name, CreateObject(value)) + : PropertyDescriptor(name, CreateObject(value)); + if (!isAccessor && isFinal) { + property.SetWritable(false); + } + properties.emplace_back(std::move(property)); + }; + + if (id == GLOBAL_OBJECT_ID) { + ASSERT(objects_.find(id) == objects_.end()); + extension_->EnumerateGlobals(propertyHandler); + } else { + auto oIt = objects_.find(id); + if (oIt == objects_.end()) { + LOG(INFO, DEBUGGER) << "Unknown object ID " << id; + return {}; + } + + extension_->EnumerateProperties(oIt->second.GetPtr(), propertyHandler); + } + + return properties; +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/debugger/object_repository.h b/tooling/static/debugger/object_repository.h new file mode 100644 index 00000000..1a6bc281 --- /dev/null +++ b/tooling/static/debugger/object_repository.h @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_OBJECT_REPOSITORY_H +#define PANDA_TOOLING_INSPECTOR_OBJECT_REPOSITORY_H + +#include "include/tooling/debug_interface.h" +#include "include/typed_value.h" +#include "os/mutex.h" +#include "runtime/handle_scope.h" + +#include "types/numeric_id.h" +#include "types/property_descriptor.h" + +namespace ark::tooling::inspector { +/** + * All manipulations with an object repository should be made + * on the corresponding application thread with mutator lock held + */ + +class ObjectRepository { +public: + explicit ObjectRepository(); + ~ObjectRepository() = default; + + NO_COPY_SEMANTIC(ObjectRepository); + NO_MOVE_SEMANTIC(ObjectRepository); + + RemoteObject CreateGlobalObject(); + RemoteObject CreateFrameObject(const PtFrame &frame, const std::map &locals, + std::optional &objThis); + RemoteObject CreateObject(TypedValue value); + + std::vector GetProperties(RemoteObjectId id, bool generatePreview); + +private: + static constexpr RemoteObjectId GLOBAL_OBJECT_ID = 0; + + RemoteObject CreateObject(coretypes::TaggedValue value); + RemoteObject CreateObject(ObjectHeader *object); + std::vector GetProperties(RemoteObjectId id); + + std::optional CreateObjectPreview(RemoteObject &remobj); + + std::unique_ptr extension_; + HandleScope scope_; + RemoteObjectId counter_ {GLOBAL_OBJECT_ID + 1}; + std::map> frames_; + std::map> objects_; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_OBJECT_REPOSITORY_H diff --git a/tooling/static/debugger/thread_state.cpp b/tooling/static/debugger/thread_state.cpp new file mode 100644 index 00000000..94554d9c --- /dev/null +++ b/tooling/static/debugger/thread_state.cpp @@ -0,0 +1,247 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "thread_state.h" + +#include +#include +#include + +#include "include/tooling/pt_location.h" +#include "macros.h" +#include "breakpoint.h" +#include "error.h" +#include "types/numeric_id.h" + +namespace ark::tooling::inspector { + +void ThreadState::Reset() +{ + stepKind_ = StepKind::BREAK_ON_START; + stepLocations_.clear(); + methodEntered_ = false; + skipAllPauses_ = false; + mixedDebugEnabled_ = false; + pauseOnExceptionsState_ = PauseOnExceptionsState::NONE; +} + +void ThreadState::BreakOnStart() +{ + if (!paused_) { + stepKind_ = StepKind::BREAK_ON_START; + } + breakOnStart_ = true; +} + +void ThreadState::Continue() +{ + stepKind_ = StepKind::NONE; + paused_ = false; + pauseReason_ = PauseReason::OTHER; +} + +void ThreadState::ContinueTo(std::unordered_set locations) +{ + stepKind_ = StepKind::CONTINUE_TO; + stepLocations_ = std::move(locations); + paused_ = false; + pauseReason_ = PauseReason::OTHER; +} + +void ThreadState::StepInto(std::unordered_set locations) +{ + stepKind_ = StepKind::STEP_INTO; + methodEntered_ = false; + stepLocations_ = std::move(locations); + paused_ = false; + pauseReason_ = PauseReason::STEP; +} + +void ThreadState::StepOver(std::unordered_set locations) +{ + stepKind_ = StepKind::STEP_OVER; + methodEntered_ = false; + stepLocations_ = std::move(locations); + paused_ = false; + pauseReason_ = PauseReason::STEP; +} + +void ThreadState::StepOut() +{ + stepKind_ = StepKind::STEP_OUT; + methodEntered_ = true; + paused_ = false; + pauseReason_ = PauseReason::STEP; +} + +void ThreadState::Pause() +{ + if (!paused_ && !skipAllPauses_) { + stepKind_ = StepKind::PAUSE; + } +} + +void ThreadState::SetSkipAllPauses(bool skip) +{ + skipAllPauses_ = skip; +} + +// NOTE(fangting, #25108): implement "NativeOut" events when in mixed debug mode +void ThreadState::SetMixedDebugEnabled(bool mixedDebugEnabled) +{ + mixedDebugEnabled_ = mixedDebugEnabled; +} + +void ThreadState::SetPauseOnExceptions(PauseOnExceptionsState state) +{ + pauseOnExceptionsState_ = state; +} + +void ThreadState::OnException(bool uncaught) +{ + ASSERT(!paused_); + if (skipAllPauses_) { + return; + } + switch (pauseOnExceptionsState_) { + case PauseOnExceptionsState::NONE: + break; + case PauseOnExceptionsState::CAUGHT: + paused_ = !uncaught; + break; + case PauseOnExceptionsState::UNCAUGHT: + paused_ = uncaught; + break; + case PauseOnExceptionsState::ALL: + paused_ = true; + break; + } + if (paused_) { + pauseReason_ = PauseReason::EXCEPTION; + } +} + +void ThreadState::OnFramePop() +{ + ASSERT(!paused_); + switch (stepKind_) { + case StepKind::NONE: + case StepKind::BREAK_ON_START: + case StepKind::CONTINUE_TO: + case StepKind::PAUSE: + case StepKind::STEP_INTO: { + break; + } + + case StepKind::STEP_OUT: + case StepKind::STEP_OVER: { + methodEntered_ = false; + break; + } + } +} + +bool ThreadState::OnMethodEntry() +{ + ASSERT(!paused_); + switch (stepKind_) { + case StepKind::NONE: + case StepKind::BREAK_ON_START: + case StepKind::CONTINUE_TO: + case StepKind::PAUSE: + case StepKind::STEP_INTO: { + return false; + } + + case StepKind::STEP_OUT: + case StepKind::STEP_OVER: { + return !std::exchange(methodEntered_, true); + } + } + + UNREACHABLE(); +} + +void ThreadState::OnSingleStep(const PtLocation &location, const char *sourceFile) +{ + ASSERT(!paused_); + + if (breakOnStart_) { + std::string_view file = sourceFile; + if (sourceFiles_.find(file) == sourceFiles_.end()) { + sourceFiles_.emplace(file); + stepKind_ = StepKind::BREAK_ON_START; + paused_ = true; + pauseReason_ = PauseReason::BREAK_ON_START; + return; + } + } + + if (ShouldStopAtBreakpoint(location)) { + paused_ = true; + return; + } + + switch (stepKind_) { + case StepKind::NONE: { + paused_ = false; + break; + } + + case StepKind::BREAK_ON_START: { + paused_ = true; + break; + } + + case StepKind::CONTINUE_TO: { + paused_ = stepLocations_.find(location) != stepLocations_.end(); + break; + } + + case StepKind::PAUSE: { + paused_ = true; + break; + } + + case StepKind::STEP_INTO: { + paused_ = stepLocations_.find(location) == stepLocations_.end(); + break; + } + + case StepKind::STEP_OUT: { + paused_ = !methodEntered_; + break; + } + + case StepKind::STEP_OVER: { + paused_ = !methodEntered_ && stepLocations_.find(location) == stepLocations_.end(); + break; + } + } +} + +bool ThreadState::ShouldStopAtBreakpoint(const PtLocation &location) +{ + if (skipAllPauses_) { + return false; + } + return bpStorage_.ShouldStopAtBreakpoint(location, engine_); +} + +std::vector ThreadState::GetBreakpointsByLocation(const PtLocation &location) const +{ + return bpStorage_.GetBreakpointsByLocation(location); +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/debugger/thread_state.h b/tooling/static/debugger/thread_state.h new file mode 100644 index 00000000..b87f7710 --- /dev/null +++ b/tooling/static/debugger/thread_state.h @@ -0,0 +1,131 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_THREAD_STATE_H +#define PANDA_TOOLING_INSPECTOR_THREAD_STATE_H + +#include +#include +#include + +#include "breakpoint.h" +#include "breakpoint_storage.h" +#include "common.h" +#include "debug_info_cache.h" +#include "runtime/tooling/debugger.h" + +#include "include/tooling/debug_interface.h" +#include "types/numeric_id.h" +#include "types/pause_on_exceptions_state.h" + +namespace ark::tooling::inspector { + +class DebuggableThread; + +class ThreadState final { +public: + explicit ThreadState(EvaluationEngine &engine, BreakpointStorage &bpStorage) + : engine_(engine), bpStorage_(bpStorage) + { + } + ~ThreadState() = default; + + NO_COPY_SEMANTIC(ThreadState); + NO_MOVE_SEMANTIC(ThreadState); + + bool IsPaused() const + { + return paused_; + } + + std::vector GetBreakpointsByLocation(const PtLocation &location) const; + + void Reset(); + void BreakOnStart(); + void Continue(); + void ContinueTo(std::unordered_set locations); + void StepInto(std::unordered_set locations); + void StepOver(std::unordered_set locations); + void StepOut(); + void Pause(); + void SetSkipAllPauses(bool skip); + void SetMixedDebugEnabled(bool mixedDebugEnabled); + void SetPauseOnExceptions(PauseOnExceptionsState state); + + void OnException(bool uncaught); + void OnFramePop(); + bool OnMethodEntry(); + void OnSingleStep(const PtLocation &location, const char *sourceFile); + + PauseReason GetPauseReason() const + { + return pauseReason_; + } + +private: + enum class StepKind { + // Just continue execution + NONE, + + // Stop on the next step event. It is not reset to NONE during resetting the state on a new connection + BREAK_ON_START, + + // Continue execution until one of the specified locations is reached + CONTINUE_TO, + + // Stop on the next step event + PAUSE, + + // Continue execution until one of the locations, other than the current line, is reached + STEP_INTO, + + // Continue execution until the current frame is popped + STEP_OUT, + + // Continue execution until both: + // - The call frame is not a child to the starting position (e.g. we have not entered some method); + // - One of the locations, other than the current line, is reached. + STEP_OVER + }; + +private: + bool ShouldStopAtBreakpoint(const PtLocation &location); + +private: + StepKind stepKind_ {StepKind::NONE}; + + // The set of locations has different semantics for various kinds of stepping: + // - for CONTINUE_TO it contains the set of locations we should reach to end the step; + // - for STEP_INTO and STEP_OVER it contains the set of locations corresponding to the current line + // (then, the locations we should leave to end the step). + std::unordered_set stepLocations_; + + bool methodEntered_ {false}; + + EvaluationEngine &engine_; + BreakpointStorage &bpStorage_; + + PauseOnExceptionsState pauseOnExceptionsState_ {PauseOnExceptionsState::NONE}; + + bool paused_ {false}; + bool skipAllPauses_ {false}; + bool mixedDebugEnabled_ {false}; + bool breakOnStart_ {false}; + std::set sourceFiles_; + PauseReason pauseReason_ {PauseReason::OTHER}; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_THREAD_STATE_H diff --git a/tooling/static/debugger_arkapi.cpp b/tooling/static/debugger_arkapi.cpp new file mode 100644 index 00000000..89d9e89c --- /dev/null +++ b/tooling/static/debugger_arkapi.cpp @@ -0,0 +1,88 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "debugger_arkapi.h" +#include "runtime/include/panda_vm.h" + +namespace ark { +bool ArkDebugNativeAPI::NotifyDebugMode([[maybe_unused]] int tid, [[maybe_unused]] int32_t instanceId, + [[maybe_unused]] bool debugApp) +{ + LOG(INFO, DEBUGGER) << "ArkDebugNativeAPI::NotifyDebugMode, tid = " << tid << ", debugApp = " << debugApp + << ", instanceId = " << instanceId; + if ((!debugApp) || (!Runtime::GetOptions().IsDebuggerEnable())) { + return true; + } + + auto loadRes = os::library_loader::Load(Runtime::GetOptions().GetDebuggerLibraryPath()); + if (!loadRes) { + LOG(ERROR, DEBUGGER) << "Load library fail: " << Runtime::GetOptions().GetDebuggerLibraryPath() << " " << errno; + return false; + } + os::library_loader::LibraryHandle handle = std::move(loadRes.Value()); + + Runtime::GetCurrent()->SetDebugMode(true); + + using WaitForDebugger = void (*)(); + auto symOfWaitForDebugger = os::library_loader::ResolveSymbol(handle, "WaitForDebugger"); + if (!symOfWaitForDebugger) { + LOG(ERROR, DEBUGGER) << "Resolve symbol WaitForDebugger fail: " << symOfWaitForDebugger.Error().ToString(); + return false; + } + reinterpret_cast(symOfWaitForDebugger.Value())(); + + return true; +} + +bool ArkDebugNativeAPI::StopDebugger() +{ + LOG(INFO, DEBUGGER) << "ArkDebugNativeAPI::StopDebugger"; + + ark::Runtime::GetCurrent()->SetDebugMode(false); + return true; +} + +bool ArkDebugNativeAPI::StartDebuggerForSocketPair([[maybe_unused]] int tid, [[maybe_unused]] int socketfd) +{ + LOG(INFO, DEBUGGER) << "ArkDebugNativeAPI::StartDebuggerForSocketPair, tid = " << tid; + + auto loadRes = os::library_loader::Load(Runtime::GetOptions().GetDebuggerLibraryPath()); + if (!loadRes) { + LOG(ERROR, DEBUGGER) << "Load library fail: " << Runtime::GetOptions().GetDebuggerLibraryPath() << " " << errno; + return false; + } + os::library_loader::LibraryHandle handle = std::move(loadRes.Value()); + + using StartDebuggerForSocketpair = bool (*)(int, bool); + auto sym = os::library_loader::ResolveSymbol(handle, "StartDebuggerForSocketpair"); + if (!sym) { + LOG(ERROR, DEBUGGER) << "[StartDebuggerForSocketPair] Resolve symbol fail: " << sym.Error().ToString(); + return false; + } + bool breakOnStart = Runtime::GetOptions().IsDebuggerBreakOnStart(); + bool ret = reinterpret_cast(sym.Value())(socketfd, breakOnStart); + if (!ret) { + // Reset the config + ark::Runtime::GetCurrent()->SetDebugMode(false); + } + return ret; +} +bool ArkDebugNativeAPI::IsDebugModeEnabled() +{ + LOG(INFO, DEBUGGER) << "ArkDebugNativeAPI::IsDebugModeEnabled is " << ark::Runtime::GetCurrent()->IsDebugMode(); + + return ark::Runtime::GetCurrent()->IsDebugMode(); +} +} // namespace ark diff --git a/tooling/static/debugger_arkapi.h b/tooling/static/debugger_arkapi.h new file mode 100644 index 00000000..af3039ea --- /dev/null +++ b/tooling/static/debugger_arkapi.h @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_DEBUGGER_ARKAPI_H +#define PANDA_DEBUGGER_ARKAPI_H + +#include +#include + +#include "libpandabase/macros.h" + +namespace ark { +class PANDA_PUBLIC_API ArkDebugNativeAPI final { +public: + using DebuggerPostTask = std::function &&)>; + + static bool StartDebuggerForSocketPair(int tid, int socketfd = -1); + static bool NotifyDebugMode(int tid, int32_t instanceId = 0, bool debugApp = false); + static bool StopDebugger(); + static bool IsDebugModeEnabled(); + + ArkDebugNativeAPI() = delete; + ~ArkDebugNativeAPI() = delete; + + NO_COPY_SEMANTIC(ArkDebugNativeAPI); + NO_MOVE_SEMANTIC(ArkDebugNativeAPI); +}; + +} // namespace ark + +#endif // PANDA_DEBUGGER_ARKAPI_H diff --git a/tooling/static/error.cpp b/tooling/static/error.cpp new file mode 100644 index 00000000..7ed13ada --- /dev/null +++ b/tooling/static/error.cpp @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "error.h" + +#include "utils/logger.h" + +namespace ark::tooling::inspector { +bool HandleError(std::optional &&error) +{ + if (error) { + LOG(ERROR, DEBUGGER) << error->GetMessage(); + return false; + } + return true; +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/error.h b/tooling/static/error.h new file mode 100644 index 00000000..75aa0e29 --- /dev/null +++ b/tooling/static/error.h @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_ERROR_H +#define PANDA_TOOLING_INSPECTOR_ERROR_H + +#include "include/tooling/debug_interface.h" + +#include + +namespace ark::tooling::inspector { +bool HandleError(std::optional &&error); +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_ERROR_H diff --git a/tooling/static/evaluation/base64.h b/tooling/static/evaluation/base64.h new file mode 100644 index 00000000..0b10e679 --- /dev/null +++ b/tooling/static/evaluation/base64.h @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_EVALUATION_BASE64_H +#define PANDA_TOOLING_INSPECTOR_EVALUATION_BASE64_H + +#include +#include +#include + +#include "libpandabase/macros.h" +#include "libpandabase/utils/span.h" + +namespace ark::tooling::inspector { +class Base64Decoder final { +public: + Base64Decoder() = delete; + + static std::optional DecodedSize(Span input) + { + if (input.empty() || input.size() % ENCODED_GROUP_BYTES != 0) { + return {}; + } + + auto sz = input.size() / ENCODED_GROUP_BYTES * DECODED_GROUP_BYTES; + auto last = input.end() - 1; + for (size_t i = 0; i < MAX_PADDINGS && *last == PADDING_CHAR; ++i, --last) { + --sz; + } + return sz; + } + + static bool Decode(const std::string &encoded, std::string &decoded) + { + ASSERT(!encoded.empty()); + + auto sz = encoded.size(); + Span encodingInput(reinterpret_cast(encoded.c_str()), sz); + auto bytecodeSize = Base64Decoder::DecodedSize(encodingInput); + if (!bytecodeSize) { + return false; + } + decoded.resize(*bytecodeSize); + return Base64Decoder::Decode(reinterpret_cast(decoded.data()), encodingInput); + } + + static bool Decode(uint8_t *output, Span input) + { + ASSERT(output); + + if (input.empty() || input.size() % ENCODED_GROUP_BYTES != 0) { + return false; + } + + std::array decodingBuffer = {0}; + size_t baseIdx = 0; + auto srcIter = input.begin(); + for (auto endIter = input.end(); srcIter != endIter && *srcIter != PADDING_CHAR; ++srcIter) { + auto decoded = DecodeChar(*srcIter); + if (decoded == INVALID_VALUE) { + return false; + } + decodingBuffer[baseIdx++] = decoded; + + if (baseIdx == ENCODED_GROUP_BYTES) { + DecodeSextetsGroup(decodingBuffer, Span(output, DECODED_GROUP_BYTES)); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + output += DECODED_GROUP_BYTES; + baseIdx = 0; + } + } + + if (baseIdx != 0) { + // Decode the remainder part. + std::array decodedRemainder = {0}; + DecodeSextetsGroup(decodingBuffer, Span(decodedRemainder.data(), DECODED_GROUP_BYTES)); + for (size_t idx = 0, end = baseIdx - 1; idx < end; ++idx) { + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + *output++ = decodedRemainder[idx]; + } + } + + // Only padding symbols could remain. + // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic) + auto remainder = input.end() - srcIter; + return (remainder == 0 || (remainder == 1 && *srcIter == PADDING_CHAR) || + (remainder == MAX_PADDINGS && *srcIter == PADDING_CHAR && *(srcIter + 1) == PADDING_CHAR)); + // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic) + } + +private: + static constexpr size_t DECODED_GROUP_BYTES = 3; + static constexpr size_t ENCODED_GROUP_BYTES = 4; + +private: + static uint8_t DecodeChar(uint8_t encoded) + { + if (encoded >= DECODE_TABLE.size()) { + return INVALID_VALUE; + } + return DECODE_TABLE[encoded]; + } + + /// @brief Converts 4 sextets into 3 output bytes. + static void DecodeSextetsGroup(const std::array &decodingBuffer, Span output) + { + // 0b00110000 + static constexpr uint8_t FOURTH_TO_FIFTH_BITS = 0x30U; + // 0b00111100 + static constexpr uint8_t SECOND_TO_FIFTH_BITS = 0x3CU; + static constexpr uint8_t TWO_BITS_SHIFT = 2U; + static constexpr uint8_t FOUR_BITS_SHIFT = 4U; + static constexpr uint8_t SIX_BITS_SHIFT = 6U; + + ASSERT(output.size() == DECODED_GROUP_BYTES); + // NOLINTBEGIN(hicpp-signed-bitwise) + output[0UL] = + (decodingBuffer[0UL] << TWO_BITS_SHIFT) | ((decodingBuffer[1UL] & FOURTH_TO_FIFTH_BITS) >> FOUR_BITS_SHIFT); + output[1UL] = + (decodingBuffer[1UL] << FOUR_BITS_SHIFT) | ((decodingBuffer[2UL] & SECOND_TO_FIFTH_BITS) >> TWO_BITS_SHIFT); + output[2UL] = (decodingBuffer[2UL] << SIX_BITS_SHIFT) | decodingBuffer[3UL]; + // NOLINTEND(hicpp-signed-bitwise) + } + +private: + static constexpr size_t MAX_PADDINGS = 2U; + static constexpr uint8_t PADDING_CHAR = '='; + static constexpr uint8_t INVALID_VALUE = 255U; + static constexpr std::array DECODE_TABLE = { + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 62, 255, 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255, 255, 255, + 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51}; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_EVALUATION_BASE64_H diff --git a/tooling/static/evaluation/evaluation_engine.cpp b/tooling/static/evaluation/evaluation_engine.cpp new file mode 100644 index 00000000..1e735729 --- /dev/null +++ b/tooling/static/evaluation/evaluation_engine.cpp @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "evaluation/evaluation_engine.h" + +#include "include/tooling/pt_thread.h" + +namespace ark::tooling::inspector { +Expected, Error> PtThreadEvaluationEngine::EvaluateExpression( + uint32_t frameNumber, const ExpressionWrapper &bytecode, Method **method) +{ + ASSERT(!IsEvaluating()); + ASSERT(method != nullptr); + + VRegValue result; + std::optional err; + + evaluating_ = true; + if (*method != nullptr) { + err = debugger_->EvaluateExpression(PtThread(thread_), frameNumber, *method, &result); + } else { + err = debugger_->EvaluateExpression(PtThread(thread_), frameNumber, bytecode, method, &result); + } + evaluating_ = false; + + if (err) { + return Unexpected(*err); + } + ASSERT(*method != nullptr); + + auto *exception = thread_->GetException(); + // Current implementation must clear any occurred exceptions + if (exception != nullptr) { + thread_->SetException(nullptr); + } + + return std::make_pair(result.ToTypedValue((*method)->GetReturnType().GetId()), exception); +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/evaluation/evaluation_engine.h b/tooling/static/evaluation/evaluation_engine.h new file mode 100644 index 00000000..33b36753 --- /dev/null +++ b/tooling/static/evaluation/evaluation_engine.h @@ -0,0 +1,81 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_EVALUATION_EVALUATION_ENGINE_H +#define PANDA_TOOLING_INSPECTOR_EVALUATION_EVALUATION_ENGINE_H + +#include "include/managed_thread.h" +#include "include/object_header.h" +#include "include/tooling/debug_interface.h" + +namespace ark::tooling::inspector { +class EvaluationEngine { +public: + EvaluationEngine() = default; + + NO_COPY_SEMANTIC(EvaluationEngine); + NO_MOVE_SEMANTIC(EvaluationEngine); + + virtual ~EvaluationEngine() = default; + + virtual Expected, Error> EvaluateExpression(uint32_t frameNumber, + const ExpressionWrapper &bytecode, + Method **method) = 0; +}; + +/// @brief Class provides debugger-based evaluation within the given application thread. +class PtThreadEvaluationEngine : public EvaluationEngine { +public: + explicit PtThreadEvaluationEngine(DebugInterface *debugger, ManagedThread *thread) + : debugger_(debugger), thread_(thread) + { + ASSERT(debugger_ != nullptr); + ASSERT(thread_ != nullptr); + } + + NO_COPY_SEMANTIC(PtThreadEvaluationEngine); + NO_MOVE_SEMANTIC(PtThreadEvaluationEngine); + + ~PtThreadEvaluationEngine() override = default; + + ManagedThread *GetManagedThread() + { + return thread_; + } + + bool IsEvaluating() const + { + return evaluating_; + } + + /** + * @brief Evaluates the given bytecode expression. + * @param frameNumber frame depth to evaluate expression in. + * @param bytecode fragment with expression. + * @param method pointer either providing the previously loaded method or used for storing the expression method. + * @returns pair of result and raised exception or an error. + */ + Expected, Error> EvaluateExpression(uint32_t frameNumber, + const ExpressionWrapper &bytecode, + Method **method) final; + +private: + DebugInterface *debugger_; + ManagedThread *thread_; + bool evaluating_ {false}; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_EVALUATION_EVALUATION_ENGINE_H diff --git a/tooling/static/init.cpp b/tooling/static/init.cpp new file mode 100644 index 00000000..ae58884a --- /dev/null +++ b/tooling/static/init.cpp @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#ifdef PANDA_TOOLING_ASIO +#include "connection/asio/asio_server.h" +#else +#include "connection/ohos_ws/ohos_ws_server.h" +#endif // PANDA_TOOLING_ASIO + +#include "inspector.h" + +namespace ark::tooling { +class DebugInterface; +} // namespace ark::tooling + +#ifdef PANDA_TOOLING_ASIO +using InspectorWebSocketServer = ark::tooling::inspector::AsioServer; +#else +using InspectorWebSocketServer = ark::tooling::inspector::OhosWsServer; +#endif // PANDA_TOOLING_ASIO + +// NOLINTNEXTLINE(fuchsia-statically-constructed-objects) +static ark::Runtime::DebugSessionHandle g_debugSession; + +// NOLINTNEXTLINE(fuchsia-statically-constructed-objects) +static InspectorWebSocketServer g_server; + +// NOLINTNEXTLINE(fuchsia-statically-constructed-objects) +static std::optional g_inspector; + +extern "C" int StartDebugger(uint32_t port, bool breakOnStart) +{ + if (g_inspector) { + LOG(ERROR, DEBUGGER) << "Debugger has already been started"; + return 1; + } + + if (!g_server.Start(port)) { + return 1; + } + + g_debugSession = ark::Runtime::GetCurrent()->StartDebugSession(); + g_inspector.emplace(g_server, g_debugSession->GetDebugger(), breakOnStart); + g_inspector->Run(); + return 0; +} + +extern "C" int StopDebugger() +{ + if (!g_inspector) { + LOG(ERROR, DEBUGGER) << "Debugger has not been started"; + return 1; + } + + if (!g_server.Stop()) { + return 1; + } + g_inspector.reset(); + g_debugSession.reset(); + return 0; +} + +extern "C" bool StartDebuggerForSocketpair(int socketfd, bool breakOnStart) +{ + if (g_inspector) { + g_server.Stop(); + g_inspector->Stop(); + } + + if (!g_server.StartForSocketpair(socketfd)) { + return false; + } + + if (!g_inspector) { + g_debugSession = ark::Runtime::GetCurrent()->StartDebugSession(); + g_inspector.emplace(g_server, g_debugSession->GetDebugger(), breakOnStart); + } + + g_inspector->Run(); + return true; +} + +extern "C" void WaitForDebugger() +{ + if (!g_inspector) { + LOG(ERROR, DEBUGGER) << "Debugger has not been started"; + return; + } + + g_inspector->WaitForDebugger(); +} diff --git a/tooling/static/inspector.cpp b/tooling/static/inspector.cpp new file mode 100644 index 00000000..561aa6a2 --- /dev/null +++ b/tooling/static/inspector.cpp @@ -0,0 +1,819 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "inspector.h" + +#include +#include +#include +#include + +#include "debugger/breakpoint.h" +#include "macros.h" +#include "os/mutex.h" +#include "runtime.h" +#include "utils/logger.h" + +#include "error.h" +#include "evaluation/base64.h" +#include "sampler/sampling_profiler.h" +#include "types/remote_object.h" +#include "types/scope.h" + +using namespace std::placeholders; // NOLINT(google-build-using-namespace) + +namespace ark::tooling::inspector { +static void LogDebuggerNotPaused(std::string_view methodName) +{ + LOG(WARNING, DEBUGGER) << "Inspector method '" << methodName << "' must be called on pause"; +} + +Inspector::Inspector(Server &server, DebugInterface &debugger, bool breakOnStart) + : breakOnStart_(breakOnStart), inspectorServer_(server), debugger_(debugger) +{ + if (!HandleError(debugger_.RegisterHooks(this))) { + return; + } + + // acquire lock to later release it either in `OnOpen` or `OnFail` callbacks + inspectorServer_.OnValidate([this]() NO_THREAD_SAFETY_ANALYSIS { + ASSERT(!connecting_); // NOLINT(bugprone-lambda-function-name) + debuggerEventsLock_.WriteLock(); + connecting_ = true; + }); + inspectorServer_.OnOpen([this]() NO_THREAD_SAFETY_ANALYSIS { + ASSERT(connecting_); // NOLINT(bugprone-lambda-function-name) + connecting_ = false; + debuggerEventsLock_.Unlock(); + }); + inspectorServer_.OnFail([this]() NO_THREAD_SAFETY_ANALYSIS { + if (connecting_) { + connecting_ = false; + debuggerEventsLock_.Unlock(); + } + }); + + RegisterMethodHandlers(); +} + +Inspector::~Inspector() +{ + // Current implementation destroys `Inspector` after server connection is closed, + // hence no need to notify client + inspectorServer_.Kill(); + serverThread_.join(); + HandleError(debugger_.UnregisterHooks()); +} + +void Inspector::CollectModules() +{ + os::memory::ReadLockHolder lock(debuggerEventsLock_); + Runtime::GetCurrent()->GetClassLinker()->EnumeratePandaFiles([this](auto &file) { + debugInfoCache_.AddPandaFile(file); + // Do not call server, cause no connection at this stage + return true; + }); +} + +void Inspector::Run() +{ + CollectModules(); + + serverThread_ = std::thread(&InspectorServer::Run, &inspectorServer_); + os::thread::SetThreadName(serverThread_.native_handle(), "InspectorServer"); +} + +void Inspector::Stop() +{ + serverThread_.join(); +} + +void Inspector::ConsoleCall(PtThread thread, ConsoleCallType type, uint64_t timestamp, + const PandaVector &arguments) +{ + os::memory::ReadLockHolder lock(debuggerEventsLock_); + + auto *debuggableThread = GetDebuggableThread(thread); + ASSERT(debuggableThread != nullptr); + inspectorServer_.CallRuntimeConsoleApiCalled(thread, type, timestamp, debuggableThread->OnConsoleCall(arguments)); +} + +// CC-OFFNXT(G.FUN.01-CPP) Decreasing the number of arguments will decrease the clarity of the code. +void Inspector::Exception(PtThread thread, Method * /* method */, const PtLocation & /* location */, + ObjectHeader * /* exception */, Method * /* catch_method */, const PtLocation &catchLocation) +{ + os::memory::ReadLockHolder lock(debuggerEventsLock_); + + auto *debuggableThread = GetDebuggableThread(thread); + ASSERT(debuggableThread != nullptr); + debuggableThread->OnException(catchLocation.GetBytecodeOffset() == panda_file::INVALID_OFFSET); +} + +void Inspector::FramePop(PtThread thread, Method * /* method */, bool /* was_popped_by_exception */) +{ + os::memory::ReadLockHolder lock(debuggerEventsLock_); + + auto *debuggableThread = GetDebuggableThread(thread); + ASSERT(debuggableThread != nullptr); + debuggableThread->OnFramePop(); +} + +void Inspector::MethodEntry(PtThread thread, Method * /* method */) +{ + os::memory::ReadLockHolder lock(debuggerEventsLock_); + + auto *debuggableThread = GetDebuggableThread(thread); + ASSERT(debuggableThread != nullptr); + if (debuggableThread->OnMethodEntry()) { + HandleError(debugger_.NotifyFramePop(thread, 0)); + } +} + +void Inspector::SourceNameInsert(const panda_file::DebugInfoExtractor *extractor) +{ + const auto &methodList = extractor->GetMethodIdList(); + std::unordered_set sourceNames; + for (const auto &method : methodList) { + sourceNames.insert(extractor->GetSourceFile(method)); + } + for (const auto &sourceName : sourceNames) { + // Get src file name + auto scriptId = inspectorServer_.GetSourceManager().GetScriptId(sourceName); + inspectorServer_.CallDebuggerScriptParsed(scriptId, sourceName); + } +} + +void Inspector::LoadModule(std::string_view fileName) +{ + os::memory::ReadLockHolder lock(debuggerEventsLock_); + + Runtime::GetCurrent()->GetClassLinker()->EnumeratePandaFiles( + [this, fileName](auto &file) { + if (file.GetFilename() == fileName) { + debugInfoCache_.AddPandaFile(file); + const auto *extractor = debugInfoCache_.GetDebugInfo(&file); + SourceNameInsert(extractor); + ResolveBreakpoints(file, extractor); + } + + return true; + }, + !fileName.empty()); +} + +void Inspector::ResolveBreakpoints(const panda_file::File &file, const panda_file::DebugInfoExtractor *debugInfo) +{ + breakpointStorage_.ResolveBreakpoints(file, debugInfo); +} + +void Inspector::SingleStep(PtThread thread, Method *method, const PtLocation &location) +{ + os::memory::ReadLockHolder lock(debuggerEventsLock_); + + auto sourceFile = debugInfoCache_.GetSourceFile(method); + // NOTE(fangting, #IC98Z2): etsstdlib.ets should not call loadModule in pytest. + if ((sourceFile == nullptr) || (strcmp(sourceFile, "etsstdlib.ets") == 0)) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + ASSERT(debuggableThread != nullptr); + debuggableThread->OnSingleStep(location, sourceFile); +} + +void Inspector::ThreadStart(PtThread thread) +{ + os::memory::ReadLockHolder lock(debuggerEventsLock_); + + if (thread != PtThread::NONE) { + inspectorServer_.CallTargetAttachedToTarget(thread); + } + + // NOLINTBEGIN(modernize-avoid-bind) + auto callbacks = DebuggableThread::SuspensionCallbacks { + [](auto &, auto &, auto) {}, + std::bind(&Inspector::DebuggableThreadPostSuspend, this, thread, _1, _2, _3, _4), + [this]() NO_THREAD_SAFETY_ANALYSIS { debuggerEventsLock_.Unlock(); }, + [this]() NO_THREAD_SAFETY_ANALYSIS { debuggerEventsLock_.ReadLock(); }, + []() {}, + [this, thread]() { inspectorServer_.CallDebuggerResumed(thread); }}; + // NOLINTEND(modernize-avoid-bind) + auto [it, inserted] = threads_.emplace( + std::piecewise_construct, std::forward_as_tuple(thread), + std::forward_as_tuple(thread.GetManagedThread(), &debugger_, std::move(callbacks), breakpointStorage_)); + (void)inserted; + ASSERT(inserted); + + if (breakOnStart_) { + it->second.BreakOnStart(); + } +} + +void Inspector::ThreadEnd(PtThread thread) +{ + os::memory::ReadLockHolder lock(debuggerEventsLock_); + + if (thread != PtThread::NONE) { + inspectorServer_.CallTargetDetachedFromTarget(thread); + } + + [[maybe_unused]] auto erased = threads_.erase(thread); + ASSERT(erased == 1); +} + +void Inspector::VmDeath() +{ + os::memory::WriteLockHolder lock(vmDeathLock_); + + ASSERT(!isVmDead_); + isVmDead_ = true; + + NotifyExecutionEnded(); +} + +void Inspector::RuntimeEnable(PtThread thread) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + inspectorServer_.CallRuntimeExecutionContextCreated(thread); +} + +void Inspector::RunIfWaitingForDebugger(PtThread thread) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + debuggableThread->Touch(); + } + + os::memory::LockHolder lockHolder(waitDebuggerMutex_); + waitDebuggerCond_.Signal(); +} + +void Inspector::WaitForDebugger() +{ + os::memory::LockHolder lock(waitDebuggerMutex_); + waitDebuggerCond_.Wait(&waitDebuggerMutex_); +} + +void Inspector::Pause(PtThread thread) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + debuggableThread->Pause(); + } +} + +void Inspector::Continue(PtThread thread) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + debuggableThread->Continue(); + } +} + +void Inspector::SetBreakpointsActive([[maybe_unused]] PtThread thread, bool active) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + breakpointStorage_.SetBreakpointsActive(active); +} + +void Inspector::SetSkipAllPauses(PtThread thread, bool skip) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + debuggableThread->SetSkipAllPauses(skip); + } +} + +void Inspector::SetMixedDebugEnabled(PtThread thread, bool mixedDebugEnabled) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + debuggableThread->SetMixedDebugEnabled(mixedDebugEnabled); + } +} + +std::set Inspector::GetPossibleBreakpoints(std::string_view sourceFile, size_t startLine, size_t endLine, + bool restrictToFunction) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return {}; + } + + return debugInfoCache_.GetValidLineNumbers(sourceFile, startLine, endLine, restrictToFunction); +} + +std::optional Inspector::SetBreakpoint([[maybe_unused]] PtThread thread, + SourceFileFilter &&sourceFilesFilter, size_t lineNumber, + std::set &sourceFiles, + const std::string *condition) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return {}; + } + + std::string optBytecode; + if (condition != nullptr) { + if (condition->empty()) { + // Some debugger clients send empty condition by default + condition = nullptr; + } else { + Base64Decoder::Decode(*condition, optBytecode); + condition = &optBytecode; + } + } + + return breakpointStorage_.SetBreakpoint(std::move(sourceFilesFilter), lineNumber, sourceFiles, condition, + debugInfoCache_); +} + +void Inspector::RemoveBreakpoint([[maybe_unused]] PtThread thread, BreakpointId id) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + breakpointStorage_.RemoveBreakpoint(id); +} + +void Inspector::RemoveBreakpoints(PtThread thread, const SourceFileFilter &sourceFilesFilter) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread == nullptr) { + return; + } + auto pandaFilesPaths = debugInfoCache_.GetPandaFiles(sourceFilesFilter); + if (pandaFilesPaths.empty()) { + return; + } + + breakpointStorage_.RemoveBreakpoints([pfs = std::as_const(pandaFilesPaths)](const auto &loc) { + for (const auto &pf : pfs) { + if (pf == loc.GetPandaFile()) { + return true; + } + } + return false; + }); +} + +void Inspector::SetPauseOnExceptions(PtThread thread, PauseOnExceptionsState state) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + debuggableThread->SetPauseOnExceptions(state); + } +} + +void Inspector::StepInto(PtThread thread) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + if (UNLIKELY(!debuggableThread->IsPaused())) { + LogDebuggerNotPaused("stepInto"); + return; + } + + auto frame = debugger_.GetCurrentFrame(thread); + if (!frame) { + HandleError(frame.Error()); + return; + } + + debuggableThread->StepInto(debugInfoCache_.GetCurrentLineLocations(*frame.Value())); + } +} + +void Inspector::StepOver(PtThread thread) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + if (UNLIKELY(!debuggableThread->IsPaused())) { + LogDebuggerNotPaused("stepOver"); + return; + } + + auto frame = debugger_.GetCurrentFrame(thread); + if (!frame) { + HandleError(frame.Error()); + return; + } + + debuggableThread->StepOver(debugInfoCache_.GetCurrentLineLocations(*frame.Value())); + } +} + +void Inspector::StepOut(PtThread thread) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + if (UNLIKELY(!debuggableThread->IsPaused())) { + LogDebuggerNotPaused("stepOut"); + return; + } + + HandleError(debugger_.NotifyFramePop(thread, 0)); + debuggableThread->StepOut(); + } +} + +void Inspector::ContinueToLocation(PtThread thread, std::string_view sourceFile, size_t lineNumber) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + if (UNLIKELY(!debuggableThread->IsPaused())) { + LogDebuggerNotPaused("continueToLocation"); + return; + } + + debuggableThread->ContinueTo(debugInfoCache_.GetContinueToLocations(sourceFile, lineNumber)); + } +} + +void Inspector::RestartFrame(PtThread thread, FrameId frameId) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + if (UNLIKELY(!debuggableThread->IsPaused())) { + LogDebuggerNotPaused("restartFrame"); + return; + } + + if (auto error = debugger_.RestartFrame(thread, frameId)) { + HandleError(*error); + return; + } + + debuggableThread->StepInto({}); + } +} + +std::vector Inspector::GetProperties(PtThread thread, RemoteObjectId objectId, bool generatePreview) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return {}; + } + + std::optional> properties; + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread != nullptr) { + debuggableThread->RequestToObjectRepository([objectId, generatePreview, &properties](auto &objectRepository) { + properties = objectRepository.GetProperties(objectId, generatePreview); + }); + } + + if (!properties) { + LOG(INFO, DEBUGGER) << "Failed to resolve object id: " << objectId; + return {}; + } + + return *properties; +} + +std::string Inspector::GetSourceCode(std::string_view sourceFile) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return {}; + } + + return debugInfoCache_.GetSourceCode(sourceFile); +} + +void Inspector::DebuggableThreadPostSuspend(PtThread thread, ObjectRepository &objectRepository, + const std::vector &hitBreakpoints, ObjectHeader *exception, + PauseReason pauseReason) +{ + auto exceptionRemoteObject = exception != nullptr ? objectRepository.CreateObject(TypedValue::Reference(exception)) + : std::optional(); + + inspectorServer_.CallDebuggerPaused( + thread, hitBreakpoints, exceptionRemoteObject, pauseReason, [this, thread, &objectRepository](auto &handler) { + FrameId frameId = 0; + HandleError(debugger_.EnumerateFrames(thread, [this, &objectRepository, &handler, + &frameId](const PtFrame &frame) { + std::string_view sourceFile; + std::string_view methodName; + size_t lineNumber; + debugInfoCache_.GetSourceLocation(frame, sourceFile, methodName, lineNumber); + if (sourceFile.empty()) { + return false; + } + + std::optional objThis; + auto frameObject = objectRepository.CreateFrameObject(frame, debugInfoCache_.GetLocals(frame), objThis); + auto scopeChain = std::vector {Scope(Scope::Type::LOCAL, std::move(frameObject)), + Scope(Scope::Type::GLOBAL, objectRepository.CreateGlobalObject())}; + + handler(frameId++, methodName, sourceFile, lineNumber, scopeChain, objThis); + + return true; + })); + }); +} + +void Inspector::NotifyExecutionEnded() +{ + inspectorServer_.CallRuntimeExecutionContextsCleared(); +} + +Expected Inspector::Evaluate(PtThread thread, const std::string &bytecodeBase64, + size_t frameNumber) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return Unexpected(std::string("Fatal, VM is dead")); + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread == nullptr) { + return Unexpected(std::string("No thread found")); + } + + if (UNLIKELY(!debuggableThread->IsPaused())) { + LogDebuggerNotPaused("evaluate"); + return Unexpected(std::string("Expression evaluation can be done only on pause")); + } + + std::string bytecode; + Base64Decoder::Decode(bytecodeBase64, bytecode); + auto optResult = debuggableThread->EvaluateExpression(frameNumber, bytecode); + if (!optResult) { + return Unexpected(std::move(optResult.Error())); + } + auto optExceptionDetails = (optResult->second) ? CreateExceptionDetails(thread, std::move(*optResult->second)) + : std::optional(); + return EvaluationResult(std::move(optResult->first), std::move(optExceptionDetails)); +} + +std::optional Inspector::CreateExceptionDetails(PtThread thread, RemoteObject &&exception) +{ + auto frame = debugger_.GetCurrentFrame(thread); + if (!frame) { + HandleError(frame.Error()); + return {}; + } + + std::string_view sourceFile; + std::string_view methodName; + size_t lineNumber; + debugInfoCache_.GetSourceLocation(*frame.Value(), sourceFile, methodName, lineNumber); + + ExceptionDetails exceptionDetails(GetNewExceptionId(), "", lineNumber, 0); + return exceptionDetails.SetUrl(sourceFile).SetExceptionObject(std::move(exception)); +} + +size_t Inspector::GetNewExceptionId() +{ + // Atomic with relaxed order reason: data race on concurrent exceptions happening in conditional breakpoints. + return currentExceptionId_.fetch_add(1, std::memory_order_relaxed); +} + +DebuggableThread *Inspector::GetDebuggableThread(PtThread thread) +{ + auto it = threads_.find(thread); + return it != threads_.end() ? &it->second : nullptr; +} + +void Inspector::Disable(PtThread thread) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + + auto *debuggableThread = GetDebuggableThread(thread); + if (debuggableThread == nullptr) { + return; + } + debuggableThread->Reset(); + debuggableThread->Continue(); +} + +void Inspector::ClientDisconnect(PtThread thread) +{ + (void)thread; +} + +void Inspector::SetAsyncCallStackDepth(PtThread thread) +{ + (void)thread; +} + +void Inspector::SetBlackboxPatterns(PtThread thread) +{ + (void)thread; +} + +void Inspector::SmartStepInto(PtThread thread) +{ + (void)thread; +} + +void Inspector::DropFrame(PtThread thread) +{ + (void)thread; +} + +void Inspector::SetNativeRange(PtThread thread) +{ + (void)thread; +} + +void Inspector::ReplyNativeCalling(PtThread thread) +{ + Continue(thread); +} + +void Inspector::ProfilerSetSamplingInterval(int32_t interval) +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return; + } + samplingInterval_ = interval; +} + +Expected Inspector::ProfilerStart() +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return Unexpected(std::string("Fatal, VM is dead")); + } + if (cpuProfilerStarted_) { + return Unexpected(std::string("Fatal, profiling operation is already running.")); + } + cpuProfilerStarted_ = true; + profileInfoBuffer_ = std::make_shared(); + profileInfoBuffer_->SetThreadStartTime(sampler::Sampler::GetMicrosecondsTimeStamp()); + Runtime::GetCurrent()->GetTools().StartSamplingProfiler( + std::make_unique(profileInfoBuffer_), samplingInterval_); + return true; +} + +Expected Inspector::ProfilerStop() +{ + os::memory::ReadLockHolder lock(vmDeathLock_); + if (UNLIKELY(CheckVmDead())) { + return Unexpected(std::string("Fatal, VM is dead")); + } + + if (!cpuProfilerStarted_) { + return Unexpected(std::string("Fatal, profiler inactive")); + } + + Runtime::GetCurrent()->GetTools().StopSamplingProfiler(); + auto profileInfoPtr = profileInfoBuffer_->GetAllThreadsProfileInfos(); + if (!profileInfoPtr) { + return Unexpected(std::string("Fatal, profiler info is empty")); + } + profileInfoBuffer_.reset(); + cpuProfilerStarted_ = false; + return Profile(std::move(profileInfoPtr)); +} + +void Inspector::DebuggerEnable() +{ + os::memory::WriteLockHolder lock(debuggerEventsLock_); + for (auto &[_, dbgThread] : threads_) { + (void)_; + dbgThread.Reset(); + } + breakpointStorage_.Reset(); + Runtime::GetCurrent()->GetClassLinker()->EnumeratePandaFiles([this](auto &file) { + const auto *extractor = debugInfoCache_.GetDebugInfo(&file); + SourceNameInsert(extractor); + return true; + }); +} + +void Inspector::RegisterMethodHandlers() +{ + // NOLINTBEGIN(modernize-avoid-bind) + inspectorServer_.OnCallDebuggerContinueToLocation(std::bind(&Inspector::ContinueToLocation, this, _1, _2, _3)); + inspectorServer_.OnCallDebuggerEnable(std::bind(&Inspector::DebuggerEnable, this)); + inspectorServer_.OnCallDebuggerGetPossibleBreakpoints( + std::bind(&Inspector::GetPossibleBreakpoints, this, _1, _2, _3, _4)); + inspectorServer_.OnCallDebuggerGetScriptSource(std::bind(&Inspector::GetSourceCode, this, _1)); + inspectorServer_.OnCallDebuggerPause(std::bind(&Inspector::Pause, this, _1)); + inspectorServer_.OnCallDebuggerRemoveBreakpoint(std::bind(&Inspector::RemoveBreakpoint, this, _1, _2)); + inspectorServer_.OnCallDebuggerRemoveBreakpointsByUrl(std::bind(&Inspector::RemoveBreakpoints, this, _1, _2)); + inspectorServer_.OnCallDebuggerRestartFrame(std::bind(&Inspector::RestartFrame, this, _1, _2)); + inspectorServer_.OnCallDebuggerResume(std::bind(&Inspector::Continue, this, _1)); + inspectorServer_.OnCallDebuggerSetAsyncCallStackDepth(std::bind(&Inspector::SetAsyncCallStackDepth, this, _1)); + inspectorServer_.OnCallDebuggerSetBlackboxPatterns(std::bind(&Inspector::SetBlackboxPatterns, this, _1)); + inspectorServer_.OnCallDebuggerSmartStepInto(std::bind(&Inspector::SmartStepInto, this, _1)); + inspectorServer_.OnCallDebuggerSetBreakpoint(std::bind(&Inspector::SetBreakpoint, this, _1, _2, _3, _4, _5)); + inspectorServer_.OnCallDebuggerSetBreakpointByUrl(std::bind(&Inspector::SetBreakpoint, this, _1, _2, _3, _4, _5)); + inspectorServer_.OnCallDebuggerGetPossibleAndSetBreakpointByUrl( + std::bind(&Inspector::SetBreakpoint, this, _1, _2, _3, _4, _5)); + inspectorServer_.OnCallDebuggerSetBreakpointsActive(std::bind(&Inspector::SetBreakpointsActive, this, _1, _2)); + inspectorServer_.OnCallDebuggerSetSkipAllPauses(std::bind(&Inspector::SetSkipAllPauses, this, _1, _2)); + inspectorServer_.OnCallDebuggerSetPauseOnExceptions(std::bind(&Inspector::SetPauseOnExceptions, this, _1, _2)); + inspectorServer_.OnCallDebuggerStepInto(std::bind(&Inspector::StepInto, this, _1)); + inspectorServer_.OnCallDebuggerStepOut(std::bind(&Inspector::StepOut, this, _1)); + inspectorServer_.OnCallDebuggerStepOver(std::bind(&Inspector::StepOver, this, _1)); + inspectorServer_.OnCallDebuggerEvaluateOnCallFrame(std::bind(&Inspector::Evaluate, this, _1, _2, _3)); + inspectorServer_.OnCallDebuggerDisable(std::bind(&Inspector::Disable, this, _1)); + inspectorServer_.OnCallDebuggerClientDisconnect(std::bind(&Inspector::ClientDisconnect, this, _1)); + inspectorServer_.OnCallDebuggerDropFrame(std::bind(&Inspector::DropFrame, this, _1)); + inspectorServer_.OnCallDebuggerSetNativeRange(std::bind(&Inspector::SetNativeRange, this, _1)); + inspectorServer_.OnCallDebuggerReplyNativeCalling(std::bind(&Inspector::ReplyNativeCalling, this, _1)); + inspectorServer_.OnCallDebuggerCallFunctionOn(std::bind(&Inspector::Evaluate, this, _1, _2, _3)); + inspectorServer_.OnCallDebuggerSetMixedDebugEnabled(std::bind(&Inspector::SetMixedDebugEnabled, this, _1, _2)); + inspectorServer_.OnCallRuntimeEnable(std::bind(&Inspector::RuntimeEnable, this, _1)); + inspectorServer_.OnCallRuntimeGetProperties(std::bind(&Inspector::GetProperties, this, _1, _2, _3)); + inspectorServer_.OnCallRuntimeRunIfWaitingForDebugger(std::bind(&Inspector::RunIfWaitingForDebugger, this, _1)); + inspectorServer_.OnCallRuntimeEvaluate(std::bind(&Inspector::Evaluate, this, _1, _2, 0)); + inspectorServer_.OnCallProfilerEnable(); + inspectorServer_.OnCallProfilerDisable(); + inspectorServer_.OnCallProfilerSetSamplingInterval(std::bind(&Inspector::ProfilerSetSamplingInterval, this, _1)); + inspectorServer_.OnCallProfilerStart(std::bind(&Inspector::ProfilerStart, this)); + inspectorServer_.OnCallProfilerStop(std::bind(&Inspector::ProfilerStop, this)); + // NOLINTEND(modernize-avoid-bind) +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/inspector.h b/tooling/static/inspector.h new file mode 100644 index 00000000..5effd413 --- /dev/null +++ b/tooling/static/inspector.h @@ -0,0 +1,179 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_INSPECTOR_H +#define PANDA_TOOLING_INSPECTOR_INSPECTOR_H + +#include +#include +#include +#include +#include +#include +#include + +#include "include/tooling/debug_interface.h" +#include "include/tooling/pt_thread.h" + +#include "debugger/breakpoint_storage.h" +#include "debugger/debug_info_cache.h" +#include "debugger/debuggable_thread.h" +#include "debugger/object_repository.h" + +#include "common.h" +#include "inspector_server.h" +#include "runtime/tooling/tools.h" +#include "os/mutex.h" +#include "types/evaluation_result.h" +#include "types/numeric_id.h" +#include "types/pause_on_exceptions_state.h" +#include "types/profile_result.h" +#include "types/property_descriptor.h" +#include "types/remote_object.h" + +namespace ark::tooling { +class DebugInterface; + +namespace inspector { +// NOLINTNEXTLINE(fuchsia-virtual-inheritance) +class Server; + +class Inspector final : public PtHooks { +public: + Inspector(Server &server, DebugInterface &debugger, bool breakOnStart); + ~Inspector() override; + + NO_COPY_SEMANTIC(Inspector); + NO_MOVE_SEMANTIC(Inspector); + + void ConsoleCall(PtThread thread, ConsoleCallType type, uint64_t timestamp, + const PandaVector &arguments) override; + // CC-OFFNXT(G.FUN.01-CPP) Decreasing the number of arguments will decrease the clarity of the code. + void Exception(PtThread thread, Method *method, const PtLocation &location, ObjectHeader *exception, + Method *catchMethod, const PtLocation &catchLocation) override; + void FramePop(PtThread thread, Method *method, bool wasPoppedByException) override; + void MethodEntry(PtThread thread, Method *method) override; + void LoadModule(std::string_view fileName) override; + void SingleStep(PtThread thread, Method *method, const PtLocation &location) override; + void ThreadStart(PtThread thread) override; + void ThreadEnd(PtThread thread) override; + void VmDeath() override; + + void Run(); + void Stop(); + void WaitForDebugger(); + +private: + void RuntimeEnable(PtThread thread); + + void RunIfWaitingForDebugger(PtThread thread); + + void Pause(PtThread thread); + void Continue(PtThread thread); + void Disable(PtThread thread); + void ClientDisconnect(PtThread thread); + void SetAsyncCallStackDepth(PtThread thread); + void SetBlackboxPatterns(PtThread thread); + void SmartStepInto(PtThread thread); + void DropFrame(PtThread thread); + void SetNativeRange(PtThread thread); + void ReplyNativeCalling(PtThread thread); + void SetBreakpointsActive(PtThread thread, bool active); + void SetSkipAllPauses(PtThread thread, bool skip); + void SetMixedDebugEnabled(PtThread thread, bool mixedDebugEnabled); + std::set GetPossibleBreakpoints(std::string_view sourceFile, size_t startLine, size_t endLine, + bool restrictToFunction); + std::optional SetBreakpoint(PtThread thread, SourceFileFilter &&sourceFilesFilter, size_t lineNumber, + std::set &sourceFiles, const std::string *condition); + void RemoveBreakpoint(PtThread thread, BreakpointId id); + void RemoveBreakpoints(PtThread thread, const SourceFileFilter &sourceFilesFilter); + + void SetPauseOnExceptions(PtThread thread, PauseOnExceptionsState state); + + void StepInto(PtThread thread); + void StepOver(PtThread thread); + void StepOut(PtThread thread); + void ContinueToLocation(PtThread thread, std::string_view sourceFile, size_t lineNumber); + + void RestartFrame(PtThread thread, FrameId frameId); + + std::vector GetProperties(PtThread thread, RemoteObjectId objectId, bool generatePreview); + std::string GetSourceCode(std::string_view sourceFile); + + void DebuggableThreadPostSuspend(PtThread thread, ObjectRepository &objectRepository, + const std::vector &hitBreakpoints, ObjectHeader *exception, + PauseReason pauseReason); + + void NotifyExecutionEnded(); + + Expected Evaluate(PtThread thread, const std::string &bytecodeBase64, + size_t frameNumber); + void ProfilerSetSamplingInterval(int32_t interval); + Expected ProfilerStart(); + Expected ProfilerStop(); + + ALWAYS_INLINE bool CheckVmDead() REQUIRES_SHARED(vmDeathLock_) + { + if (UNLIKELY(isVmDead_)) { + LOG(WARNING, DEBUGGER) << "Killing inspector server after VM death"; + inspectorServer_.Kill(); + return true; + } + return false; + } + + /// @brief Get verbose information about the raised exception. + std::optional CreateExceptionDetails(PtThread thread, RemoteObject &&exception); + + size_t GetNewExceptionId(); + + DebuggableThread *GetDebuggableThread(PtThread thread); + + void RegisterMethodHandlers(); + + void ResolveBreakpoints(const panda_file::File &file, const panda_file::DebugInfoExtractor *debugInfoCache); + void CollectModules(); + void DebuggerEnable(); + void SourceNameInsert(const panda_file::DebugInfoExtractor *extractor); + +private: + bool breakOnStart_; + + os::memory::RWLock debuggerEventsLock_; + bool connecting_ {false}; // Should be accessed only from the server thread + + InspectorServer inspectorServer_; // NOLINT(misc-non-private-member-variables-in-classes) + DebugInterface &debugger_; + DebugInfoCache debugInfoCache_; + std::map threads_; + + std::atomic_size_t currentExceptionId_ {0}; + + os::memory::RWLock vmDeathLock_; + bool isVmDead_ GUARDED_BY(vmDeathLock_) {false}; + + BreakpointStorage breakpointStorage_; + + std::thread serverThread_; + uint32_t samplingInterval_ {0}; + std::shared_ptr profileInfoBuffer_ = nullptr; + bool cpuProfilerStarted_ = false; + os::memory::Mutex waitDebuggerMutex_; + os::memory::ConditionVariable waitDebuggerCond_ GUARDED_BY(waitDebuggerMutex_); +}; +} // namespace inspector +} // namespace ark::tooling + +#endif // PANDA_TOOLING_INSPECTOR_INSPECTOR_H diff --git a/tooling/static/inspector_server.cpp b/tooling/static/inspector_server.cpp new file mode 100644 index 00000000..b5019279 --- /dev/null +++ b/tooling/static/inspector_server.cpp @@ -0,0 +1,1072 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "inspector_server.h" + +#include +#include +#include +#include +#include + +#include "include/console_call_type.h" +#include "include/tooling/pt_thread.h" +#include "json_serialization/serializable.h" +#include "macros.h" +#include "utils/expected.h" +#include "utils/json_builder.h" +#include "utils/json_parser.h" +#include "utils/logger.h" + +#include "connection/server.h" +#include "json_serialization/jrpc_error.h" +#include "types/custom_url_breakpoint_response.h" +#include "types/debugger_evaluation_request.h" +#include "types/debugger_call_function_on_request.h" +#include "types/location.h" +#include "types/numeric_id.h" +#include "types/possible_breakpoints_response.h" +#include "types/script_source_response.h" +#include "types/url_breakpoint_request.h" +#include "types/url_breakpoint_response.h" + +namespace ark::tooling::inspector { +InspectorServer::InspectorServer(Server &server) : server_(server) {} + +void InspectorServer::Kill() +{ + server_.Kill(); +} + +void InspectorServer::Run() +{ + server_.Run(); +} + +void InspectorServer::OnValidate(std::function &&handler) +{ + server_.OnValidate([handler = std::move(handler)]() { + // Pause debugger events processing + handler(); + + // At this point, the whole messaging is stopped due to: + // - Debugger events are not processed by the inspector after the call above; + // - Client messages are not processed as we are executing on the server thread. + }); +} + +void InspectorServer::OnOpen(std::function &&handler) +{ + server_.OnOpen([this, handler = std::move(handler)]() { + // A new connection is open, reinitialize the state + sessionManager_.EnumerateSessions([this](auto &id, [[maybe_unused]] auto thread) { + if (!id.empty()) { + SendTargetAttachedToTarget(id); + } + }); + + // Resume debugger events processing + handler(); + }); +} + +void InspectorServer::OnFail(std::function &&handler) +{ + server_.OnFail([handler = std::move(handler)]() { + // Resume debugger events processing + handler(); + }); +} + +static std::string_view GetPauseReasonString(PauseReason reason) +{ + switch (reason) { + case PauseReason::EXCEPTION: + return "exception"; + case PauseReason::BREAK_ON_START: + return "Break on start"; + default: + return "other"; + } + UNREACHABLE(); +} + +void InspectorServer::CallDebuggerPaused(PtThread thread, const std::vector &hitBreakpoints, + const std::optional &exception, PauseReason pauseReason, + const std::function &enumerateFrames) +{ + auto sessionId = sessionManager_.GetSessionIdByThread(thread); + + server_.Call(sessionId, "Debugger.paused", [&](auto ¶ms) { + params.AddProperty("callFrames", [this, thread, &enumerateFrames](JsonArrayBuilder &callFrames) { + EnumerateCallFrames(callFrames, thread, enumerateFrames); + }); + + params.AddProperty("hitBreakpoints", [&hitBreakpoints](JsonArrayBuilder &hitBreakpointsBuilder) { + AddHitBreakpoints(hitBreakpointsBuilder, hitBreakpoints); + }); + + if (exception) { + params.AddProperty("data", *exception); + } + + params.AddProperty("reason", GetPauseReasonString(pauseReason)); + }); +} + +void InspectorServer::CallDebuggerResumed(PtThread thread) +{ + server_.Call(sessionManager_.GetSessionIdByThread(thread), "Debugger.resumed"); +} + +void InspectorServer::CallDebuggerScriptParsed(ScriptId scriptId, std::string_view sourceFile) +{ + server_.Call("", "Debugger.scriptParsed", [&sourceFile, &scriptId](auto ¶ms) { + params.AddProperty("executionContextId", 0); + params.AddProperty("scriptId", std::to_string(scriptId)); + params.AddProperty("url", sourceFile.data()); + params.AddProperty("startLine", 0); + params.AddProperty("startColumn", 0); + params.AddProperty("endLine", std::numeric_limits::max()); + params.AddProperty("endColumn", std::numeric_limits::max()); + params.AddProperty("hash", ""); + }); +} + +void InspectorServer::CallRuntimeConsoleApiCalled(PtThread thread, ConsoleCallType type, uint64_t timestamp, + const std::vector &arguments) +{ + auto sessionId = sessionManager_.GetSessionIdByThread(thread); + + server_.Call(sessionId, "Runtime.consoleAPICalled", [&](auto ¶ms) { + params.AddProperty("executionContextId", 0); + params.AddProperty("timestamp", timestamp); + + switch (type) { + case ConsoleCallType::LOG: + params.AddProperty("type", "log"); + break; + case ConsoleCallType::DEBUG: + params.AddProperty("type", "debug"); + break; + case ConsoleCallType::INFO: + params.AddProperty("type", "info"); + break; + case ConsoleCallType::ERROR: + params.AddProperty("type", "error"); + break; + case ConsoleCallType::WARNING: + params.AddProperty("type", "warning"); + break; + default: + UNREACHABLE(); + } + + params.AddProperty("args", [&](JsonArrayBuilder &argsBuilder) { + for (const auto &argument : arguments) { + argsBuilder.Add(argument); + } + }); + }); +} + +void InspectorServer::CallRuntimeExecutionContextCreated(PtThread thread) +{ + auto sessionId = sessionManager_.GetSessionIdByThread(thread); + + std::string name; + if (thread != PtThread::NONE) { + name = "Thread #" + std::to_string(thread.GetId()); + } + + server_.Call(sessionId, "Runtime.executionContextCreated", [&](auto ¶ms) { + params.AddProperty("context", [&](JsonObjectBuilder &context) { + context.AddProperty("id", thread.GetId()); + context.AddProperty("origin", ""); + context.AddProperty("name", name); + context.AddProperty("uniqueId", GetExecutionContextUniqueId(thread)); + }); + }); +} + +void InspectorServer::CallRuntimeExecutionContextsCleared() +{ + server_.Call("Runtime.executionContextsCleared"); +} + +void InspectorServer::CallTargetAttachedToTarget(PtThread thread) +{ + auto &sessionId = sessionManager_.AddSession(thread); + if (!sessionId.empty()) { + SendTargetAttachedToTarget(sessionId); + } +} + +void InspectorServer::CallTargetDetachedFromTarget(PtThread thread) +{ + auto sessionId = sessionManager_.GetSessionIdByThread(thread); + + // Pause the server thread to ensure that there will be no dangling PtThreads + server_.Pause(); + + sessionManager_.RemoveSession(sessionId); + + // Now no one will retrieve the detached thread from the sessions manager + server_.Continue(); + + if (!sessionId.empty()) { + server_.Call("Target.detachedFromTarget", + [&sessionId](auto ¶ms) { params.AddProperty("session_id", sessionId); }); + } +} + +void InspectorServer::OnCallDebuggerContinueToLocation( + std::function &&handler) +{ + // clang-format off + server_.OnCall("Debugger.continueToLocation", + [this, handler = std::move(handler)](auto &sessionId, const auto ¶ms) -> Server::MethodResponse { + auto location = Location::FromJsonProperty(params, "location"); + if (!location) { + LOG(INFO, DEBUGGER) << location.Error(); + return Unexpected(JRPCError(location.Error())); + } + + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread, sourceManager_.GetSourceFileName(location->GetScriptId()), + location->GetLineNumber()); + return std::unique_ptr(); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerEnable(std::function &&handler) +{ + struct Response : public JsonSerializable { + void Serialize(JsonObjectBuilder &builder) const override + { + builder.AddProperty("debuggerId", 0); + builder.AddProperty("protocols", [](JsonArrayBuilder &) {}); + } + }; + + server_.OnCall("Debugger.enable", [handler = std::move(handler)](auto, auto &) { + handler(); + return std::unique_ptr(std::make_unique()); + }); +} + +void InspectorServer::OnCallDebuggerGetPossibleBreakpoints( + std::function(std::string_view, size_t, size_t, bool)> &&handler) +{ + // clang-format off + server_.OnCall("Debugger.getPossibleBreakpoints", + [this, handler = std::move(handler)](auto &, const JsonObject ¶ms) -> Server::MethodResponse { + auto optStart = Location::FromJsonProperty(params, "start"); + if (!optStart) { + LOG(INFO, DEBUGGER) << optStart.Error(); + return Unexpected(JRPCError(optStart.Error(), ErrorCode::PARSE_ERROR)); + } + + auto scriptId = optStart->GetScriptId(); + + size_t endLine = ~0U; + if (auto end = Location::FromJsonProperty(params, "end")) { + if (end->GetScriptId() != scriptId) { + std::string_view msg = "Script ids don't match"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(msg, ErrorCode::INVALID_PARAMS)); + } + + endLine = end->GetLineNumber(); + } + + bool restrictToFunction = false; + if (auto prop = params.GetValue("restrictToFunction")) { + restrictToFunction = *prop; + } + + auto lineNumbers = handler(sourceManager_.GetSourceFileName(scriptId), optStart->GetLineNumber(), + endLine, restrictToFunction); + auto response = std::make_unique(); + for (const auto &line : lineNumbers) { + response->Add(Location(scriptId, line)); + } + return std::unique_ptr(std::move(response)); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerGetScriptSource(std::function &&handler) +{ + // clang-format off + server_.OnCall("Debugger.getScriptSource", + [this, handler = std::move(handler)](auto &, auto ¶ms) -> Server::MethodResponse { + auto scriptId = ParseNumericId(params, "scriptId"); + if (scriptId) { + auto sourceFile = sourceManager_.GetSourceFileName(*scriptId); + return std::unique_ptr( + std::make_unique(handler(sourceFile))); + } + LOG(INFO, DEBUGGER) << scriptId.Error(); + return Unexpected(JRPCError(scriptId.Error(), ErrorCode::PARSE_ERROR)); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerPause(std::function &&handler) +{ + server_.OnCall("Debugger.pause", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerRemoveBreakpoint(std::function &&handler) +{ + // clang-format off + server_.OnCall("Debugger.removeBreakpoint", + [this, handler = std::move(handler)](auto &sessionId, auto ¶ms) -> Server::MethodResponse { + auto breakpointId = ParseNumericId(params, "breakpointId"); + if (breakpointId) { + handler(sessionManager_.GetThreadBySessionId(sessionId), *breakpointId); + return std::unique_ptr(); + } + LOG(INFO, DEBUGGER) << breakpointId.Error(); + return Unexpected(JRPCError(breakpointId.Error())); + }); + // clang-format on +} + +static bool IsPathEqual(const std::string_view &src, const std::string_view &dst) +{ + if (src.size() != dst.size()) { + return false; + } + + for (size_t i = 0; i < src.size(); ++i) { + if ((src[i] == '\\' || src[i] == '/') && (dst[i] == '\\' || dst[i] == '/')) { + continue; + } + if (src[i] != dst[i]) { + return false; + } + } + + return true; +} + +static auto GetUrlFileFilter(const std::string &url) +{ + static constexpr std::string_view FILE_PREFIX = "file://"; + return [sourceFile = url.find(FILE_PREFIX) == 0 ? url.substr(FILE_PREFIX.size()) : url](auto fileName) { + return IsPathEqual(sourceFile, fileName); + }; +} + +void InspectorServer::OnCallDebuggerRemoveBreakpointsByUrl(std::function &&handler) +{ + // clang-format off + server_.OnCall("Debugger.removeBreakpointsByUrl", + [this, handler = std::move(handler)](auto &sessionId, auto ¶ms) -> Server::MethodResponse { + const auto *url = params.template GetValue("url"); + if (url == nullptr) { + std::string_view msg = "No 'url' parameter was provided for Debugger.removeBreakpointsByUrl"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(msg, ErrorCode::PARSE_ERROR)); + } + handler(sessionManager_.GetThreadBySessionId(sessionId), GetUrlFileFilter(*url)); + return std::unique_ptr(); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerRestartFrame(std::function &&handler) +{ + struct Response : public JsonSerializable { + void Serialize(JsonObjectBuilder &builder) const override + { + builder.AddProperty("callFrames", [](JsonArrayBuilder &) {}); + } + }; + // clang-format off + server_.OnCall("Debugger.restartFrame", + [this, handler = std::move(handler)](auto &sessionId, auto ¶ms) -> Server::MethodResponse { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + + auto frameId = ParseNumericId(params, "callFrameId"); + if (!frameId) { + LOG(INFO, DEBUGGER) << frameId.Error(); + return Unexpected(JRPCError(frameId.Error(), ErrorCode::PARSE_ERROR)); + } + + handler(thread, *frameId); + return std::unique_ptr(std::make_unique()); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerResume(std::function &&handler) +{ + server_.OnCall("Debugger.resume", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerSetBreakpoint(std::function &&handler) +{ + class Response : public JsonSerializable { + public: + explicit Response(std::string &&bpId, Location &&loc) + : breakpointId_(std::move(bpId)), location_(std::move(loc)) + { + } + + void Serialize(JsonObjectBuilder &builder) const override + { + builder.AddProperty("breakpointId", breakpointId_); + builder.AddProperty("actualLocation", location_); + } + + private: + std::string breakpointId_; + Location location_; + }; + // clang-format off + server_.OnCall("Debugger.setBreakpoint", + [this, handler = std::move(handler)](auto &sessionId, auto ¶ms) -> Server::MethodResponse { + auto location = Location::FromJsonProperty(params, "location"); + if (!location) { + LOG(INFO, DEBUGGER) << location.Error(); + return Unexpected(JRPCError(location.Error(), ErrorCode::PARSE_ERROR)); + } + auto condition = params.template GetValue("condition"); + + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + + auto sourceFile = sourceManager_.GetSourceFileName(location->GetScriptId()); + std::set sourceFiles; + + auto id = handler( + thread, [sourceFile](auto fileName) { return fileName == sourceFile; }, + location->GetLineNumber(), sourceFiles, condition); + if (!id) { + std::string_view msg = "Failed to set breakpoint"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(msg, ErrorCode::INTERNAL_ERROR)); + } + auto response = std::make_unique(std::move(std::to_string(*id)), std::move(*location)); + return std::unique_ptr(std::move(response)); + }); + // clang-format on +} + +Expected, std::string> InspectorServer::SetBreakpointByUrl( + const std::string &sessionId, const UrlBreakpointRequest &breakpointRequest, + const std::function &handler) +{ + std::function sourceFileFilter; + if (const auto &url = breakpointRequest.GetUrl()) { + sourceFileFilter = GetUrlFileFilter(*url); + } else if (const auto &urlRegex = breakpointRequest.GetUrlRegex()) { + sourceFileFilter = [regex = std::regex(*urlRegex)](auto fileName) { + return std::regex_match(fileName.data(), regex); + }; + } else { + // Either 'url' or 'urlRegex' must be specified - checked in parser + UNREACHABLE(); + } + + const auto *condition = breakpointRequest.GetCondition().has_value() ? &*breakpointRequest.GetCondition() : nullptr; + + std::set sourceFiles; + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + + auto id = handler(thread, std::move(sourceFileFilter), breakpointRequest.GetLineNumber(), sourceFiles, condition); + if (!id) { + std::string msg = "Failed to set breakpoint"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(msg); + } + + auto breakpointInfo = std::make_unique(*id); + AddLocations(*breakpointInfo, sourceFiles, breakpointRequest.GetLineNumber(), thread); + return Expected, std::string>(std::move(breakpointInfo)); +} + +void InspectorServer::OnCallDebuggerSetBreakpointByUrl(std::function &&handler) +{ + // clang-format off + server_.OnCall("Debugger.setBreakpointByUrl", + [this, handler = std::move(handler)](auto &sessionId, const JsonObject ¶ms) -> Server::MethodResponse { + auto optRequest = UrlBreakpointRequest::FromJson(params); + if (!optRequest) { + std::stringstream ss; + ss << "Parse error: " << optRequest.Error(); + auto msg = ss.str(); + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(std::move(msg), ErrorCode::PARSE_ERROR)); + } + auto optResponse = SetBreakpointByUrl(sessionId, *optRequest, handler); + if (optResponse) { + return std::unique_ptr(std::move(optResponse.Value())); + } + return Unexpected(JRPCError(optResponse.Error())); + }); + // clang-format on +} + +static Expected, std::string> ParseUrlBreakpointRequests( + const std::vector &rawRequests) +{ + std::vector requestedBreakpoints; + for (const auto &rawRequest : rawRequests) { + auto *jsonObject = rawRequest.Get(); + if (jsonObject == nullptr) { + std::string msg = "Invalid 'locations' array in getPossibleAndSetBreakpointByUrl"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(std::move(msg)); + } + auto optBreakpointRequest = UrlBreakpointRequest::FromJson(**jsonObject); + if (!optBreakpointRequest) { + std::stringstream ss; + ss << "Invalid breakpoint request: " << optBreakpointRequest.Error(); + auto msg = ss.str(); + LOG(INFO, DEBUGGER) << msg; + return Unexpected(std::move(msg)); + } + requestedBreakpoints.push_back(std::move(*optBreakpointRequest)); + } + return requestedBreakpoints; +} + +void InspectorServer::OnCallDebuggerGetPossibleAndSetBreakpointByUrl(std::function &&handler) +{ + // clang-format off + server_.OnCall("Debugger.getPossibleAndSetBreakpointByUrl", + [this, handler = std::move(handler)](auto &sessionId, const JsonObject ¶ms) -> Server::MethodResponse { + auto rawRequests = params.GetValue("locations"); + if (rawRequests == nullptr) { + std::string_view msg = "No 'locations' array in getPossibleAndSetBreakpointByUrl"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(msg, ErrorCode::PARSE_ERROR)); + } + auto optRequests = ParseUrlBreakpointRequests(*rawRequests); + if (!optRequests) { + return Unexpected(JRPCError(std::move(optRequests.Error()), ErrorCode::PARSE_ERROR)); + } + + auto response = std::make_unique(); + for (const auto &req : *optRequests) { + auto optResponse = SetBreakpointByUrl(sessionId, req, handler); + if (!optResponse.HasValue()) { + response->Add(CustomUrlBreakpointResponse(req.GetLineNumber())); + continue; + } + + if (optResponse.Value()->GetLocations().size() != 0) { + response->Add(optResponse.Value()->ToCustomUrlBreakpointResponse()); + } else { + auto resp = CustomUrlBreakpointResponse(req.GetLineNumber()); + resp.SetBreakpointId(optResponse.Value()->GetBreakpointId()); + response->Add(std::move(resp)); + } + } + return std::unique_ptr(std::move(response)); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerSetBreakpointsActive(std::function &&handler) +{ + // clang-format off + server_.OnCall("Debugger.setBreakpointsActive", + [this, handler = std::move(handler)](auto &sessionId, const JsonObject ¶ms) -> Server::MethodResponse { + bool active; + if (auto prop = params.GetValue("active")) { + active = *prop; + } else { + std::string_view msg = "No 'active' property"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(msg)); + } + + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread, active); + return std::unique_ptr(); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerSetSkipAllPauses(std::function &&handler) +{ + // clang-format off + server_.OnCall("Debugger.setSkipAllPauses", + [this, handler = std::move(handler)](auto &sessionId, const JsonObject ¶ms) -> Server::MethodResponse { + bool skip; + if (auto prop = params.GetValue("skip")) { + skip = *prop; + } else { + std::string_view msg = "No 'active' property"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(msg, ErrorCode::INVALID_PARAMS)); + } + + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread, skip); + return std::unique_ptr(); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerSetPauseOnExceptions( + std::function &&handler) +{ + // clang-format off + server_.OnCall("Debugger.setPauseOnExceptions", + [this, handler = std::move(handler)](auto &sessionId, const JsonObject ¶ms) -> Server::MethodResponse { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + + PauseOnExceptionsState state; + auto stateStr = params.GetValue("state"); + if (stateStr == nullptr) { + std::string_view msg = "No 'state' property"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(msg, ErrorCode::INVALID_PARAMS)); + } + + if (*stateStr == "none") { + state = PauseOnExceptionsState::NONE; + } else if (*stateStr == "caught") { + state = PauseOnExceptionsState::CAUGHT; + } else if (*stateStr == "uncaught") { + state = PauseOnExceptionsState::UNCAUGHT; + } else if (*stateStr == "all") { + state = PauseOnExceptionsState::ALL; + } else { + std::stringstream ss; + ss << "Invalid 'state' value: " << *stateStr; + auto msg = ss.str(); + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(std::move(msg), ErrorCode::INVALID_PARAMS)); + } + + handler(thread, state); + return std::unique_ptr(); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerStepInto(std::function &&handler) +{ + server_.OnCall("Debugger.stepInto", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerStepOut(std::function &&handler) +{ + server_.OnCall("Debugger.stepOut", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerStepOver(std::function &&handler) +{ + server_.OnCall("Debugger.stepOver", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerEvaluateOnCallFrame( + std::function(PtThread, const std::string &, size_t)> &&handler) +{ + // clang-format off + server_.OnCall("Debugger.evaluateOnCallFrame", + [this, handler = std::move(handler)](auto &sessionId, const JsonObject ¶ms) -> Server::MethodResponse { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + + auto optRequest = DebuggerEvaluationRequest::FromJson(params); + if (!optRequest) { + LOG(INFO, DEBUGGER) << optRequest.Error(); + return Unexpected(JRPCError(std::move(optRequest.Error()), ErrorCode::PARSE_ERROR)); + } + + auto optResult = handler(thread, optRequest->GetExpression(), optRequest->GetCallFrameId()); + if (!optResult) { + std::stringstream ss; + ss << "Evaluation failed: " << optResult.Error(); + auto msg = ss.str(); + LOG(DEBUG, DEBUGGER) << msg; + return Unexpected(JRPCError(std::move(msg), ErrorCode::INTERNAL_ERROR)); + } + + return std::unique_ptr(std::make_unique(std::move(*optResult))); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerCallFunctionOn( + std::function(PtThread, const std::string &, size_t)> &&handler) +{ + // clang-format off + server_.OnCall("Debugger.callFunctionOn", + [this, handler = std::move(handler)](auto &sessionId, const JsonObject ¶ms) -> Server::MethodResponse { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + + auto optRequest = DebuggerCallFunctionOnRequest::FromJson(params); + if (!optRequest) { + LOG(INFO, DEBUGGER) << optRequest.Error(); + return Unexpected(JRPCError(std::move(optRequest.Error()), ErrorCode::PARSE_ERROR)); + } + + auto optResult = handler(thread, optRequest->GetFunctionDeclaration(), optRequest->GetCallFrameId()); + if (!optResult) { + std::stringstream ss; + ss << "Evaluation failed: " << optResult.Error(); + auto msg = ss.str(); + LOG(DEBUG, DEBUGGER) << msg; + return Unexpected(JRPCError(std::move(msg), ErrorCode::INTERNAL_ERROR)); + } + + return std::unique_ptr(std::make_unique(std::move(*optResult))); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerSetMixedDebugEnabled(std::function &&handler) +{ + // clang-format off + server_.OnCall("Debugger.setMixedDebugEnabled", + [this, handler = std::move(handler)](auto &sessionId, const JsonObject ¶ms) -> Server::MethodResponse { + bool mixedDebugEnabled; + if (auto prop = params.GetValue("mixedDebugEnabled")) { + mixedDebugEnabled = *prop; + } else { + std::string_view msg = "No 'active' property"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(msg, ErrorCode::INVALID_PARAMS)); + } + + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread, mixedDebugEnabled); + return std::unique_ptr(); + }); + // clang-format on +} + +void InspectorServer::OnCallDebuggerDisable(std::function &&handler) +{ + server_.OnCall("Debugger.disable", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerClientDisconnect(std::function &&handler) +{ + server_.OnCall("Debugger.clientDisconnect", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerSetAsyncCallStackDepth(std::function &&handler) +{ + server_.OnCall("Debugger.setAsyncCallStackDepth", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerSetBlackboxPatterns(std::function &&handler) +{ + server_.OnCall("Debugger.setBlackboxPatterns", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerSmartStepInto(std::function &&handler) +{ + server_.OnCall("Debugger.smartStepInto", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerDropFrame(std::function &&handler) +{ + server_.OnCall("Debugger.dropFrame", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerSetNativeRange(std::function &&handler) +{ + server_.OnCall("Debugger.setNativeRange", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallDebuggerReplyNativeCalling(std::function &&handler) +{ + server_.OnCall("Debugger.replyNativeCalling", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallRuntimeEnable(std::function &&handler) +{ + server_.OnCall("Runtime.enable", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallRuntimeGetProperties( + std::function(PtThread, RemoteObjectId, bool)> &&handler) +{ + class Response : public JsonSerializable { + public: + explicit Response(std::vector props) : properties_(std::move(props)) {} + void Serialize(JsonObjectBuilder &builder) const override + { + builder.AddProperty("result", [&](JsonArrayBuilder &array) { + for (auto &descriptor : properties_) { + array.Add(descriptor); + } + }); + } + + private: + std::vector properties_; + }; + // clang-format off + server_.OnCall("Runtime.getProperties", + [this, handler = std::move(handler)](auto &sessionId, const JsonObject ¶ms) -> Server::MethodResponse { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + + auto objectId = ParseNumericId(params, "objectId"); + if (!objectId) { + LOG(INFO, DEBUGGER) << objectId.Error(); + return Unexpected(JRPCError(objectId.Error(), ErrorCode::PARSE_ERROR)); + } + + auto generatePreview = false; + if (auto prop = params.GetValue("generatePreview")) { + generatePreview = *prop; + } + + auto properties = handler(thread, *objectId, generatePreview); + return std::unique_ptr(std::make_unique(std::move(properties))); + }); + // clang-format on +} + +void InspectorServer::OnCallRuntimeRunIfWaitingForDebugger(std::function &&handler) +{ + server_.OnCall("Runtime.runIfWaitingForDebugger", [this, handler = std::move(handler)](auto &sessionId, auto &) { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + handler(thread); + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallRuntimeEvaluate( + std::function(PtThread, const std::string &)> &&handler) +{ + // clang-format off + server_.OnCall("Runtime.evaluate", + [this, handler = std::move(handler)](auto &sessionId, const JsonObject ¶ms) -> Server::MethodResponse { + auto thread = sessionManager_.GetThreadBySessionId(sessionId); + + auto *expressionStr = params.GetValue("expression"); + if (expressionStr == nullptr || expressionStr->empty()) { + std::string_view msg = "'expression' property is absent or empty"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(msg, ErrorCode::PARSE_ERROR)); + } + + auto optResult = handler(thread, *expressionStr); + if (!optResult) { + std::stringstream ss; + ss << "Evaluation failed: " << optResult.Error(); + auto msg = ss.str(); + LOG(DEBUG, DEBUGGER) << msg; + return Unexpected(JRPCError(std::move(msg), ErrorCode::INTERNAL_ERROR)); + } + + return std::unique_ptr(std::make_unique(std::move(*optResult))); + }); + // clang-format on +} + +void InspectorServer::OnCallProfilerEnable() +{ + server_.OnCall("Profiler.enable", [](auto &, auto &) { return std::unique_ptr(); }); +} + +void InspectorServer::OnCallProfilerDisable() +{ + server_.OnCall("Profiler.disable", [](auto &, auto &) { return std::unique_ptr(); }); +} + +void InspectorServer::OnCallProfilerSetSamplingInterval(std::function &&handler) +{ + // clang-format off + server_.OnCall("Profiler.setSamplingInterval", + [handler = std::move(handler)](auto &, const JsonObject ¶ms) -> Server::MethodResponse { + int32_t interval = 0; + if (auto prop = params.GetValue("interval")) { + interval = *prop; + handler(interval); + } else { + std::string_view msg = "No 'interval' property"; + LOG(INFO, DEBUGGER) << msg; + return Unexpected(JRPCError(msg, ErrorCode::INTERNAL_ERROR)); + } + return std::unique_ptr(); + }); + // clang-format on +} + +void InspectorServer::OnCallProfilerStart(std::function()> &&handler) +{ + server_.OnCall("Profiler.start", [handler = std::move(handler)](auto &, auto &) -> Server::MethodResponse { + auto optResult = handler(); + if (!optResult) { + std::stringstream ss; + ss << "Profiler failed: " << optResult.Error(); + auto msg = ss.str(); + LOG(DEBUG, DEBUGGER) << msg; + return Unexpected(JRPCError(std::move(msg), ErrorCode::INTERNAL_ERROR)); + } + return std::unique_ptr(); + }); +} + +void InspectorServer::OnCallProfilerStop(std::function()> &&handler) +{ + server_.OnCall("Profiler.stop", [handler = std::move(handler)](auto &, auto &) -> Server::MethodResponse { + auto optResult = handler(); + if (!optResult) { + std::stringstream ss; + ss << "Profiler failed: " << optResult.Error(); + auto msg = ss.str(); + LOG(DEBUG, DEBUGGER) << msg; + return Unexpected(JRPCError(std::move(msg), ErrorCode::INTERNAL_ERROR)); + } + return std::unique_ptr(std::make_unique(std::move(*optResult))); + }); +} + +void InspectorServer::SendTargetAttachedToTarget(const std::string &sessionId) +{ + server_.Call("Target.attachedToTarget", [&sessionId](auto ¶ms) { + params.AddProperty("sessionId", sessionId); + params.AddProperty("targetInfo", [&sessionId](JsonObjectBuilder &targetInfo) { + targetInfo.AddProperty("targetId", sessionId); + targetInfo.AddProperty("type", "worker"); + targetInfo.AddProperty("title", sessionId); + targetInfo.AddProperty("url", ""); + targetInfo.AddProperty("attached", true); + targetInfo.AddProperty("canAccessOpener", false); + }); + params.AddProperty("waitingForDebugger", true); + }); +} + +void InspectorServer::EnumerateCallFrames(JsonArrayBuilder &callFrames, PtThread thread, + const std::function &enumerateFrames) +{ + enumerateFrames([this, thread, &callFrames](auto frameId, auto methodName, auto sourceFile, auto lineNumber, + auto &scopeChain, auto &objThis) { + CallFrameInfo callFrameInfo {frameId, sourceFile, methodName, lineNumber}; + AddCallFrameInfo(callFrames, callFrameInfo, scopeChain, thread, objThis); + }); +} + +void InspectorServer::AddCallFrameInfo(JsonArrayBuilder &callFrames, const CallFrameInfo &callFrameInfo, + const std::vector &scopeChain, [[maybe_unused]] PtThread thread, + const std::optional &objThis) +{ + callFrames.Add([&](JsonObjectBuilder &callFrame) { + auto scriptId = sourceManager_.GetScriptId(callFrameInfo.sourceFile); + + callFrame.AddProperty("callFrameId", std::to_string(callFrameInfo.frameId)); + callFrame.AddProperty("functionName", callFrameInfo.methodName.data()); + callFrame.AddProperty("location", Location(scriptId, callFrameInfo.lineNumber)); + callFrame.AddProperty("url", callFrameInfo.sourceFile.data()); + + callFrame.AddProperty("scopeChain", [&](JsonArrayBuilder &scopeChainBuilder) { + for (auto &scope : scopeChain) { + scopeChainBuilder.Add(scope); + } + }); + + callFrame.AddProperty("this", objThis.value_or(RemoteObject::Undefined())); + callFrame.AddProperty("canBeRestarted", true); + }); +} + +void InspectorServer::AddLocations(UrlBreakpointResponse &response, const std::set &sourceFiles, + size_t lineNumber, [[maybe_unused]] PtThread thread) +{ + for (auto sourceFile : sourceFiles) { + auto scriptId = sourceManager_.GetScriptId(sourceFile); + response.AddLocation(Location {scriptId, lineNumber}); + } +} + +/* static */ +void InspectorServer::AddHitBreakpoints(JsonArrayBuilder &hitBreakpointsBuilder, + const std::vector &hitBreakpoints) +{ + for (auto id : hitBreakpoints) { + hitBreakpointsBuilder.Add(std::to_string(id)); + } +} + +/* static */ +std::string InspectorServer::GetExecutionContextUniqueId(const PtThread &thread) +{ + static int pid = os::thread::GetPid(); + std::stringstream ss; + ss << pid << ':' << thread.GetId(); + return ss.str(); +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/inspector_server.h b/tooling/static/inspector_server.h new file mode 100644 index 00000000..545a52ef --- /dev/null +++ b/tooling/static/inspector_server.h @@ -0,0 +1,159 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_INSPECTOR_SERVER_H +#define PANDA_TOOLING_INSPECTOR_INSPECTOR_SERVER_H + +#include +#include +#include +#include +#include +#include +#include + +#include "console_call_type.h" +#include "include/tooling/pt_thread.h" + +#include "common.h" +#include "session_manager.h" +#include "source_manager.h" +#include "debugger/thread_state.h" +#include "types/evaluation_result.h" +#include "types/numeric_id.h" +#include "types/pause_on_exceptions_state.h" +#include "types/profile_result.h" +#include "types/property_descriptor.h" +#include "types/remote_object.h" +#include "types/scope.h" + +namespace ark::tooling::inspector { +class UrlBreakpointResponse; +class Server; // NOLINT(fuchsia-virtual-inheritance) +class UrlBreakpointRequest; + +class InspectorServer final { +public: + using SetBreakpointHandler = std::optional(PtThread, SourceFileFilter &&, size_t, + std::set &, const std::string *); + using FrameInfoHandler = std::function &, const std::optional &)>; + +public: + explicit InspectorServer(Server &server); + ~InspectorServer() = default; + + NO_COPY_SEMANTIC(InspectorServer); + NO_MOVE_SEMANTIC(InspectorServer); + + void Kill(); + void Run(); + + void OnValidate(std::function &&handler); + void OnOpen(std::function &&handler); + void OnFail(std::function &&handler); + + void CallDebuggerPaused(PtThread thread, const std::vector &hitBreakpoints, + const std::optional &exception, PauseReason pauseReason, + const std::function &enumerateFrames); + void CallDebuggerResumed(PtThread thread); + void CallDebuggerScriptParsed(ScriptId scriptId, std::string_view sourceFile); + void CallRuntimeConsoleApiCalled(PtThread thread, ConsoleCallType type, uint64_t timestamp, + const std::vector &arguments); + void CallRuntimeExecutionContextCreated(PtThread thread); + void CallRuntimeExecutionContextsCleared(); + void CallTargetAttachedToTarget(PtThread thread); + void CallTargetDetachedFromTarget(PtThread thread); + + void OnCallDebuggerContinueToLocation(std::function &&handler); + void OnCallDebuggerEnable(std::function &&handler); + void OnCallDebuggerGetPossibleBreakpoints( + std::function(std::string_view, size_t, size_t, bool)> &&handler); + void OnCallDebuggerGetScriptSource(std::function &&handler); + void OnCallDebuggerPause(std::function &&handler); + void OnCallDebuggerRemoveBreakpoint(std::function &&handler); + void OnCallDebuggerRemoveBreakpointsByUrl(std::function &&handler); + void OnCallDebuggerRestartFrame(std::function &&handler); + void OnCallDebuggerResume(std::function &&handler); + void OnCallDebuggerSetAsyncCallStackDepth(std::function &&handler); + void OnCallDebuggerSetBlackboxPatterns(std::function &&handler); + void OnCallDebuggerSmartStepInto(std::function &&handler); + void OnCallDebuggerSetBreakpoint(std::function &&handler); + void OnCallDebuggerSetBreakpointByUrl(std::function &&handler); + void OnCallDebuggerGetPossibleAndSetBreakpointByUrl(std::function &&handler); + void OnCallDebuggerSetBreakpointsActive(std::function &&handler); + void OnCallDebuggerSetSkipAllPauses(std::function &&handler); + void OnCallDebuggerSetPauseOnExceptions(std::function &&handler); + void OnCallDebuggerStepInto(std::function &&handler); + void OnCallDebuggerStepOut(std::function &&handler); + void OnCallDebuggerStepOver(std::function &&handler); + void OnCallDebuggerEvaluateOnCallFrame( + std::function(PtThread, const std::string &, size_t)> &&handler); + void OnCallDebuggerClientDisconnect(std::function &&handler); + void OnCallDebuggerDisable(std::function &&handler); + void OnCallDebuggerDropFrame(std::function &&handler); + void OnCallDebuggerSetNativeRange(std::function &&handler); + void OnCallDebuggerReplyNativeCalling(std::function &&handler); + void OnCallDebuggerCallFunctionOn( + std::function(PtThread, const std::string &, size_t)> &&handler); + void OnCallDebuggerSetMixedDebugEnabled(std::function &&handler); + void OnCallRuntimeEnable(std::function &&handler); + void OnCallRuntimeGetProperties( + std::function(PtThread, RemoteObjectId, bool)> &&handler); + void OnCallRuntimeRunIfWaitingForDebugger(std::function &&handler); + void OnCallRuntimeEvaluate( + std::function(PtThread, const std::string &)> &&handler); + void OnCallProfilerEnable(); + void OnCallProfilerDisable(); + void OnCallProfilerSetSamplingInterval(std::function &&handler); + void OnCallProfilerStart(std::function()> &&handler); + void OnCallProfilerStop(std::function()> &&handler); + + SourceManager &GetSourceManager() + { + return sourceManager_; + } + +private: + struct CallFrameInfo { + FrameId frameId; + std::string_view sourceFile; + std::string_view methodName; + size_t lineNumber; + }; + +private: + void SendTargetAttachedToTarget(const std::string &sessionId); + void EnumerateCallFrames(JsonArrayBuilder &callFrames, PtThread thread, + const std::function &enumerateFrames); + void AddCallFrameInfo(JsonArrayBuilder &callFrames, const CallFrameInfo &callFrameInfo, + const std::vector &scopeChain, PtThread thread, + const std::optional &objThis); + Expected, std::string> SetBreakpointByUrl( + const std::string &sessionId, const UrlBreakpointRequest &breakpointRequest, + const std::function &handler); + void AddLocations(UrlBreakpointResponse &response, const std::set &sourceFiles, size_t lineNumber, + PtThread thread); + static void AddHitBreakpoints(JsonArrayBuilder &hitBreakpointsBuilder, + const std::vector &hitBreakpoints); + static std::string GetExecutionContextUniqueId(const PtThread &thread); + + Server &server_; + SessionManager sessionManager_; + SourceManager sourceManager_; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_INSPECTOR_SERVER_H diff --git a/tooling/static/json_serialization/jrpc_error.cpp b/tooling/static/json_serialization/jrpc_error.cpp new file mode 100644 index 00000000..0d2105bd --- /dev/null +++ b/tooling/static/json_serialization/jrpc_error.cpp @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "json_serialization/jrpc_error.h" + +#include "utils/json_builder.h" + +namespace ark::tooling::inspector { + +void JRPCError::Serialize(JsonObjectBuilder &builder) const +{ + builder.AddProperty("code", static_cast(code_)); + builder.AddProperty("message", message_); +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/json_serialization/jrpc_error.h b/tooling/static/json_serialization/jrpc_error.h new file mode 100644 index 00000000..e024c97d --- /dev/null +++ b/tooling/static/json_serialization/jrpc_error.h @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_JSON_SERIALIZATION_JRPC_ERROR_H +#define PANDA_TOOLING_INSPECTOR_JSON_SERIALIZATION_JRPC_ERROR_H + +#include "json_serialization/serializable.h" + +namespace ark::tooling::inspector { + +enum class ErrorCode { + PARSE_ERROR = -32700, + INTERNAL_ERROR = -32603, + INVALID_PARAMS = -32602, + METHOD_NOT_FOUND = -32601, + INVALID_REQUEST = -32600, + SESSION_NOT_FOUND = -32001, + SERVER_ERROR = -32000, +}; + +/// @brief Inspector error object with json-serialization capability. +class JRPCError final : public JsonSerializable { +public: + explicit JRPCError(std::string_view message, ErrorCode code = ErrorCode::INVALID_REQUEST) + : code_(code), message_(message) + { + } + + explicit JRPCError(std::string &&message, ErrorCode code = ErrorCode::INVALID_REQUEST) + : code_(code), message_(std::move(message)) + { + } + + DEFAULT_COPY_SEMANTIC(JRPCError); + DEFAULT_MOVE_SEMANTIC(JRPCError); + + ~JRPCError() override = default; + + void Serialize(JsonObjectBuilder &builder) const override; + +private: + ErrorCode code_ {0}; + std::string message_; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_JSON_SERIALIZATION_JRPC_ERROR_H diff --git a/tooling/static/json_serialization/serializable.h b/tooling/static/json_serialization/serializable.h new file mode 100644 index 00000000..4cf3ba93 --- /dev/null +++ b/tooling/static/json_serialization/serializable.h @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_JSON_SERIALIZATION_SERIALIZABLE_H +#define PANDA_TOOLING_INSPECTOR_JSON_SERIALIZATION_SERIALIZABLE_H + +#include "macros.h" + +namespace ark { +class JsonObjectBuilder; +} // namespace ark + +namespace ark::tooling::inspector { + +/// Interface for inspector objects that may be serialized into json. +class JsonSerializable { +public: + JsonSerializable() = default; + virtual ~JsonSerializable() = default; + + DEFAULT_COPY_SEMANTIC(JsonSerializable); + DEFAULT_MOVE_SEMANTIC(JsonSerializable); + + virtual void Serialize(JsonObjectBuilder &builder) const = 0; + + /// Operator() necessary to use std::invoke, for example in json_builder.h::Stringify method. + void operator()(JsonObjectBuilder &builder) const + { + Serialize(builder); + } +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_JSON_SERIALIZATION_SERIALIZABLE_H diff --git a/tooling/static/session_manager.cpp b/tooling/static/session_manager.cpp new file mode 100644 index 00000000..168be28f --- /dev/null +++ b/tooling/static/session_manager.cpp @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "session_manager.h" + +namespace ark::tooling::inspector { +const std::string &SessionManager::AddSession(PtThread thread) +{ + ASSERT(thread.GetManagedThread()); + + os::memory::LockHolder lock(mutex_); + return sessions_.insert({!sessions_.empty() ? std::to_string(thread.GetId()) : "", thread}).first->first; +} + +void SessionManager::RemoveSession(const std::string &id) +{ + os::memory::LockHolder lock(mutex_); + sessions_.erase(id); +} + +std::string SessionManager::GetSessionIdByThread(PtThread thread) const +{ + ASSERT(thread.GetManagedThread()); + + os::memory::LockHolder lock(mutex_); + + auto it = sessions_.find(""); + if (it != sessions_.end() && it->second == thread) { + return ""; + } + + return std::to_string(thread.GetId()); +} + +PtThread SessionManager::GetThreadBySessionId(const std::string &id) const +{ + os::memory::LockHolder lock(mutex_); + + auto it = sessions_.find(id); + if (it == sessions_.end()) { + return PtThread::NONE; + } + + return it->second; +} + +void SessionManager::EnumerateSessions(const std::function &handler) const +{ + os::memory::LockHolder lock(mutex_); + for (auto &[id, thread] : sessions_) { + handler(id, thread); + } +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/session_manager.h b/tooling/static/session_manager.h new file mode 100644 index 00000000..8c724dbc --- /dev/null +++ b/tooling/static/session_manager.h @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_SESSION_MANAGER_H +#define PANDA_TOOLING_INSPECTOR_SESSION_MANAGER_H + +#include "include/tooling/pt_thread.h" + +namespace ark::tooling::inspector { +class SessionManager { +public: + SessionManager() = default; + ~SessionManager() = default; + + NO_COPY_SEMANTIC(SessionManager); + NO_MOVE_SEMANTIC(SessionManager); + + const std::string &AddSession(PtThread thread); + void RemoveSession(const std::string &id); + + [[nodiscard]] std::string GetSessionIdByThread(PtThread thread) const; + [[nodiscard]] PtThread GetThreadBySessionId(const std::string &id) const; + + void EnumerateSessions(const std::function &handler) const; + +private: + mutable os::memory::Mutex mutex_; + std::map sessions_ GUARDED_BY(mutex_); +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_SESSION_MANAGER_H diff --git a/tooling/static/source_manager.cpp b/tooling/static/source_manager.cpp new file mode 100644 index 00000000..2e01a477 --- /dev/null +++ b/tooling/static/source_manager.cpp @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "source_manager.h" + +#include +#include + +#include "types/numeric_id.h" + +namespace ark::tooling::inspector { +ScriptId SourceManager::GetScriptId(std::string_view fileName) +{ + os::memory::LockHolder lock(mutex_); + + auto p = fileNameToId_.emplace(std::string(fileName), fileNameToId_.size()); + ScriptId id(p.first->second); + + if (p.second) { + std::string_view name {p.first->first}; + idToFileName_.emplace(id, name); + } + + return id; +} + +std::string_view SourceManager::GetSourceFileName(ScriptId id) const +{ + os::memory::LockHolder lock(mutex_); + + auto it = idToFileName_.find(id); + if (it != idToFileName_.end()) { + return it->second; + } + + LOG(ERROR, DEBUGGER) << "No file with script id " << id; + + return {}; +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/source_manager.h b/tooling/static/source_manager.h new file mode 100644 index 00000000..8b77611e --- /dev/null +++ b/tooling/static/source_manager.h @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_SOURCE_MANAGER_H +#define PANDA_TOOLING_INSPECTOR_SOURCE_MANAGER_H + +#include +#include +#include +#include +#include +#include + +#include "include/tooling/pt_thread.h" +#include "os/mutex.h" + +#include "types/numeric_id.h" + +namespace ark::tooling::inspector { +class SourceManager final { +public: + SourceManager() = default; + ~SourceManager() = default; + + NO_COPY_SEMANTIC(SourceManager); + NO_MOVE_SEMANTIC(SourceManager); + + ScriptId GetScriptId(std::string_view fileName); + [[nodiscard]] std::string_view GetSourceFileName(ScriptId id) const; + +private: + mutable os::memory::Mutex mutex_; + std::unordered_map fileNameToId_ GUARDED_BY(mutex_); + std::unordered_map idToFileName_ GUARDED_BY(mutex_); +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_SOURCE_MANAGER_H diff --git a/tooling/static/tests/base64.cpp b/tooling/static/tests/base64.cpp new file mode 100644 index 00000000..baa35773 --- /dev/null +++ b/tooling/static/tests/base64.cpp @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include "gtest/gtest.h" + +#include "evaluation/base64.h" + +// NOLINTBEGIN + +namespace ark::tooling::inspector::test { + +class Base64DecoderTest : public testing::Test { +public: + static constexpr std::array TEST_CASES = { + std::pair {"bGlnaHQgd29yay4=", "light work."}, + std::pair {"bGlnaHQgd29yaw==", "light work"}, + std::pair {"bGlnaHQgd29y", "light wor"}, + std::pair {"TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu", + "Many hands make light work."}, + }; +}; + +static void CheckTestCase(std::string_view encoded, std::string_view decoded) +{ + Span encodedData {reinterpret_cast(encoded.data()), encoded.size()}; + auto decodedSize = Base64Decoder::DecodedSize(encodedData); + ASSERT_TRUE(decodedSize.has_value()); + ASSERT_EQ(*decodedSize, decoded.size()); + std::string decodedBuffer(decoded.size(), 0); + ASSERT_TRUE(Base64Decoder::Decode(reinterpret_cast(decodedBuffer.data()), encodedData)); + ASSERT_EQ(decodedBuffer, decoded); +} + +TEST_F(Base64DecoderTest, TestDecoding) +{ + for (auto [encoded, decoded] : TEST_CASES) { + CheckTestCase(encoded, decoded); + } +} + +} // namespace ark::tooling::inspector::test + +// NOLINTEND diff --git a/tooling/static/tests/common.h b/tooling/static/tests/common.h new file mode 100644 index 00000000..4608bede --- /dev/null +++ b/tooling/static/tests/common.h @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TEST_COMMON_H +#define PANDA_TOOLING_INSPECTOR_TEST_COMMON_H + +#include "utils/json_builder.h" +#include "utils/json_parser.h" + +namespace ark::tooling::inspector::test { +template +inline JsonObject ToJson(const T &object) +{ + JsonObjectBuilder jsonBuilder; + object.Serialize(jsonBuilder); + return JsonObject(std::move(jsonBuilder).Build()); +} + +inline JsonObject ToObject(std::function &¶ms) +{ + JsonObjectBuilder jsonBuilder; + params(jsonBuilder); + return JsonObject(std::move(jsonBuilder).Build()); +} + +} // namespace ark::tooling::inspector::test + +#endif // PANDA_TOOLING_INSPECTOR_TEST_JSON_OBJECT_MATCHER_H diff --git a/tooling/static/tests/debug_info_cache.cpp b/tooling/static/tests/debug_info_cache.cpp new file mode 100644 index 00000000..ca96a741 --- /dev/null +++ b/tooling/static/tests/debug_info_cache.cpp @@ -0,0 +1,206 @@ +/** + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "debugger/debug_info_cache.h" + +#include "gtest/gtest.h" + +#include "assembly-emitter.h" +#include "assembly-parser.h" +#include "runtime.h" +#include "runtime_options.h" +#include "thread_scopes.h" + +#include "test_frame.h" + +// NOLINTBEGIN + +namespace ark::tooling::inspector::test { + +static constexpr const char *g_source = R"( + .record Test {} + + .function i32 Test.foo(u64 a0, u64 a1) { + mov v0, v1 # line 2, offset 0, 1 + mov v100, v101 # line 3, offset 2, 3, 4 + movi v0, 4 # line 4, offset 5, 6 + ldai 222 # line 5, offset 7, 8, 9 + return # line 6, offset 10 + } +)"; + +class DebugInfoCacheTest : public testing::Test { +protected: + static void SetUpTestSuite() + { + pandasm::Parser p; + + auto res = p.Parse(g_source, SOURCE_FILE_NAME.data()); + ASSERT_TRUE(res.HasValue()); + ASSERT_TRUE(pandasm::AsmEmitter::Emit(ASM_FILE_NAME.data(), res.Value())); + auto pf = panda_file::OpenPandaFile(ASM_FILE_NAME); + ASSERT_NE(pf, nullptr); + + cache.AddPandaFile(*pf); + + RuntimeOptions options; + options.SetShouldInitializeIntrinsics(false); + options.SetShouldLoadBootPandaFiles(false); + Runtime::Create(options); + + thread_ = ManagedThread::GetCurrent(); + { + ScopedManagedCodeThread s(thread_); + + ClassLinker *classLinker = Runtime::GetCurrent()->GetClassLinker(); + classLinker->AddPandaFile(std::move(pf)); + + PandaString descriptorHolder; + const auto *descriptor = ClassHelper::GetDescriptor(utf::CStringAsMutf8("Test"), &descriptorHolder); + auto *ext = classLinker->GetExtension(panda_file::SourceLang::PANDA_ASSEMBLY); + Class *klass = ext->GetClass(descriptor, true, ext->GetBootContext()); + ASSERT_NE(klass, nullptr); + + auto methods = klass->GetMethods(); + ASSERT_EQ(methods.size(), 1); + methodFoo = &methods[0]; + } + } + + static void TearDownTestSuite() + { + Runtime::Destroy(); + } + + static constexpr std::string_view ASM_FILE_NAME = "source.abc"; + // This test intentionally sets empty source file name to ensure that disassembly is used for debug info + static constexpr std::string_view SOURCE_FILE_NAME = ""; + static DebugInfoCache cache; + static ManagedThread *thread_; + static Method *methodFoo; +}; + +DebugInfoCache DebugInfoCacheTest::cache {}; +ManagedThread *DebugInfoCacheTest::thread_ = nullptr; +Method *DebugInfoCacheTest::methodFoo = nullptr; + +TEST_F(DebugInfoCacheTest, GetCurrentLineLocations) +{ + auto fr0 = TestFrame(methodFoo, 2U); // offset 2, line 3 of function + auto fr1 = TestFrame(methodFoo, 6U); // offset 6, line 4 of function + auto fr2 = TestFrame(methodFoo, 10U); // offset 10, line 6 of function + + auto curr = cache.GetCurrentLineLocations(fr0); + ASSERT_EQ(curr.size(), 3U); + ASSERT_NE(curr.find(PtLocation(ASM_FILE_NAME.data(), methodFoo->GetFileId(), 2U)), curr.end()); + ASSERT_NE(curr.find(PtLocation(ASM_FILE_NAME.data(), methodFoo->GetFileId(), 3U)), curr.end()); + ASSERT_NE(curr.find(PtLocation(ASM_FILE_NAME.data(), methodFoo->GetFileId(), 4U)), curr.end()); + + curr = cache.GetCurrentLineLocations(fr1); + ASSERT_EQ(curr.size(), 2U); + ASSERT_NE(curr.find(PtLocation(ASM_FILE_NAME.data(), methodFoo->GetFileId(), 5U)), curr.end()); + ASSERT_NE(curr.find(PtLocation(ASM_FILE_NAME.data(), methodFoo->GetFileId(), 6U)), curr.end()); + + curr = cache.GetCurrentLineLocations(fr2); + ASSERT_EQ(curr.size(), 1); + ASSERT_NE(curr.find(PtLocation(ASM_FILE_NAME.data(), methodFoo->GetFileId(), 10U)), curr.end()); +} + +TEST_F(DebugInfoCacheTest, GetLocals) +{ + static constexpr size_t ARGUMENTS_COUNT = 2U; + static constexpr size_t LOCALS_COUNT = 103U; + + auto fr0 = TestFrame(methodFoo, 2U); // offset 2, line 3 of function + + for (size_t i = 0; i < ARGUMENTS_COUNT; i++) { + fr0.SetArgument(i, i + 1); + fr0.SetArgumentKind(i, PtFrame::RegisterKind::PRIMITIVE); + } + for (size_t i = 0; i < LOCALS_COUNT; i++) { + fr0.SetVReg(i, i); + fr0.SetVRegKind(i, PtFrame::RegisterKind::PRIMITIVE); + } + auto mapLocals = cache.GetLocals(fr0); + ASSERT_EQ(ARGUMENTS_COUNT + LOCALS_COUNT, mapLocals.size()); + + EXPECT_NO_THROW(mapLocals.at("a0")); + EXPECT_NO_THROW(mapLocals.at("a1")); + EXPECT_NO_THROW(mapLocals.at("v101")); + + ASSERT_EQ(mapLocals.at("a0").GetAsU64(), 1U); + ASSERT_EQ(mapLocals.at("a1").GetAsU64(), 2U); + ASSERT_EQ(mapLocals.at("v101").GetAsU64(), 101U); +} + +TEST_F(DebugInfoCacheTest, GetSourceLocation) +{ + auto fr0 = TestFrame(methodFoo, 2U); // offset 2, line 3 of function + auto fr1 = TestFrame(methodFoo, 6U); // offset 6, line 4 of function + + std::string_view disasm_file; + std::string_view method_name; + size_t line_number = 0; + + cache.GetSourceLocation(fr0, disasm_file, method_name, line_number); + ASSERT_NE(disasm_file.find(ASM_FILE_NAME.data()), std::string::npos); + ASSERT_EQ(method_name, "foo"); + ASSERT_EQ(line_number, 3U); + + cache.GetSourceLocation(fr1, disasm_file, method_name, line_number); + ASSERT_NE(disasm_file.find(ASM_FILE_NAME.data()), std::string::npos); + ASSERT_EQ(method_name, "foo"); + ASSERT_EQ(line_number, 4U); + + auto set_locs = cache.GetContinueToLocations(disasm_file, 4U); + ASSERT_EQ(set_locs.size(), 2U); + ASSERT_NE(set_locs.find(PtLocation(ASM_FILE_NAME.data(), methodFoo->GetFileId(), 6U)), set_locs.end()); + ASSERT_NE(set_locs.find(PtLocation(ASM_FILE_NAME.data(), methodFoo->GetFileId(), 5U)), set_locs.end()); + + set_locs = cache.GetContinueToLocations(disasm_file, 6U); + ASSERT_EQ(set_locs.size(), 1); + ASSERT_NE(set_locs.find(PtLocation(ASM_FILE_NAME.data(), methodFoo->GetFileId(), 10U)), set_locs.end()); + + set_locs = cache.GetContinueToLocations(disasm_file, 1); + ASSERT_EQ(set_locs.size(), 0); + + auto valid_locs = cache.GetValidLineNumbers(disasm_file, 0U, 100U, false); + ASSERT_EQ(valid_locs.size(), 5U); + + ASSERT_NE(valid_locs.find(2U), valid_locs.end()); + ASSERT_NE(valid_locs.find(3U), valid_locs.end()); + ASSERT_NE(valid_locs.find(4U), valid_locs.end()); + ASSERT_NE(valid_locs.find(5U), valid_locs.end()); + ASSERT_NE(valid_locs.find(6U), valid_locs.end()); + + auto s = cache.GetSourceCode(disasm_file); + ASSERT_NE(s.find(".function i32 Test.foo(u64 a0, u64 a1)"), std::string::npos); + + s = cache.GetSourceCode("source.pa"); + ASSERT_TRUE(s.empty()); + + std::set sets; + auto breaks = cache.GetBreakpointLocations([](auto) { return true; }, 4U, sets); + ASSERT_EQ(breaks.size(), 1); + ASSERT_EQ(sets.size(), 1); + ASSERT_EQ(*sets.begin(), disasm_file); + + ASSERT_NE(std::find(breaks.begin(), breaks.end(), PtLocation(ASM_FILE_NAME.data(), methodFoo->GetFileId(), 5U)), + breaks.end()); +} + +} // namespace ark::tooling::inspector::test + +// NOLINTEND diff --git a/tooling/static/tests/inspector_server.cpp b/tooling/static/tests/inspector_server.cpp new file mode 100644 index 00000000..9eeefa86 --- /dev/null +++ b/tooling/static/tests/inspector_server.cpp @@ -0,0 +1,910 @@ +/** + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "inspector_server.h" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include "assembly-emitter.h" +#include "assembly-parser.h" +#include "runtime.h" +#include "types/location.h" +#include "utils/json_builder.h" + +#include "connection/server.h" + +#include "common.h" +#include "json_object_matcher.h" + +// NOLINTBEGIN + +using namespace std::placeholders; + +namespace ark::tooling::inspector::test { + +class TestServer : public Server { +public: + void OnValidate([[maybe_unused]] std::function &&handler) override {}; + void OnOpen([[maybe_unused]] std::function &&handler) override {}; + void OnFail([[maybe_unused]] std::function &&handler) override {}; + + void Call(const std::string &session, const char *method_call, + std::function &¶meters) override + { + std::string tmp(method_call); + CallMock(session, tmp, std::move(parameters)); + } + + void OnCall(const char *method_call, Handler &&handler) override + { + std::string tmp(method_call); + OnCallMock(tmp, std::move(handler)); + } + + MOCK_METHOD(void, CallMock, + (const std::string &session, const std::string &method_call, + std::function &¶meters)); + + MOCK_METHOD(void, OnCallMock, (const std::string &method_call, Handler &&handler)); + + bool RunOne() override + { + return true; + }; +}; + +static PtThread g_mthread = PtThread(PtThread::NONE); +static const std::string g_sessionId; +static const std::string g_sourceFile = "source"; +static bool g_handlerCalled = false; + +class ServerTest : public testing::Test { +public: + void SetUp() override + { + RuntimeOptions options; + options.SetShouldInitializeIntrinsics(false); + options.SetShouldLoadBootPandaFiles(false); + Runtime::Create(options); + g_mthread = PtThread(ManagedThread::GetCurrent()); + g_handlerCalled = false; + } + void TearDown() override + { + Runtime::Destroy(); + } + TestServer server; + InspectorServer inspectorServer {server}; +}; + +TEST_F(ServerTest, CallDebuggerResumed) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + EXPECT_CALL(server, CallMock(g_sessionId, "Debugger.resumed", testing::_)).Times(1); + + inspectorServer.CallDebuggerResumed(g_mthread); +} + +TEST_F(ServerTest, CallDebuggerScriptParsed) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + size_t scriptId = 4; + EXPECT_CALL(server, CallMock(g_sessionId, "Debugger.scriptParsed", testing::_)) + .WillOnce([&](testing::Unused, testing::Unused, auto s) { + ASSERT_THAT(ToObject(std::move(s)), + JsonProperties(JsonProperty {"executionContextId", 0}, + JsonProperty {"scriptId", std::to_string(scriptId)}, + JsonProperty {"startLine", 0}, + JsonProperty {"startColumn", 0}, + JsonProperty {"endLine", std::numeric_limits::max()}, + JsonProperty {"endColumn", std::numeric_limits::max()}, + JsonProperty {"hash", ""}, + JsonProperty {"url", g_sourceFile.c_str()})); + }); + inspectorServer.CallDebuggerScriptParsed(ScriptId(scriptId), g_sourceFile); +} + +using ResultHolder = std::optional; + +static void GetResult(Expected, JRPCError> &&returned, ResultHolder &result) +{ + ASSERT_TRUE(returned.HasValue()); + if (returned.Value() != nullptr) { + JsonObjectBuilder builder; + returned.Value()->Serialize(builder); + result.emplace(std::move(builder).Build()); + } else { + result.emplace("{}"); + } +} + +TEST_F(ServerTest, DebuggerEnable) +{ + TestServer server1; + EXPECT_CALL(server1, OnCallMock("Debugger.enable", testing::_)).WillOnce([&](testing::Unused, auto handler) { + JsonObject empty; + auto res = handler(g_sessionId, empty); + ResultHolder result; + GetResult(std::move(res), result); + std::vector> protocols; + ASSERT_THAT(*result, + JsonProperties(JsonProperty {"debuggerId", 0}, + JsonProperty {"protocols", JsonElementsAreArray(protocols)})); + }); + InspectorServer inspector_server1(server1); + inspector_server1.OnCallDebuggerEnable([] {}); +} + +static auto g_simpleHandler = []([[maybe_unused]] auto unused, auto handler) { + JsonObject empty; + auto res = handler(g_sessionId, empty); + ResultHolder result; + GetResult(std::move(res), result); + ASSERT_THAT(*result, JsonProperties()); + ASSERT_TRUE(g_handlerCalled); +}; + +TEST_F(ServerTest, OnCallDebuggerPause) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.pause", testing::_)).WillOnce(g_simpleHandler); + inspectorServer.OnCallDebuggerPause([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerRemoveBreakpoint) +{ + size_t break_id = 14; + + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.removeBreakpoint", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObject empty; + auto res = handler(g_sessionId, empty); + ASSERT_FALSE(res.HasValue()); + ASSERT_FALSE(g_handlerCalled); + }); + + auto breaks = [break_id](PtThread thread, BreakpointId bid) { + ASSERT_EQ(bid, BreakpointId(break_id)); + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }; + inspectorServer.OnCallDebuggerRemoveBreakpoint(std::move(breaks)); + + EXPECT_CALL(server, OnCallMock("Debugger.removeBreakpoint", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("breakpointId", std::to_string(break_id)); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ResultHolder result; + GetResult(std::move(res), result); + ASSERT_THAT(*result, JsonProperties()); + ASSERT_TRUE(g_handlerCalled); + }); + + inspectorServer.OnCallDebuggerRemoveBreakpoint(std::move(breaks)); +} + +TEST_F(ServerTest, OnCallDebuggerRestartFrame) +{ + size_t fid = 5; + + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.restartFrame", testing::_)).WillOnce([&](testing::Unused, auto handler) { + std::vector> callFrames; + JsonObjectBuilder params; + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ASSERT_FALSE(res.HasValue()); + ASSERT_FALSE(g_handlerCalled); + }); + + inspectorServer.OnCallDebuggerRestartFrame([&](auto, auto) { g_handlerCalled = true; }); + + EXPECT_CALL(server, OnCallMock("Debugger.restartFrame", testing::_)).WillOnce([&](testing::Unused, auto handler) { + std::vector> callFrames; + JsonObjectBuilder params; + params.AddProperty("callFrameId", std::to_string(fid)); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ResultHolder result; + GetResult(std::move(res), result); + ASSERT_THAT(*result, + JsonProperties(JsonProperty {"callFrames", JsonElementsAreArray(callFrames)})); + ASSERT_TRUE(g_handlerCalled); + }); + + inspectorServer.OnCallDebuggerRestartFrame([&](PtThread thread, FrameId id) { + ASSERT_EQ(id, FrameId(fid)); + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerResume) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.resume", testing::_)).WillOnce(g_simpleHandler); + inspectorServer.OnCallDebuggerResume([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +static JsonObject CreatePossibleBreakpointsRequest(ScriptId startScriptId, size_t start, ScriptId endScriptId, + size_t end, bool restrictToFunction) +{ + JsonObjectBuilder params; + params.AddProperty("start", Location(startScriptId, start)); + params.AddProperty("end", Location(endScriptId, end)); + params.AddProperty("restrictToFunction", restrictToFunction); + return JsonObject(std::move(params).Build()); +} + +static auto g_getPossibleBreakpointsHandler = [](ScriptId scriptId, size_t start, size_t end, bool restrictToFunction, + testing::Unused, auto handler) { + auto res = + handler(g_sessionId, CreatePossibleBreakpointsRequest(scriptId, start, scriptId, end, restrictToFunction)); + ResultHolder result; + GetResult(std::move(res), result); + std::vector> locations; + for (auto i = start; i < end; i++) { + locations.push_back( + testing::Pointee(JsonProperties(JsonProperty {"scriptId", std::to_string(scriptId)}, + JsonProperty {"lineNumber", i}))); + } + ASSERT_THAT(*result, + JsonProperties(JsonProperty {"locations", JsonElementsAreArray(locations)})); +}; + +static void DefaultFrameEnumerator(const InspectorServer::FrameInfoHandler &handler) +{ + std::optional objThis; + auto scope_chain = std::vector {Scope(Scope::Type::LOCAL, RemoteObject::Number(72))}; + handler(FrameId(0), std::to_string(0), g_sourceFile, 0, scope_chain, objThis); +} + +TEST_F(ServerTest, OnCallDebuggerGetPossibleBreakpoints) +{ + auto scriptId = 0; + size_t start = 5; + size_t end = 5; + + inspectorServer.CallTargetAttachedToTarget(g_mthread); + inspectorServer.CallDebuggerPaused(g_mthread, {}, {}, PauseReason::OTHER, DefaultFrameEnumerator); + + EXPECT_CALL(server, OnCallMock("Debugger.getPossibleBreakpoints", testing::_)) + .WillOnce(std::bind(g_getPossibleBreakpointsHandler, scriptId, start, end, // NOLINT(modernize-avoid-bind) + true, _1, _2)); + auto getLinesTrue = [](std::string_view source, size_t startLine, size_t endLine, bool restrictToFunction) { + std::set result; + if ((source == g_sourceFile) && restrictToFunction) { + for (auto i = startLine; i < endLine; i++) { + result.insert(i); + } + } + return result; + }; + inspectorServer.OnCallDebuggerGetPossibleBreakpoints(getLinesTrue); + + EXPECT_CALL(server, OnCallMock("Debugger.getPossibleBreakpoints", testing::_)) + .WillOnce(std::bind(g_getPossibleBreakpointsHandler, scriptId, start, end, // NOLINT(modernize-avoid-bind) + false, _1, _2)); + auto getLinesFalse = [](std::string_view source, size_t startLine, size_t endLine, bool restrictToFunction) { + std::set result; + if ((source == g_sourceFile) && !restrictToFunction) { + for (auto i = startLine; i < endLine; i++) { + result.insert(i); + } + } + return result; + }; + inspectorServer.OnCallDebuggerGetPossibleBreakpoints(getLinesFalse); + + EXPECT_CALL(server, OnCallMock("Debugger.getPossibleBreakpoints", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + auto res = + handler(g_sessionId, CreatePossibleBreakpointsRequest(scriptId, start, scriptId + 1, end, false)); + ASSERT_FALSE(res.HasValue()); + }); + inspectorServer.OnCallDebuggerGetPossibleBreakpoints(getLinesFalse); +} + +TEST_F(ServerTest, OnCallDebuggerGetScriptSource) +{ + auto scriptId = 0; + + EXPECT_CALL(server, CallMock(g_sessionId, "Debugger.paused", testing::_)) + .WillOnce([&](testing::Unused, testing::Unused, auto s) { ToObject(std::move(s)); }); + + inspectorServer.CallTargetAttachedToTarget(g_mthread); + inspectorServer.CallDebuggerPaused(g_mthread, {}, {}, PauseReason::OTHER, DefaultFrameEnumerator); + + EXPECT_CALL(server, OnCallMock("Debugger.getScriptSource", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("scriptId", std::to_string(scriptId)); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ResultHolder result; + GetResult(std::move(res), result); + ASSERT_THAT(*result, JsonProperties(JsonProperty {"scriptSource", g_sourceFile})); + }); + inspectorServer.OnCallDebuggerGetScriptSource([](auto source) { + std::string s(source); + return s; + }); + + EXPECT_CALL(server, OnCallMock("Debugger.getScriptSource", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObject empty; + auto res = handler(g_sessionId, empty); + ASSERT_FALSE(res.HasValue()); + }); + inspectorServer.OnCallDebuggerGetScriptSource([](auto) { return "a"; }); +} + +TEST_F(ServerTest, OnCallDebuggerStepOut) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.stepOut", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerStepOut([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerStepInto) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.stepInto", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerStepInto([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerStepOver) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.stepOver", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerStepOver([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +std::optional handlerForSetBreak([[maybe_unused]] PtThread thread, + [[maybe_unused]] const std::function &comp, + size_t line, [[maybe_unused]] std::set &sources, + [[maybe_unused]] const std::string *condition) +{ + sources.insert("source"); + return BreakpointId(line); +} + +std::optional handlerForSetBreakEmpty([[maybe_unused]] PtThread thread, + [[maybe_unused]] const std::function &comp, + [[maybe_unused]] size_t line, + [[maybe_unused]] std::set &sources, + [[maybe_unused]] const std::string *condition) +{ + sources.insert("source"); + return {}; +} + +TEST_F(ServerTest, OnCallDebuggerSetBreakpoint) +{ + auto scriptId = 0; + size_t start = 5; + + inspectorServer.CallTargetAttachedToTarget(g_mthread); + inspectorServer.CallDebuggerPaused(g_mthread, {}, {}, PauseReason::OTHER, DefaultFrameEnumerator); + + EXPECT_CALL(server, OnCallMock("Debugger.setBreakpoint", testing::_)).WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("location", Location(scriptId, start)); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ResultHolder result; + GetResult(std::move(res), result); + ASSERT_THAT(*result, + JsonProperties(JsonProperty {"breakpointId", std::to_string(start)}, + JsonProperty { + "actualLocation", + testing::Pointee(JsonProperties( + JsonProperty {"scriptId", std::to_string(scriptId)}, + JsonProperty {"lineNumber", start - 1}))})); + }); + + inspectorServer.OnCallDebuggerSetBreakpoint(handlerForSetBreak); + + EXPECT_CALL(server, OnCallMock("Debugger.setBreakpoint", testing::_)).WillOnce([&](testing::Unused, auto handler) { + JsonObject empty; + auto res = handler(g_sessionId, empty); + ASSERT_FALSE(res.HasValue()); + }); + + inspectorServer.OnCallDebuggerSetBreakpoint(handlerForSetBreak); + + EXPECT_CALL(server, OnCallMock("Debugger.setBreakpoint", testing::_)).WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("location", Location(scriptId, start)); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ASSERT_FALSE(res.HasValue()); + }); + + inspectorServer.OnCallDebuggerSetBreakpoint(handlerForSetBreakEmpty); +} + +TEST_F(ServerTest, OnCallDebuggerSetBreakpointByUrl) +{ + auto scriptId = 0; + size_t start = 5; + + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.setBreakpointByUrl", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("lineNumber", start); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ASSERT_FALSE(res.HasValue()); + }); + + inspectorServer.OnCallDebuggerSetBreakpointByUrl(handlerForSetBreak); + + EXPECT_CALL(server, OnCallMock("Debugger.setBreakpointByUrl", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("lineNumber", start); + params.AddProperty("url", "file://source"); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ResultHolder result; + GetResult(std::move(res), result); + + std::vector> locations; + locations.push_back(testing::Pointee( + JsonProperties(JsonProperty {"scriptId", std::to_string(scriptId)}, + JsonProperty {"lineNumber", start}))); + auto expected = + JsonProperties(JsonProperty {"breakpointId", std::to_string(start + 1)}, + JsonProperty {"locations", JsonElementsAreArray(locations)}); + + ASSERT_THAT(*result, expected); + }); + + inspectorServer.OnCallDebuggerSetBreakpointByUrl(handlerForSetBreak); +} + +TEST_F(ServerTest, OnCallDebuggerSetBreakpointsActive) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.setBreakpointsActive", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObject empty; + auto res = handler(g_sessionId, empty); + ASSERT_FALSE(res.HasValue()); + ASSERT_FALSE(g_handlerCalled); + }); + + inspectorServer.OnCallDebuggerSetBreakpointsActive([](auto thread, auto value) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + ASSERT_FALSE(value); + g_handlerCalled = true; + }); + + EXPECT_CALL(server, OnCallMock("Debugger.setBreakpointsActive", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("active", true); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ResultHolder result; + GetResult(std::move(res), result); + ASSERT_THAT(*result, JsonProperties()); + ASSERT_TRUE(g_handlerCalled); + g_handlerCalled = false; + }); + + inspectorServer.OnCallDebuggerSetBreakpointsActive([](auto thread, auto value) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + ASSERT_TRUE(value); + g_handlerCalled = true; + }); + + EXPECT_CALL(server, OnCallMock("Debugger.setBreakpointsActive", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("active", false); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ResultHolder result; + GetResult(std::move(res), result); + ASSERT_THAT(*result, JsonProperties()); + ASSERT_TRUE(g_handlerCalled); + }); + + inspectorServer.OnCallDebuggerSetBreakpointsActive([](auto thread, auto value) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + ASSERT_FALSE(value); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerSetPauseOnExceptions) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.setPauseOnExceptions", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("state", "none"); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ResultHolder result; + GetResult(std::move(res), result); + ASSERT_THAT(*result, JsonProperties()); + ASSERT_TRUE(g_handlerCalled); + }); + + inspectorServer.OnCallDebuggerSetPauseOnExceptions([](PtThread thread, PauseOnExceptionsState state) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + ASSERT_EQ(PauseOnExceptionsState::NONE, state); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerDisable) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.disable", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerDisable([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerClientDisconnect) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.clientDisconnect", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerClientDisconnect([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerSetAsyncCallStackDepth) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.setAsyncCallStackDepth", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerSetAsyncCallStackDepth([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerSetBlackboxPatterns) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.setBlackboxPatterns", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerSetBlackboxPatterns([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerSmartStepInto) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.smartStepInto", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerSmartStepInto([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerDropFrame) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.dropFrame", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerDropFrame([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerSetNativeRange) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.setNativeRange", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerSetNativeRange([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerReplyNativeCalling) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.replyNativeCalling", testing::_)).WillOnce(g_simpleHandler); + + inspectorServer.OnCallDebuggerReplyNativeCalling([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerContinueToLocation) +{ + auto scriptId = 0; + size_t start = 5; + + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.continueToLocation", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("location", Location(scriptId, start)); + handler(g_sessionId, JsonObject(std::move(params).Build())); + }); + + inspectorServer.OnCallDebuggerContinueToLocation([](PtThread thread, std::string_view, size_t) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallDebuggerSetSkipAllPauses) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.setSkipAllPauses", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("skip", true); + handler(g_sessionId, JsonObject(std::move(params).Build())); + }); + + inspectorServer.OnCallDebuggerSetSkipAllPauses([](PtThread thread, bool) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +Expected handlerForEvaluateFailed([[maybe_unused]] PtThread thread, + [[maybe_unused]] const std::string &bytecodeBase64, + [[maybe_unused]] size_t frameNumber) +{ + return Unexpected(std::string("evaluate failed")); +} + +Expected handlerForEvaluate([[maybe_unused]] PtThread thread, + [[maybe_unused]] const std::string &bytecodeBase64, + [[maybe_unused]] size_t frameNumber) +{ + return Unexpected(std::string("evaluation failed")); +} + +TEST_F(ServerTest, OnCallDebuggerEvaluateOnCallFrame) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.evaluateOnCallFrame", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("callFrameId", -1); + params.AddProperty("expression", "any expression"); + + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ASSERT_FALSE(res.HasValue()); + }); + + inspectorServer.OnCallDebuggerEvaluateOnCallFrame(handlerForEvaluateFailed); +} + +TEST_F(ServerTest, OnCallDebuggerCallFunctionOn) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.callFunctionOn", testing::_)).WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("callFrameId", -1); + params.AddProperty("functionDeclaration", "any functionDeclaration"); + + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ASSERT_FALSE(res.HasValue()); + }); + + inspectorServer.OnCallDebuggerCallFunctionOn(handlerForEvaluateFailed); +} + +TEST_F(ServerTest, OnCallDebuggerGetPossibleAndSetBreakpointByUrl) +{ + auto scriptId = 0; + size_t start1 = 5; + size_t start2 = 6; + + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Debugger.getPossibleAndSetBreakpointByUrl", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + class RequestLocation : public JsonSerializable { + public: + explicit RequestLocation(std::string url, size_t lineNumber) : url_(url), lineNumber_(lineNumber) {} + + void Serialize(JsonObjectBuilder &builder) const override + { + builder.AddProperty("url", url_); + builder.AddProperty("lineNumber", lineNumber_); + } + + private: + std::string url_; + size_t lineNumber_; + }; + std::vector requestLocations = {RequestLocation("file://source", start1), + RequestLocation("file://source", start2)}; + JsonObjectBuilder builder; + builder.AddProperty("locations", [&](JsonArrayBuilder &locations) { + for (const auto &loc : requestLocations) { + locations.Add(loc); + } + }); + + auto res = handler(g_sessionId, JsonObject(std::move(builder).Build())); + ResultHolder result; + GetResult(std::move(res), result); + + std::vector> locations; + locations.push_back(testing::Pointee(JsonProperties(JsonProperty {"scriptId", scriptId}, + JsonProperty {"lineNumber", start1}, + JsonProperty {"columnNumber", 0}, + JsonProperty {"id", "6"}))); + locations.push_back(testing::Pointee(JsonProperties(JsonProperty {"scriptId", scriptId}, + JsonProperty {"lineNumber", start2}, + JsonProperty {"columnNumber", 0}, + JsonProperty {"id", "7"}))); + auto expected = + JsonProperties(JsonProperty {"locations", JsonElementsAreArray(locations)}); + + ASSERT_THAT(*result, expected); + }); + + inspectorServer.OnCallDebuggerGetPossibleAndSetBreakpointByUrl(handlerForSetBreak); +} + +TEST_F(ServerTest, OnCallRuntimeEnable) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Runtime.enable", testing::_)).WillOnce([&](testing::Unused, auto handler) { + JsonObject empty; + auto res = handler(g_sessionId, empty); + ResultHolder result; + GetResult(std::move(res), result); + ASSERT_THAT(*result, JsonProperties()); + ASSERT_TRUE(g_handlerCalled); + }); + inspectorServer.OnCallRuntimeEnable([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +TEST_F(ServerTest, OnCallRuntimeGetProperties) +{ + auto object_id = 6; + auto preview = true; + + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Runtime.getProperties", testing::_)).WillOnce([&](testing::Unused, auto handler) { + JsonObjectBuilder params; + params.AddProperty("objectId", std::to_string(object_id)); + params.AddProperty("generatePreview", preview); + auto res = handler(g_sessionId, JsonObject(std::move(params).Build())); + ResultHolder result; + GetResult(std::move(res), result); + + std::vector> expected; + expected.push_back(testing::Pointee(JsonProperties( + JsonProperty {"name", "object"}, + JsonProperty { + "value", testing::Pointee(JsonProperties(JsonProperty {"value", object_id}, + JsonProperty {"type", "number"}))}, + JsonProperty {"writable", testing::_}, + JsonProperty {"configurable", testing::_}, + JsonProperty {"enumerable", testing::_}))); + expected.push_back(testing::Pointee(JsonProperties( + JsonProperty {"name", "preview"}, + JsonProperty { + "value", testing::Pointee(JsonProperties(JsonProperty {"value", preview}, + JsonProperty {"type", "boolean"}))}, + JsonProperty {"writable", testing::_}, + JsonProperty {"configurable", testing::_}, + JsonProperty {"enumerable", testing::_}))); + expected.push_back(testing::Pointee(JsonProperties( + JsonProperty {"name", "threadId"}, + JsonProperty { + "value", testing::Pointee(JsonProperties(JsonProperty {"value", g_mthread.GetId()}, + JsonProperty {"type", "number"}))}, + JsonProperty {"writable", testing::_}, + JsonProperty {"configurable", testing::_}, + JsonProperty {"enumerable", testing::_}))); + + ASSERT_THAT(*result, + JsonProperties(JsonProperty {"result", JsonElementsAreArray(expected)})); + }); + + auto getProperties = [](PtThread thread, RemoteObjectId id, bool need_preview) { + std::vector res; + res.push_back(PropertyDescriptor("object", RemoteObject::Number(id))); + res.push_back(PropertyDescriptor("preview", RemoteObject::Boolean(need_preview))); + res.push_back(PropertyDescriptor("threadId", RemoteObject::Number(thread.GetId()))); + return res; + }; + + inspectorServer.OnCallRuntimeGetProperties(getProperties); +} + +TEST_F(ServerTest, OnCallRuntimeRunIfWaitingForDebugger) +{ + inspectorServer.CallTargetAttachedToTarget(g_mthread); + + EXPECT_CALL(server, OnCallMock("Runtime.runIfWaitingForDebugger", testing::_)) + .WillOnce([&](testing::Unused, auto handler) { + JsonObject empty; + auto res = handler(g_sessionId, empty); + ResultHolder result; + GetResult(std::move(res), result); + ASSERT_THAT(*result, JsonProperties()); + ASSERT_TRUE(g_handlerCalled); + }); + + inspectorServer.OnCallRuntimeRunIfWaitingForDebugger([](PtThread thread) { + ASSERT_EQ(thread.GetId(), g_mthread.GetId()); + g_handlerCalled = true; + }); +} + +} // namespace ark::tooling::inspector::test + +// NOLINTEND diff --git a/tooling/static/tests/json_object_matcher.cpp b/tooling/static/tests/json_object_matcher.cpp new file mode 100644 index 00000000..6e8a68f2 --- /dev/null +++ b/tooling/static/tests/json_object_matcher.cpp @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "json_object_matcher.h" + +namespace ark { + +std::ostream &operator<<(std::ostream &os, const JsonObject::Value &value) +{ + if (auto *string = value.Get()) { + return os << std::quoted(*string); + } + if (auto *number = value.Get()) { + return os << *number; + } + if (auto *boolean = value.Get()) { + return os << std::boolalpha << *boolean; + } + if (auto *array = value.Get()) { + return os << *array; + } + if (auto *object = value.Get()) { + if (*object) { + return os << **object; + } + return os << "null"; + } + + UNREACHABLE(); +} + +} // namespace ark diff --git a/tooling/static/tests/json_object_matcher.h b/tooling/static/tests/json_object_matcher.h new file mode 100644 index 00000000..e6fb9bcf --- /dev/null +++ b/tooling/static/tests/json_object_matcher.h @@ -0,0 +1,238 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TEST_JSON_OBJECT_MATCHER_H +#define PANDA_TOOLING_INSPECTOR_TEST_JSON_OBJECT_MATCHER_H + +#include +#include +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include "macros.h" +#include "utils/json_parser.h" + +// NOLINTBEGIN + +namespace ark::tooling::inspector::test { +template +constexpr const char *PropertyTypeName(); + +template <> +constexpr const char *PropertyTypeName() +{ + return "array"; +} + +template <> +constexpr const char *PropertyTypeName() +{ + return "boolean"; +} + +template <> +constexpr const char *PropertyTypeName() +{ + return "object"; +} + +template <> +constexpr const char *PropertyTypeName() +{ + return "number"; +} + +template <> +constexpr const char *PropertyTypeName() +{ + return "string"; +} + +template +struct JsonProperty { + const char *key; + testing::Matcher value_matcher; + + template + void DescribeKeyTo(OutputStream *os) const + { + *os << "property " << std::quoted(key) << " of type " << PropertyTypeName(); + } + + void DescribeTo(std::ostream *os) const + { + DescribeKeyTo(os); + *os << " which "; + value_matcher.DescribeTo(os); + } +}; + +template +class HasJsonPropertyMatcher : public testing::MatcherInterface { +public: + explicit HasJsonPropertyMatcher(JsonProperty property) : property_(std::move(property)) {} + + HasJsonPropertyMatcher(const char *key, testing::Matcher value_matcher) + : property_ {key, value_matcher} + { + } + + void DescribeTo(std::ostream *os) const override + { + *os << "has "; + property_.DescribeTo(os); + } + + void DescribeNegationTo(std::ostream *os) const override + { + *os << "does not have a "; + property_.DescribeTo(os); + } + + bool MatchAndExplain(const JsonObject &object, testing::MatchResultListener *os) const override + { + auto value_ptr = object.GetValue(property_.key); + + if (!value_ptr) { + *os << "no "; + property_.DescribeKeyTo(os); + return false; + } + + return property_.value_matcher.MatchAndExplain(*value_ptr, os); + } + +private: + JsonProperty property_; +}; + +template +class JsonObjectMatcher : public testing::MatcherInterface { +public: + explicit JsonObjectMatcher(JsonProperty... property) : properties_ {property...} {} + + void DescribeTo(std::ostream *os) const override + { + *os << "is "; + DescribeInternalTo(os); + } + + void DescribeNegationTo(std::ostream *os) const override + { + *os << "isn't "; + DescribeInternalTo(os); + } + + bool MatchAndExplain(const JsonObject &object, testing::MatchResultListener *os) const override + { + if (object.GetSize() != sizeof...(PropertyType)) { + *os << "number of properties doesn't match"; + return false; + } + + return std::apply( + [&](JsonProperty... property) { + return (HasJsonPropertyMatcher(property).MatchAndExplain(object, os) && ...); + }, + properties_); + } + +private: + void DescribeInternalTo(std::ostream *os) const + { + if constexpr (sizeof...(PropertyType) == 0) { + *os << "an empty JsonObject"; + } else { + *os << "a JsonObject with properties: "; + + std::apply( + [os](auto first_property, auto... property) { + first_property.DescribeTo(os); + ((*os << ", ", property.DescribeTo(os)), ...); + }, + properties_); + } + } + + std::tuple...> properties_; +}; + +template +auto JsonProperties(JsonProperty... property) +{ + return testing::Matcher(new JsonObjectMatcher(property...)); +} + +template +auto JsonElements(testing::Matcher... matcher) +{ + return testing::ElementsAre( + Property(PropertyTypeName(), &JsonObject::Value::Get, Pointee(matcher))...); +} + +template class Container, typename... Param> +auto JsonElementsAreArray(const Container, Param...> &container) +{ + std::vector> elements; + + std::transform(container.begin(), container.end(), std::back_inserter(elements), [](auto &matcher) { + return Property(PropertyTypeName(), &JsonObject::Value::Get, Pointee(matcher)); + }); + + return ElementsAreArray(elements); +} +} // namespace ark::tooling::inspector::test + +namespace ark { +std::ostream &operator<<(std::ostream &os, const JsonObject::Value &value); + +inline std::ostream &operator<<(std::ostream &os, const JsonObject &object) +{ + os << '{'; + + const char *delim = ""; + + for (auto &[key, value] : object.GetUnorderedMap()) { + os << delim << std::quoted(key) << ": " << value; + delim = ", "; + } + + return os << '}'; +} + +inline std::ostream &operator<<(std::ostream &os, const JsonObject::ArrayT &array) +{ + os << '['; + + const char *delim = ""; + + for (auto &value : array) { + os << delim << value; + delim = ", "; + } + + return os << ']'; +} +} // namespace ark + +// NOLINTEND + +#endif // PANDA_TOOLING_INSPECTOR_TEST_JSON_OBJECT_MATCHER_H diff --git a/tooling/static/tests/object_repository.cpp b/tooling/static/tests/object_repository.cpp new file mode 100644 index 00000000..84b89f63 --- /dev/null +++ b/tooling/static/tests/object_repository.cpp @@ -0,0 +1,212 @@ +/** + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "debugger/object_repository.h" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include "assembly-emitter.h" +#include "assembly-parser.h" +#include "runtime.h" +#include "runtime_options.h" +#include "tooling/debugger.h" + +#include "types/numeric_id.h" + +#include "common.h" +#include "json_object_matcher.h" + +// NOLINTBEGIN + +namespace ark::tooling::inspector::test { + +static constexpr const char *g_source = R"( + .record Test {} + + .function i32 Test.foo() { + ldai 111 + return + } +)"; + +class ObjectRepositoryTest : public testing::Test { +protected: + static void SetUpTestSuite() + { + RuntimeOptions options; + options.SetShouldInitializeIntrinsics(false); + options.SetShouldLoadBootPandaFiles(false); + Runtime::Create(options); + thread_ = ark::MTManagedThread::GetCurrent(); + thread_->ManagedCodeBegin(); + + pandasm::Parser p; + + auto res = p.Parse(g_source, "source.pa"); + ASSERT_TRUE(res.HasValue()); + auto pf = pandasm::AsmEmitter::Emit(res.Value()); + ASSERT(pf); + ClassLinker *classLinker = Runtime::GetCurrent()->GetClassLinker(); + classLinker->AddPandaFile(std::move(pf)); + + PandaString descriptor; + auto *ext = classLinker->GetExtension(panda_file::SourceLang::PANDA_ASSEMBLY); + Class *klass = ext->GetClass(ClassHelper::GetDescriptor(utf::CStringAsMutf8("Test"), &descriptor)); + ASSERT_NE(klass, nullptr); + + auto methods = klass->GetMethods(); + ASSERT_EQ(methods.size(), 1); + + clsObject = klass->GetManagedObject(); + methodFoo = &methods[0]; + } + + static void TearDownTestSuite() + { + thread_->ManagedCodeEnd(); + Runtime::Destroy(); + } + + static constexpr uint16_t U16_VALUE = 43602; + static constexpr int32_t I32_VALUE = -2345678; + static constexpr int64_t I64_VALUE = 200000000000002; + static constexpr double F64_VALUE = 6.547; + + static ark::MTManagedThread *thread_; + static Method *methodFoo; + static ObjectHeader *clsObject; +}; + +ark::MTManagedThread *ObjectRepositoryTest::thread_ = nullptr; +Method *ObjectRepositoryTest::methodFoo = nullptr; +ObjectHeader *ObjectRepositoryTest::clsObject = nullptr; + +template +static auto GetPrimitiveProperties(const char *type, V value, const char *valueName = "value") +{ + return JsonProperties(JsonProperty {"type", type}, JsonProperty {valueName, value}); +} + +template +static auto GetObjectProperties(NameT className, DescT description, const char *objectId) +{ + return JsonProperties(JsonProperty {"type", "object"}, + JsonProperty {"className", className}, + JsonProperty {"description", description}, + JsonProperty {"objectId", objectId}); +} + +template +static auto GetFrameObjectProperties(NameT name, V valueProperties) +{ + return JsonProperties(JsonProperty {"name", name}, + JsonProperty {"value", valueProperties}, + JsonProperty {"writable", testing::_}, + JsonProperty {"configurable", testing::_}, + JsonProperty {"enumerable", testing::_}); +} + +TEST_F(ObjectRepositoryTest, S) +{ + ObjectRepository obj; + + auto clsObj = obj.CreateObject(TypedValue::Reference(clsObject)); + ASSERT_EQ(clsObj.GetObjectId(), RemoteObjectId(1)); + ASSERT_THAT(ToJson(clsObj), GetObjectProperties(testing::_, testing::_, "1")); + + auto nullObj = obj.CreateObject(TypedValue::Reference(nullptr)); + ASSERT_THAT(ToJson(nullObj), JsonProperties(JsonProperty {"type", "object"}, + JsonProperty {"subtype", "null"}, + JsonProperty {"value", testing::IsNull()})); + + auto invObj = obj.CreateObject(TypedValue::Invalid()); + ASSERT_THAT(ToJson(invObj), JsonProperties(JsonProperty {"type", "undefined"})); + + auto boolObj = obj.CreateObject(TypedValue::U1(true)); + ASSERT_THAT(ToJson(boolObj), GetPrimitiveProperties("boolean", true)); + + auto numObj = obj.CreateObject(TypedValue::U16(U16_VALUE)); + ASSERT_THAT(ToJson(numObj), GetPrimitiveProperties("number", U16_VALUE)); + + auto negObj = obj.CreateObject(TypedValue::I32(I32_VALUE)); + ASSERT_THAT(ToJson(negObj), GetPrimitiveProperties("number", I32_VALUE)); + + auto hugeObj = obj.CreateObject(TypedValue::I64(I64_VALUE)); + ASSERT_THAT(ToJson(hugeObj), + GetPrimitiveProperties("bigint", "200000000000002", "unserializableValue")); + + auto doubObj = obj.CreateObject(TypedValue::F64(F64_VALUE)); + ASSERT_THAT(ToJson(doubObj), GetPrimitiveProperties("number", testing::DoubleEq(F64_VALUE))); + + auto globObj1 = obj.CreateGlobalObject(); + ASSERT_THAT(ToJson(globObj1), GetObjectProperties("[Global]", "Global object", "0")); + + auto globObj2 = obj.CreateGlobalObject(); + ASSERT_THAT(ToJson(globObj2), GetObjectProperties("[Global]", "Global object", "0")); + + PtDebugFrame frame(methodFoo, nullptr); + std::map locals; + locals.emplace("a", TypedValue::U16(56U)); + locals.emplace("ref", TypedValue::Reference(clsObject)); + // "this" parameter for static languages. Note that ArkTS uses "=t" instead of "this". + locals.emplace("this", TypedValue::Reference(clsObject)); + + std::optional objThis; + auto frameObj = obj.CreateFrameObject(frame, locals, objThis); + ASSERT_EQ(frameObj.GetObjectId().value(), RemoteObjectId(2UL)); + + auto properties = obj.GetProperties(frameObj.GetObjectId().value(), false); + ASSERT_EQ(properties.size(), 2UL); + ASSERT_EQ(properties[0].GetName(), "a"); + + ASSERT_THAT(ToJson(frameObj), GetObjectProperties("", "Frame #0", "2")); + + ASSERT_THAT( + ToJson(properties[0]), + GetFrameObjectProperties("a", testing::Pointee(GetPrimitiveProperties("number", 56U)))); + + ASSERT_THAT(ToJson(properties[1]), + GetFrameObjectProperties("ref", testing::Pointee(GetObjectProperties(testing::_, testing::_, "1")))); + + // Call to "CreateFrameObject" must find and fill "this" parameter. + ASSERT_TRUE(objThis.has_value()); + auto idThis = objThis->GetObjectId(); + ASSERT_TRUE(idThis.has_value()); + ASSERT_EQ(idThis.value(), 1U); +} + +TEST_F(ObjectRepositoryTest, TestFrameObjectNoThis) +{ + ObjectRepository obj; + + PtDebugFrame frame(methodFoo, nullptr); + std::map locals; + locals.emplace("a", TypedValue::U16(56U)); + locals.emplace("ref", TypedValue::Reference(clsObject)); + + std::optional objThis; + auto frameObj = obj.CreateFrameObject(frame, locals, objThis); + ASSERT_EQ(frameObj.GetObjectId().value(), RemoteObjectId(2UL)); + + auto properties = obj.GetProperties(frameObj.GetObjectId().value(), true); + ASSERT_EQ(properties.size(), 2UL); + + // No "this" parameter was provided. + ASSERT_FALSE(objThis.has_value()); +} +} // namespace ark::tooling::inspector::test + +// NOLINTEND diff --git a/tooling/static/tests/session_manager.cpp b/tooling/static/tests/session_manager.cpp new file mode 100644 index 00000000..278f8aba --- /dev/null +++ b/tooling/static/tests/session_manager.cpp @@ -0,0 +1,111 @@ +/** + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "session_manager.h" + +#include + +#include "gtest/gtest.h" + +#include "runtime.h" +#include "runtime_options.h" + +// NOLINTBEGIN + +namespace ark::tooling::inspector::test { +class SessionManagerTest : public testing::Test { +protected: + void SetUp() + { + RuntimeOptions options; + options.SetShouldInitializeIntrinsics(false); + options.SetShouldLoadBootPandaFiles(false); + Runtime::Create(options); + } + void TearDown() + { + Runtime::Destroy(); + } + + SessionManager sm_; +}; + +class SessionManagerTestDeath : public SessionManagerTest {}; + +void RunMThread(std::atomic *sync_flag, [[maybe_unused]] PtThread *thread) +{ + auto *m_thr = MTManagedThread::Create(Runtime::GetCurrent(), Runtime::GetCurrent()->GetPandaVM()); + auto pt_thr = PtThread(m_thr); + *thread = pt_thr; + + *sync_flag = true; + + while (*sync_flag) { + } + m_thr->Destroy(); +} + +TEST_F(SessionManagerTest, Test) +{ + std::atomic sync_flag0 = false; + std::atomic sync_flag1 = false; + std::atomic sync_flag2 = false; + + std::vector pt_threads = {PtThread::NONE, PtThread::NONE, PtThread::NONE, + PtThread(ManagedThread::GetCurrent())}; + + std::thread thread0(RunMThread, &sync_flag0, &pt_threads[0U]); + std::thread thread1(RunMThread, &sync_flag1, &pt_threads[1U]); + std::thread thread2(RunMThread, &sync_flag2, &pt_threads[2U]); + + while (!sync_flag0 || !sync_flag1 || !sync_flag2) { + ; + } + + for (auto thread : pt_threads) { + ASSERT_NE(thread, PtThread::NONE); + auto id = sm_.AddSession(thread); + ASSERT_EQ(sm_.GetSessionIdByThread(thread), id); + + auto test = sm_.GetThreadBySessionId(id); + ASSERT_EQ(test, thread); + } + + size_t sessions = 0; + sm_.EnumerateSessions([&sessions, &pt_threads](auto, auto thread) { + sessions++; + ASSERT_NE(std::find(pt_threads.begin(), pt_threads.end(), thread), pt_threads.end()); + }); + ASSERT_EQ(sessions, 4UL); + + sm_.RemoveSession(sm_.GetSessionIdByThread(pt_threads[0])); + sm_.EnumerateSessions([&sessions, &pt_threads](auto, auto thread) { + sessions++; + ASSERT_NE(std::find(pt_threads.begin(), pt_threads.end(), thread), pt_threads.end()); + }); + ASSERT_EQ(sessions, 7UL); + + sync_flag0 = false; + sync_flag1 = false; + sync_flag2 = false; + + thread0.join(); + thread1.join(); + thread2.join(); +} + +} // namespace ark::tooling::inspector::test + +// NOLINTEND \ No newline at end of file diff --git a/tooling/static/tests/source_manager.cpp b/tooling/static/tests/source_manager.cpp new file mode 100644 index 00000000..0230cfa5 --- /dev/null +++ b/tooling/static/tests/source_manager.cpp @@ -0,0 +1,96 @@ +/** + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" + +#include "runtime.h" +#include "runtime_options.h" +#include "source_manager.h" + +// NOLINTBEGIN + +namespace ark::tooling::inspector::test { +class SourceManagerTest : public testing::Test { +protected: + void SetUp() + { + RuntimeOptions options; + options.SetShouldInitializeIntrinsics(false); + options.SetShouldLoadBootPandaFiles(false); + Runtime::Create(options); + } + void TearDown() + { + Runtime::Destroy(); + } + + SourceManager sm_; +}; + +void RunManagedThread(std::atomic *sync_flag, [[maybe_unused]] PtThread *thread) +{ + auto *m_thr = MTManagedThread::Create(Runtime::GetCurrent(), Runtime::GetCurrent()->GetPandaVM()); + auto pt_thr = PtThread(m_thr); + *thread = pt_thr; + + *sync_flag = true; + + while (*sync_flag) { + } + m_thr->Destroy(); +} + +TEST_F(SourceManagerTest, General) +{ + std::atomic sync_flag1 = false; + PtThread pt_thread1 = PtThread::NONE; + std::thread mthread1(RunManagedThread, &sync_flag1, &pt_thread1); + + while (!sync_flag1) { + ; + } + + auto test_id0 = sm_.GetScriptId("test.pa"); + ASSERT_EQ(test_id0, ScriptId(0)); + + ASSERT_EQ(sm_.GetSourceFileName(test_id0), "test.pa"); + ASSERT_EQ(sm_.GetSourceFileName(ScriptId(1)), ""); + + test_id0 = sm_.GetScriptId("test.pa"); + ASSERT_EQ(test_id0, ScriptId(0)); + + auto test_id1 = sm_.GetScriptId("test1.pa"); + ASSERT_EQ(test_id1, ScriptId(1)); + + auto test_id2 = sm_.GetScriptId("test2.pa"); + auto test_id3 = sm_.GetScriptId("test3.pa"); + ASSERT_EQ(sm_.GetSourceFileName(test_id2), "test2.pa"); + ASSERT_EQ(sm_.GetSourceFileName(test_id3), "test3.pa"); + + ASSERT_EQ(sm_.GetSourceFileName(ScriptId(5U)), ""); + + ASSERT_EQ(sm_.GetSourceFileName(test_id2), "test2.pa"); + + test_id0 = sm_.GetScriptId("test.pa"); + ASSERT_EQ(test_id0, ScriptId(0)); + + sync_flag1 = false; + + mthread1.join(); +} + +} // namespace ark::tooling::inspector::test + +// NOLINTEND diff --git a/tooling/static/tests/test_frame.h b/tooling/static/tests/test_frame.h new file mode 100644 index 00000000..74160a65 --- /dev/null +++ b/tooling/static/tests/test_frame.h @@ -0,0 +1,170 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TEST_TEST_FRAME_H +#define PANDA_TOOLING_INSPECTOR_TEST_TEST_FRAME_H + +#include +#include +#include + +#include "include/method.h" +#include "include/tooling/debug_interface.h" +#include "include/tooling/pt_thread.h" +#include "macros.h" +#include "utils/list.h" + +// NOLINTBEGIN + +namespace ark::tooling::inspector::test { +class TestFrame : public PtFrame { +public: + explicit TestFrame(Method *method, uint32_t bytecode_offset) : method_(method), bytecode_offset_(bytecode_offset) {} + + ~TestFrame() override {} + + bool IsInterpreterFrame() const override + { + return true; + } + + void SetMethod(Method *method) + { + method_ = method; + } + + Method *GetMethod() const override + { + return method_; + } + + void SetVReg(size_t index, uint64_t value) + { + if (vregs_.size() <= index) { + vregs_.resize(index + 1); + } + vregs_[index] = value; + } + + uint64_t GetVReg(size_t index) const override + { + return vregs_[index]; + } + + void SetVRegKind(size_t index, RegisterKind value) + { + if (vreg_kinds_.size() <= index) { + vreg_kinds_.resize(index + 1); + } + vreg_kinds_[index] = value; + } + + RegisterKind GetVRegKind(size_t i) const override + { + return vreg_kinds_[i]; + } + + size_t GetVRegNum() const override + { + return vregs_.size(); + } + + void SetArgument(size_t index, uint64_t value) + { + if (args_.size() <= index) { + args_.resize(index + 1); + } + args_[index] = value; + } + + uint64_t GetArgument(size_t index) const override + { + return args_[index]; + } + + void SetArgumentKind(size_t index, RegisterKind value) + { + if (arg_kinds_.size() <= index) { + arg_kinds_.resize(index + 1); + } + arg_kinds_[index] = value; + } + + RegisterKind GetArgumentKind(size_t i) const override + { + return arg_kinds_[i]; + } + + size_t GetArgumentNum() const override + { + return args_.size(); + } + + void SetAccumulator(uint64_t value) + { + acc_ = value; + } + + uint64_t GetAccumulator() const override + { + return acc_; + } + + RegisterKind GetAccumulatorKind() const override + { + return acc_kind_; + } + + panda_file::File::EntityId GetMethodId() const override + { + return method_->GetFileId(); + } + + void SetBytecodeOffset(uint32_t bytecode_offset) + { + bytecode_offset_ = bytecode_offset; + } + + uint32_t GetBytecodeOffset() const override + { + return bytecode_offset_; + } + + std::string GetPandaFile() const override + { + return method_->GetPandaFile()->GetFilename(); + } + + uint32_t GetFrameId() const override + { + return reinterpret_cast(this); + } + +private: + Method *method_ {nullptr}; + uint32_t bytecode_offset_ {0}; + + uint64_t acc_ {0}; + std::vector args_; + std::vector vregs_; + PandaVector vreg_kinds_; + PandaVector arg_kinds_; + RegisterKind acc_kind_ {PtFrame::RegisterKind::PRIMITIVE}; +}; +} // namespace ark::tooling::inspector::test + +// NOLINTEND + +#endif // PANDA_TOOLING_INSPECTOR_TEST_TEST_FRAME_H diff --git a/tooling/static/tests/thread_state.cpp b/tooling/static/tests/thread_state.cpp new file mode 100644 index 00000000..025e7926 --- /dev/null +++ b/tooling/static/tests/thread_state.cpp @@ -0,0 +1,198 @@ +/** + * Copyright (c) 2023-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "debugger/thread_state.h" + +#include "gtest/gtest.h" + +#include "evaluation/evaluation_engine.h" +#include "file.h" +#include "object_header.h" +#include "runtime_options.h" +#include "runtime.h" +#include "typed_value.h" + +// NOLINTBEGIN + +namespace ark::tooling::inspector::test { +class MockEvaluationEngine final : public EvaluationEngine { +public: + Expected, Error> EvaluateExpression( + [[maybe_unused]] uint32_t frameNumber, [[maybe_unused]] const ExpressionWrapper &bytecode, + [[maybe_unused]] Method **method) override + { + return std::make_pair(TypedValue::Invalid(), nullptr); + } +}; + +class ThreadStateTest : public testing::Test { + void SetUp() + { + state = std::make_unique(mockEvaluationEngine_, bpStorage_); + } + +protected: + MockEvaluationEngine mockEvaluationEngine_; + BreakpointStorage bpStorage_; + std::unique_ptr state; + PtLocation fake = PtLocation("", {}, 0); + PtLocation location0 = PtLocation("test.abc", panda_file::File::EntityId(1), 0); + PtLocation location1 = PtLocation("test.abc", panda_file::File::EntityId(1), 1); + PtLocation location2 = PtLocation("test.abc", panda_file::File::EntityId(1), 2); + PtLocation location3 = PtLocation("test.abc", panda_file::File::EntityId(1), 3); + const char *source = "/test.ets"; +}; + +TEST_F(ThreadStateTest, BreakOnStart) +{ + ASSERT_FALSE(state->IsPaused()); + state->OnSingleStep(fake, source); + ASSERT_FALSE(state->IsPaused()); + + state->BreakOnStart(); + state->OnSingleStep(fake, source); + ASSERT_TRUE(state->IsPaused()); +} + +TEST_F(ThreadStateTest, PauseAndContinue) +{ + state->Pause(); + state->OnSingleStep(fake, source); + ASSERT_TRUE(state->IsPaused()); + state->Continue(); + state->OnSingleStep(fake, source); + ASSERT_FALSE(state->IsPaused()); + + state->Pause(); + ASSERT_FALSE(state->IsPaused()); + state->Continue(); + state->OnSingleStep(fake, source); + ASSERT_FALSE(state->IsPaused()); +} + +TEST_F(ThreadStateTest, StepInto) +{ + state->Pause(); + state->OnSingleStep(fake, source); + + std::unordered_set locs; + locs.insert(location1); + locs.insert(location2); + + ASSERT_TRUE(state->IsPaused()); + state->StepInto(locs); + state->OnSingleStep(location2, source); + ASSERT_FALSE(state->IsPaused()); + state->OnSingleStep(location3, source); + ASSERT_TRUE(state->IsPaused()); +} + +TEST_F(ThreadStateTest, ContinueTo) +{ + state->Pause(); + state->OnSingleStep(fake, source); + + std::unordered_set locs; + locs.insert(location1); + locs.insert(location2); + + ASSERT_TRUE(state->IsPaused()); + state->ContinueTo(locs); + state->OnSingleStep(location0, source); + ASSERT_FALSE(state->IsPaused()); + state->OnSingleStep(location1, source); + ASSERT_TRUE(state->IsPaused()); +} + +TEST_F(ThreadStateTest, StepOut) +{ + state->Pause(); + state->OnSingleStep(fake, source); + + ASSERT_TRUE(state->IsPaused()); + state->StepOut(); + state->OnSingleStep(location0, source); + ASSERT_FALSE(state->IsPaused()); + state->OnSingleStep(location1, source); + ASSERT_FALSE(state->IsPaused()); + state->OnSingleStep(location2, source); + ASSERT_FALSE(state->IsPaused()); + state->OnFramePop(); + state->OnSingleStep(fake, source); + ASSERT_TRUE(state->IsPaused()); +} + +TEST_F(ThreadStateTest, StepOver) +{ + state->Pause(); + state->OnSingleStep(fake, source); + + std::unordered_set locs; + locs.insert(location1); + locs.insert(location2); + + ASSERT_TRUE(state->IsPaused()); + state->StepOver(locs); + state->OnSingleStep(location1, source); + ASSERT_FALSE(state->IsPaused()); + state->OnMethodEntry(); + state->OnSingleStep(fake, source); + ASSERT_FALSE(state->IsPaused()); + state->OnFramePop(); + state->OnSingleStep(location2, source); + ASSERT_FALSE(state->IsPaused()); + state->OnFramePop(); + state->OnSingleStep(fake, source); + ASSERT_TRUE(state->IsPaused()); +} + +TEST_F(ThreadStateTest, OnException) +{ + ASSERT_FALSE(state->IsPaused()); + + state->SetPauseOnExceptions(PauseOnExceptionsState::NONE); + state->OnException(false); + ASSERT_FALSE(state->IsPaused()); + state->OnException(true); + ASSERT_FALSE(state->IsPaused()); + + state->SetPauseOnExceptions(PauseOnExceptionsState::CAUGHT); + state->OnException(true); + ASSERT_FALSE(state->IsPaused()); + state->OnException(false); + ASSERT_TRUE(state->IsPaused()); + state->Continue(); + ASSERT_FALSE(state->IsPaused()); + + state->SetPauseOnExceptions(PauseOnExceptionsState::UNCAUGHT); + state->OnException(false); + ASSERT_FALSE(state->IsPaused()); + state->OnException(true); + ASSERT_TRUE(state->IsPaused()); + state->Continue(); + ASSERT_FALSE(state->IsPaused()); + + state->SetPauseOnExceptions(PauseOnExceptionsState::ALL); + state->OnException(false); + ASSERT_TRUE(state->IsPaused()); + state->Continue(); + ASSERT_FALSE(state->IsPaused()); + state->OnException(true); + ASSERT_TRUE(state->IsPaused()); +} + +} // namespace ark::tooling::inspector::test + +// NOLINTEND diff --git a/tooling/static/types/custom_url_breakpoint_response.cpp b/tooling/static/types/custom_url_breakpoint_response.cpp new file mode 100644 index 00000000..a9c5c7e4 --- /dev/null +++ b/tooling/static/types/custom_url_breakpoint_response.cpp @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "types/custom_url_breakpoint_response.h" + +#include "utils/json_builder.h" + +namespace ark::tooling::inspector { + +void CustomUrlBreakpointResponse::Serialize(JsonObjectBuilder &builder) const +{ + std::string id = id_.has_value() ? std::to_string(*id_) : "invalid"; + builder.AddProperty("id", id); + // NOTE(fangting, #IC98WJ): make 0-based line numbers default for Inspector + builder.AddProperty("lineNumber", lineNumber_ - 1); + builder.AddProperty("columnNumber", columnNumber_); + builder.AddProperty("scriptId", scriptId_); +} + +void CustomUrlBreakpointLocations::Serialize(JsonObjectBuilder &builder) const +{ + builder.AddProperty("locations", [this](JsonArrayBuilder &arrayBuilder) { + for (const auto &loc : locations_) { + arrayBuilder.Add(loc); + } + }); +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/custom_url_breakpoint_response.h b/tooling/static/types/custom_url_breakpoint_response.h new file mode 100644 index 00000000..3a4090c4 --- /dev/null +++ b/tooling/static/types/custom_url_breakpoint_response.h @@ -0,0 +1,92 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_CUSTOM_URL_BREAKPOINT_RESPONSE_H +#define PANDA_TOOLING_INSPECTOR_TYPES_CUSTOM_URL_BREAKPOINT_RESPONSE_H + +#include "json_serialization/serializable.h" + +#include + +#include "macros.h" + +#include "types/numeric_id.h" + +namespace ark::tooling::inspector { + +/// @brief Response for single breakpoint set by custom "Debugger.getPossibleAndSetBreakpointByUrl" +class CustomUrlBreakpointResponse final : public JsonSerializable { +public: + explicit CustomUrlBreakpointResponse(size_t lineNumber) : lineNumber_(lineNumber) {} + + DEFAULT_COPY_SEMANTIC(CustomUrlBreakpointResponse); + DEFAULT_MOVE_SEMANTIC(CustomUrlBreakpointResponse); + + ~CustomUrlBreakpointResponse() override = default; + + CustomUrlBreakpointResponse &SetLineNumber(size_t lineNumber) + { + lineNumber_ = lineNumber; + return *this; + } + + CustomUrlBreakpointResponse &SetColumnNumber(std::optional optColumnNumber) + { + columnNumber_ = optColumnNumber.has_value() ? *optColumnNumber : DEFAULT_COLUMN_NUMBER; + return *this; + } + + CustomUrlBreakpointResponse &SetScriptId(ScriptId scriptId) + { + scriptId_ = scriptId; + return *this; + } + + CustomUrlBreakpointResponse &SetBreakpointId(BreakpointId id) + { + id_ = id; + return *this; + } + + void Serialize(JsonObjectBuilder &builder) const override; + +private: + // CC-OFFNXT(G.NAM.03-CPP) project code style + static constexpr size_t DEFAULT_COLUMN_NUMBER = 0; + +private: + // Default values are selected for compatibility + size_t lineNumber_ {0}; + size_t columnNumber_ {DEFAULT_COLUMN_NUMBER}; + ScriptId scriptId_ {0}; + std::optional id_ {}; // "invalid" default value +}; + +class CustomUrlBreakpointLocations final : public JsonSerializable { +public: + void Serialize(JsonObjectBuilder &builder) const override; + + void Add(CustomUrlBreakpointResponse &&loc) + { + locations_.emplace_back(std::move(loc)); + } + +private: + std::vector locations_; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_CUSTOM_URL_BREAKPOINT_RESPONSE_H diff --git a/tooling/static/types/debugger_call_function_on_request.cpp b/tooling/static/types/debugger_call_function_on_request.cpp new file mode 100644 index 00000000..d1242a2c --- /dev/null +++ b/tooling/static/types/debugger_call_function_on_request.cpp @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "types/debugger_call_function_on_request.h" +#include "utils/json_parser.h" + +#include "types/numeric_id.h" + +namespace ark::tooling::inspector { + +Expected DebuggerCallFunctionOnRequest::FromJson(const JsonObject &object) +{ + DebuggerCallFunctionOnRequest parsed; + + auto optFrameId = ParseNumericId(object, "callFrameId"); + if (!optFrameId) { + return Unexpected(optFrameId.Error()); + } + parsed.callFrameId_ = *optFrameId; + + const auto *optFunctionDeclaration = object.GetValue("functionDeclaration"); + if (optFunctionDeclaration == nullptr) { + return Unexpected(std::string("no 'functionDeclaration' field")); + } + parsed.functionDeclaration_ = optFunctionDeclaration; + + auto optSilent = object.GetValue("silent"); + if (optSilent != nullptr) { + parsed.silent_ = *optSilent; + } + + auto optReturnByValue = object.GetValue("returnByValue"); + if (optReturnByValue != nullptr) { + parsed.returnByValue_ = *optReturnByValue; + } + + auto optGeneratePreview = object.GetValue("generatePreview"); + if (optGeneratePreview != nullptr) { + parsed.generatePreview_ = *optGeneratePreview; + } + + return parsed; +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/debugger_call_function_on_request.h b/tooling/static/types/debugger_call_function_on_request.h new file mode 100644 index 00000000..4fb58ddf --- /dev/null +++ b/tooling/static/types/debugger_call_function_on_request.h @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_DEBUGGER_CALL_FUNCTION_ON_REQUEST_H +#define PANDA_TOOLING_INSPECTOR_TYPES_DEBUGGER_CALL_FUNCTION_ON_REQUEST_H + +#include "macros.h" +#include "utils/expected.h" + +namespace ark { +class JsonObject; +} // namespace ark + +namespace ark::tooling::inspector { + +/** + * @brief Request parameters of `Debugger.callFunctionOn` method. + * Instances of this class must not outlive the source `JsonObject`. + * Parameters: + * - `callFrameId_`: size_t - The identifier of the call frame where the function will be executed. (Required) + * - `functionDeclaration_`: std::string - The function declaration string to be executed. (Required) + * - `objectId_`: size_t - The identifier of the object on which the function will be called. (Optional) + * - `arguments_`: std::vector> - A list of arguments to pass to the function. (Optional) + * - `silent_`: bool - Whether to suppress execution side effects. (Optional) + * - `returnByValue_`: bool - Whether to return the result as a value or by reference. (Optional) + * - `generatePreview_`: bool - Whether to generate a preview of the result. (Optional) + * - `userGesture_`: bool - Whether the function call is triggered by a user gesture. (Optional) + * - `awaitPromise_`: bool - Whether to await the promise returned by the function. (Optional) + * - `executionContextId_`: size_t - The identifier of the execution context where the function will be executed. + * (Optional) + * - `objectGroup_`: std::string - The group name for the result object. (Optional) + * - `throwOnSideEffect_`: bool - Whether to throw an exception if the function has side effects. (Optional) + */ +class DebuggerCallFunctionOnRequest final { +public: + static Expected FromJson(const JsonObject &object); + + DEFAULT_COPY_SEMANTIC(DebuggerCallFunctionOnRequest); + DEFAULT_MOVE_SEMANTIC(DebuggerCallFunctionOnRequest); + + ~DebuggerCallFunctionOnRequest() = default; + + size_t GetCallFrameId() const + { + return callFrameId_; + } + + const std::string &GetFunctionDeclaration() const + { + return *functionDeclaration_; + } + +private: + DebuggerCallFunctionOnRequest() = default; + +private: + size_t callFrameId_ {0}; + const std::string *functionDeclaration_ {nullptr}; + bool silent_ {false}; + bool returnByValue_ {false}; + bool generatePreview_ {false}; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_DEBUGGER_CALL_FUNCTION_ON_REQUEST_H diff --git a/tooling/static/types/debugger_evaluation_request.cpp b/tooling/static/types/debugger_evaluation_request.cpp new file mode 100644 index 00000000..7a846714 --- /dev/null +++ b/tooling/static/types/debugger_evaluation_request.cpp @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "types/debugger_evaluation_request.h" + +#include "utils/json_parser.h" + +#include "types/numeric_id.h" + +namespace ark::tooling::inspector { + +Expected DebuggerEvaluationRequest::FromJson(const JsonObject &object) +{ + DebuggerEvaluationRequest parsed; + + auto optFrameId = ParseNumericId(object, "callFrameId"); + if (!optFrameId) { + return Unexpected(optFrameId.Error()); + } + parsed.callFrameId_ = *optFrameId; + + const auto *optExpression = object.GetValue("expression"); + if (optExpression == nullptr) { + return Unexpected(std::string("no 'expression' field")); + } + parsed.expression_ = optExpression; + + auto optSilent = object.GetValue("silent"); + if (optSilent != nullptr) { + parsed.silent_ = *optSilent; + } + + auto optReturnByValue = object.GetValue("returnByValue"); + if (optReturnByValue != nullptr) { + parsed.returnByValue_ = *optReturnByValue; + } + + auto optGeneratePreview = object.GetValue("generatePreview"); + if (optGeneratePreview != nullptr) { + parsed.generatePreview_ = *optGeneratePreview; + } + + return parsed; +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/debugger_evaluation_request.h b/tooling/static/types/debugger_evaluation_request.h new file mode 100644 index 00000000..1e2c6efc --- /dev/null +++ b/tooling/static/types/debugger_evaluation_request.h @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_DEBUGGER_EVALUATION_REQUEST_H +#define PANDA_TOOLING_INSPECTOR_TYPES_DEBUGGER_EVALUATION_REQUEST_H + +#include "macros.h" +#include "utils/expected.h" + +namespace ark { +class JsonObject; +} // namespace ark + +namespace ark::tooling::inspector { + +/** + * @brief Request parameters of `Debugger.evaluateOnCallFrame` method. + * Instances of this class must not outlive the source `JsonObject`. + */ +class DebuggerEvaluationRequest final { +public: + static Expected FromJson(const JsonObject &object); + + DEFAULT_COPY_SEMANTIC(DebuggerEvaluationRequest); + DEFAULT_MOVE_SEMANTIC(DebuggerEvaluationRequest); + + ~DebuggerEvaluationRequest() = default; + + size_t GetCallFrameId() const + { + return callFrameId_; + } + + const std::string &GetExpression() const + { + return *expression_; + } + +private: + DebuggerEvaluationRequest() = default; + +private: + size_t callFrameId_ {0}; + const std::string *expression_ {nullptr}; + bool silent_ {false}; + bool returnByValue_ {false}; + bool generatePreview_ {false}; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_DEBUGGER_EVALUATION_REQUEST_H diff --git a/tooling/static/types/evaluation_result.h b/tooling/static/types/evaluation_result.h new file mode 100644 index 00000000..08f79ad5 --- /dev/null +++ b/tooling/static/types/evaluation_result.h @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_EVALUATION_RESULT_H +#define PANDA_TOOLING_INSPECTOR_TYPES_EVALUATION_RESULT_H + +#include "tooling/inspector/json_serialization/serializable.h" + +#include "macros.h" +#include "utils/json_builder.h" + +#include "types/exception_details.h" +#include "types/remote_object.h" + +namespace ark::tooling::inspector { + +class EvaluationResult : public JsonSerializable { +public: + explicit EvaluationResult(RemoteObject &&res, std::optional &&exc) + : result_(std::move(res)), exceptionDetails_(std::move(exc)) // NOLINT(bugprone-throw-keyword-missing) + { + } + + DEFAULT_COPY_SEMANTIC(EvaluationResult); + DEFAULT_MOVE_SEMANTIC(EvaluationResult); + + ~EvaluationResult() override = default; + + void Serialize(JsonObjectBuilder &builder) const override + { + builder.AddProperty("result", result_); + if (exceptionDetails_) { + builder.AddProperty("exceptionDetails", *exceptionDetails_); + } + } + +private: + RemoteObject result_; + std::optional exceptionDetails_; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_EVALUATION_RESULT_H diff --git a/tooling/static/types/exception_details.cpp b/tooling/static/types/exception_details.cpp new file mode 100644 index 00000000..ab414615 --- /dev/null +++ b/tooling/static/types/exception_details.cpp @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "types/exception_details.h" + +#include "utils/json_builder.h" + +namespace ark::tooling::inspector { + +void ExceptionDetails::Serialize(JsonObjectBuilder &builder) const +{ + builder.AddProperty("exceptionId", exceptionId_); + builder.AddProperty("text", text_); + builder.AddProperty("lineNumber", lineNumber_); + builder.AddProperty("columnNumber", columnNumber_); + + if (scriptId_) { + builder.AddProperty("scriptId", *scriptId_); + } + if (url_) { + builder.AddProperty("url", *url_); + } + if (exception_) { + builder.AddProperty("exception", *exception_); + } + if (executionContextId_) { + builder.AddProperty("executionContextId", *executionContextId_); + } +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/exception_details.h b/tooling/static/types/exception_details.h new file mode 100644 index 00000000..935890b1 --- /dev/null +++ b/tooling/static/types/exception_details.h @@ -0,0 +1,138 @@ +/** + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef PANDA_TOOLING_INSPECTOR_EXCEPTION_DETAILS_H +#define PANDA_TOOLING_INSPECTOR_EXCEPTION_DETAILS_H + +#include "tooling/inspector/json_serialization/serializable.h" + +#include +#include + +#include "macros.h" +#include "types/numeric_id.h" +#include "types/remote_object.h" + +namespace ark { +class JsonObjectBuilder; +} // namespace ark + +namespace ark::tooling::inspector { +class ExceptionDetails final : public JsonSerializable { +public: + ExceptionDetails(size_t exceptionId, std::string text, size_t lineNumber, size_t columnNumber) + : exceptionId_(exceptionId), text_(std::move(text)), lineNumber_(lineNumber), columnNumber_(columnNumber) + { + } + + void Serialize(JsonObjectBuilder &builder) const override; + + size_t GetExceptionId() const + { + return exceptionId_; + } + + const std::string &GetText() const + { + return text_; + } + + size_t GetLine() const + { + return lineNumber_; + } + + size_t GetColumn() const + { + return columnNumber_; + } + + ScriptId GetScriptId() const + { + return scriptId_.value_or(0); + } + + ExceptionDetails &SetScriptId(ScriptId scriptId) + { + scriptId_ = scriptId; + return *this; + } + + bool HasScriptId() const + { + return scriptId_.has_value(); + } + + const std::string &GetUrl() const + { + ASSERT(HasUrl()); + return url_.value(); + } + + ExceptionDetails &SetUrl(std::string_view url) + { + url_ = url; + return *this; + } + + bool HasUrl() const + { + return url_.has_value(); + } + + const std::optional &GetExceptionObject() const + { + return exception_; + } + + ExceptionDetails &SetExceptionObject(RemoteObject &&exception) + { + exception_ = std::move(exception); + return *this; + } + + bool HasExceptionObject() const + { + return exception_.has_value(); + } + + ExecutionContextId GetExecutionContextId() const + { + return executionContextId_.value_or(-1); + } + + ExceptionDetails &SetExecutionContextId(ExecutionContextId executionContextId) + { + executionContextId_ = executionContextId; + return *this; + } + + bool HasExecutionContextId() const + { + return executionContextId_.has_value(); + } + +private: + size_t exceptionId_ {0}; + std::string text_; + size_t lineNumber_ {0}; + size_t columnNumber_ {0}; + std::optional scriptId_; + std::optional url_; + std::optional exception_; + std::optional executionContextId_; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_EXCEPTION_DETAILS_H diff --git a/tooling/static/types/location.cpp b/tooling/static/types/location.cpp new file mode 100644 index 00000000..3f6fbde9 --- /dev/null +++ b/tooling/static/types/location.cpp @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "types/location.h" + +#include +#include +#include + +#include "utils/expected.h" +#include "utils/json_builder.h" +#include "utils/json_parser.h" + +#include "types/numeric_id.h" + +using namespace std::literals::string_literals; // NOLINT(google-build-using-namespace) + +namespace ark::tooling::inspector { +Expected Location::FromJsonProperty(const JsonObject &object, const char *propertyName) +{ + auto property = object.GetValue(propertyName); + if (property == nullptr) { + return Unexpected("No such property: "s + propertyName); + } + + auto scriptId = ParseNumericId(**property, "scriptId"); + if (!scriptId) { + return Unexpected(scriptId.Error()); + } + + auto optLineNumber = ParseSizeProperty(**property, "lineNumber"); + if (!optLineNumber) { + return Unexpected(optLineNumber.Error()); + } + + return Location(*scriptId, optLineNumber.Value() + 1); +} + +void Location::Serialize(JsonObjectBuilder &builder) const +{ + builder.AddProperty("scriptId", std::to_string(scriptId_)); + builder.AddProperty("lineNumber", lineNumber_ - 1); + if (columnNumber_) { + builder.AddProperty("columnNumber", *columnNumber_); + } +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/location.h b/tooling/static/types/location.h new file mode 100644 index 00000000..ff73eeac --- /dev/null +++ b/tooling/static/types/location.h @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_LOCATION_H +#define PANDA_TOOLING_INSPECTOR_TYPES_LOCATION_H + +#include "tooling/inspector/json_serialization/serializable.h" + +#include +#include +#include + +#include "utils/expected.h" + +#include "types/numeric_id.h" + +namespace ark { +class JsonObject; +class JsonObjectBuilder; +} // namespace ark + +namespace ark::tooling::inspector { +class Location final : public JsonSerializable { +public: + Location(ScriptId scriptId, size_t lineNumber, std::optional columnNumber = {}) + : scriptId_(scriptId), lineNumber_(lineNumber), columnNumber_(columnNumber) + { + } + + static Expected FromJsonProperty(const JsonObject &object, const char *propertyName); + + ScriptId GetScriptId() const + { + return scriptId_; + } + + size_t GetLineNumber() const + { + return lineNumber_; + } + + void SetLineNumber(size_t lineNumber) + { + lineNumber_ = lineNumber; + } + + std::optional GetColumnNumber() const + { + return columnNumber_; + } + + void SetColumnNumber(size_t columnNumber) + { + columnNumber_ = columnNumber; + } + + void Serialize(JsonObjectBuilder &builder) const override; + +private: + ScriptId scriptId_; + size_t lineNumber_; + std::optional columnNumber_; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_LOCATION_H diff --git a/tooling/static/types/numeric_id.h b/tooling/static/types/numeric_id.h new file mode 100644 index 00000000..53f5c5f5 --- /dev/null +++ b/tooling/static/types/numeric_id.h @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_NUMERIC_ID_H +#define PANDA_TOOLING_INSPECTOR_TYPES_NUMERIC_ID_H + +#include +#include +#include +#include +#include +#include +#include + +#include "utils/expected.h" +#include "utils/json_parser.h" +#include "utils/string_helpers.h" + +namespace ark::tooling::inspector { +using BreakpointId = size_t; +using CallFrameId = std::string; +using ExecutionContextId = uint32_t; +using FrameId = uint32_t; +using RemoteObjectId = size_t; +using ScriptId = size_t; + +template >> +Expected ParseNumericId(const JsonObject &object, std::string_view propertyName) +{ + auto property = object.GetValue(propertyName.data()); + if (!property) { + return Unexpected("No such property: " + std::string(propertyName)); + } + + intmax_t value; + if (!helpers::string::ParseInt(*property, &value, INTMAX_C(0)) || value < 0 || + std::numeric_limits::max() < static_cast(value)) { + return Unexpected("Invalid id: " + *property); + } + + return static_cast(value); +} + +inline Expected ParseSizeProperty(const JsonObject &object, std::string_view propertyName) +{ + auto value = object.GetValue(propertyName.data()); + if (value == nullptr) { + return Unexpected("No '" + std::string(propertyName) + "' property"); + } + auto valueTrunc = std::trunc(*value); + if (*value < 0 || *value - valueTrunc > valueTrunc * DBL_EPSILON) { + return Unexpected("Invalid line number: " + std::to_string(*value)); + } + return valueTrunc; +} +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_NUMERIC_ID_H diff --git a/tooling/static/types/object_preview.cpp b/tooling/static/types/object_preview.cpp new file mode 100644 index 00000000..2bcdda94 --- /dev/null +++ b/tooling/static/types/object_preview.cpp @@ -0,0 +1,98 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "tooling/inspector/types/object_preview.h" +#include "tooling/inspector/types/property_descriptor.h" + +#include "utils/string_helpers.h" + +namespace ark::tooling::inspector { + +// Number of maximum count of properties that can be previewed. +static constexpr size_t PROPERTIES_NMB_LIMIT = 10; + +namespace { +std::optional GetPropertyPreviewValue(const RemoteObjectType::TypeValue &remobjValue) +{ + std::optional propPreviewValue; + + if (std::holds_alternative(remobjValue)) { + propPreviewValue.emplace("null"); + } else if (auto boolean = std::get_if(&remobjValue)) { + propPreviewValue.emplace(*boolean ? "true" : "false"); + } else if (auto number = std::get_if(&remobjValue)) { + if (auto integer = std::get_if(number)) { + propPreviewValue.emplace(std::to_string(*integer)); + } else if (auto floatingPoint = std::get_if(number)) { + propPreviewValue.emplace( + ark::helpers::string::Format("%g", *floatingPoint)); // NOLINT(cppcoreguidelines-pro-type-vararg) + } else { + UNREACHABLE(); + } + } else if (auto bigint = std::get_if(&remobjValue)) { + propPreviewValue.emplace(RemoteObject::GetDescription(*bigint)); + } else if (auto string = std::get_if(&remobjValue)) { + propPreviewValue.emplace(*string); + } else if (auto symbol = std::get_if(&remobjValue)) { + propPreviewValue.emplace(symbol->description); + } else if (auto object = std::get_if(&remobjValue)) { + propPreviewValue.emplace(RemoteObject::GetDescription(*object)); + } else if (auto array = std::get_if(&remobjValue)) { + propPreviewValue.emplace(RemoteObject::GetDescription(*array)); + } else if (auto function = std::get_if(&remobjValue)) { + propPreviewValue.emplace(function->name); + } + + return propPreviewValue; +} +} // namespace + +ObjectPreview::ObjectPreview(RemoteObjectType type, const std::vector &properties) + : type_(std::move(type)) +{ + overflow_ = (properties.size() > PROPERTIES_NMB_LIMIT); + + auto start = properties.begin(); + auto end = start + std::min(properties.size(), PROPERTIES_NMB_LIMIT); + + for (auto propertyIt = start; propertyIt != end; ++propertyIt) { + if (!propertyIt->IsEnumerable()) { + continue; + } + + if (propertyIt->IsAccessor()) { + properties_.emplace_back(propertyIt->GetName(), RemoteObjectType::Accessor()); + continue; + } + + auto propPreviewValue = GetPropertyPreviewValue(propertyIt->GetValue().GetValue()); + + properties_.emplace_back(propertyIt->GetName(), propertyIt->GetValue().GetType(), std::move(*propPreviewValue)); + } +} + +void ObjectPreview::Serialize(JsonObjectBuilder &builder) const +{ + type_.Serialize(builder); + builder.AddProperty("overflow", overflow_); + + builder.AddProperty("properties", [&](JsonArrayBuilder &propertiesBuilder) { + for (auto &propertyPreview : properties_) { + propertiesBuilder.Add(propertyPreview); + } + }); +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/object_preview.h b/tooling/static/types/object_preview.h new file mode 100644 index 00000000..97b6042d --- /dev/null +++ b/tooling/static/types/object_preview.h @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_OBJECT_PREVIEW_H +#define PANDA_TOOLING_INSPECTOR_TYPES_OBJECT_PREVIEW_H + +#include "types/remote_object_type.h" +#include "types/property_preview.h" + +namespace ark::tooling::inspector { + +class PropertyDescriptor; + +class ObjectPreview final : public JsonSerializable { +public: + ObjectPreview(RemoteObjectType type, const std::vector &properties); + + void Serialize(JsonObjectBuilder &builder) const override; + +private: + RemoteObjectType type_; + + bool overflow_ {false}; + + std::vector properties_; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_OBJECT_PREVIEW_H diff --git a/tooling/static/types/pause_on_exceptions_state.h b/tooling/static/types/pause_on_exceptions_state.h new file mode 100644 index 00000000..e21f960e --- /dev/null +++ b/tooling/static/types/pause_on_exceptions_state.h @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_PAUSE_ON_EXCEPTIONS_STATE_H +#define PANDA_TOOLING_INSPECTOR_TYPES_PAUSE_ON_EXCEPTIONS_STATE_H + +namespace ark::tooling::inspector { +enum class PauseOnExceptionsState { NONE = 0x0, CAUGHT = 0x1, UNCAUGHT = 0x2, ALL = 0x3 }; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_PAUSE_ON_EXCEPTIONS_STATE_H diff --git a/tooling/static/types/possible_breakpoints_response.h b/tooling/static/types/possible_breakpoints_response.h new file mode 100644 index 00000000..0a657ecc --- /dev/null +++ b/tooling/static/types/possible_breakpoints_response.h @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_POSSIBLE_BREAKPOINTS_RESPONSE_H +#define PANDA_TOOLING_INSPECTOR_TYPES_POSSIBLE_BREAKPOINTS_RESPONSE_H + +#include "tooling/inspector/json_serialization/serializable.h" + +#include "utils/json_builder.h" + +#include "types/location.h" + +namespace ark::tooling::inspector { + +class PossibleBreakpointsResponse final : public JsonSerializable { +public: + void Add(const Location &loc) + { + locations_.emplace_back(loc); + } + + void Serialize(JsonObjectBuilder &builder) const override + { + builder.AddProperty("locations", [this](JsonArrayBuilder &arrayBuilder) { + for (const auto &loc : locations_) { + arrayBuilder.Add(loc); + } + }); + } + +private: + std::vector locations_; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_POSSIBLE_BREAKPOINTS_RESPONSE_H diff --git a/tooling/static/types/profile_result.cpp b/tooling/static/types/profile_result.cpp new file mode 100644 index 00000000..c41395bc --- /dev/null +++ b/tooling/static/types/profile_result.cpp @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "types/profile_result.h" + +namespace ark::tooling::inspector { +void Profile::Serialize(JsonObjectBuilder &builder) const +{ + if (!profileInfos_) { + return; + } + builder.AddProperty("profile", + [this](JsonArrayBuilder &arrayBuilder) { this->SerializeProfileInfos(arrayBuilder); }); +} + +void Profile::SerializeProfileInfos(JsonArrayBuilder &arrayBuilder) const +{ + for (const auto &profileInfoPtr : *profileInfos_) { + if (!profileInfoPtr) { + continue; + } + arrayBuilder.Add([this, &profileInfoPtr](JsonObjectBuilder &objBuilder) { + this->SerializeSingleProfileInfo(objBuilder, *profileInfoPtr); + }); + } +} + +void Profile::SerializeSingleProfileInfo(JsonObjectBuilder &builder, const sampler::ProfileInfo &profileInfo) const +{ + // add normal data + builder.AddProperty("tid", profileInfo.tid); + builder.AddProperty("startTime", profileInfo.startTime); + builder.AddProperty("endTime", profileInfo.stopTime); + builder.AddProperty("gcTime", profileInfo.gcTime); + builder.AddProperty("cInterpreterTime", profileInfo.cInterpreterTime); + builder.AddProperty("asmInterpreterTime", profileInfo.asmInterpreterTime); + builder.AddProperty("aotTime", profileInfo.aotTime); + builder.AddProperty("builtinTime", profileInfo.builtinTime); + builder.AddProperty("napiTime", profileInfo.napiTime); + builder.AddProperty("arkuiEngineTime", profileInfo.arkuiEngineTime); + builder.AddProperty("runtimeTime", profileInfo.runtimeTime); + builder.AddProperty("otherTime", profileInfo.otherTime); + + // add nodes array + SerializeNodes(builder, profileInfo); + + // add sample and timeDeltas array + builder.AddProperty("samples", [&profileInfo](JsonArrayBuilder &arrayBuilder) { + for (const auto &child : profileInfo.samples) { + arrayBuilder.Add(child); + } + }); + builder.AddProperty("timeDeltas", [&profileInfo](JsonArrayBuilder &arrayBuilder) { + for (const auto &child : profileInfo.timeDeltas) { + arrayBuilder.Add(child); + } + }); +} +void Profile::SerializeNodes(JsonObjectBuilder &builder, const sampler::ProfileInfo &profileInfo) const +{ + builder.AddProperty("nodes", [this, &profileInfo](JsonArrayBuilder &arrayBuilder) { + for (int i = 0; i < profileInfo.nodeCount; ++i) { + arrayBuilder.Add([this, &profileInfo, i](JsonObjectBuilder &objBuilder) { + objBuilder.AddProperty("id", profileInfo.nodes[i].id); + this->SerializeCallFrame(objBuilder, profileInfo.nodes[i].codeEntry); + objBuilder.AddProperty("hitCount", profileInfo.nodes[i].hitCount); + this->SerializeChildren(objBuilder, profileInfo.nodes[i].children); + }); + } + }); +} + +void Profile::SerializeChildren(JsonObjectBuilder &builder, const std::vector children) const +{ + builder.AddProperty("children", [&children](JsonArrayBuilder &childrenBuilder) { + for (const auto &child : children) { + childrenBuilder.Add(child); + } + }); +} + +void Profile::SerializeCallFrame(JsonObjectBuilder &builder, const struct sampler::FrameInfo &codeEntry) const +{ + builder.AddProperty("callFrame", [&codeEntry](JsonObjectBuilder &objBuilder) { + objBuilder.AddProperty("functionName", codeEntry.functionName); + objBuilder.AddProperty("moduleName", codeEntry.moduleName); + objBuilder.AddProperty("scriptId", codeEntry.scriptId); + objBuilder.AddProperty("url", codeEntry.url); + objBuilder.AddProperty("lineNumber", codeEntry.lineNumber); + objBuilder.AddProperty("columnNumber", codeEntry.columnNumber); + }); +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/profile_result.h b/tooling/static/types/profile_result.h new file mode 100644 index 00000000..f03de7ac --- /dev/null +++ b/tooling/static/types/profile_result.h @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_PROFILE_RESULT_H +#define PANDA_TOOLING_INSPECTOR_TYPES_PROFILE_RESULT_H + +#include "json_serialization/serializable.h" +#include "runtime/tooling/sampler/samples_record.h" +#include "utils/json_builder.h" + +namespace ark::tooling::inspector { +class Profile final : public JsonSerializable { +public: + explicit Profile(std::unique_ptr>> profileInfos) + : profileInfos_(std::move(profileInfos)) + { + } + void Serialize(JsonObjectBuilder &builder) const override; + +private: + void SerializeProfileInfos(JsonArrayBuilder &arrayBuilder) const; + void SerializeSingleProfileInfo(JsonObjectBuilder &builder, const sampler::ProfileInfo &profileInfo) const; + void SerializeNodes(JsonObjectBuilder &builder, const sampler::ProfileInfo &profileInfo) const; + void SerializeChildren(JsonObjectBuilder &builder, const std::vector children) const; + void SerializeCallFrame(JsonObjectBuilder &builder, const struct sampler::FrameInfo &codeEntry) const; + std::unique_ptr>> profileInfos_; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_PROFILE_RESULT_H diff --git a/tooling/static/types/property_descriptor.h b/tooling/static/types/property_descriptor.h new file mode 100644 index 00000000..325e2100 --- /dev/null +++ b/tooling/static/types/property_descriptor.h @@ -0,0 +1,138 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_PROPERTY_DESCRIPTOR_H +#define PANDA_TOOLING_INSPECTOR_TYPES_PROPERTY_DESCRIPTOR_H + +#include "macros.h" + +#include "tooling/inspector/types/remote_object.h" +#include "tooling/inspector/json_serialization/serializable.h" + +#include "remote_object.h" + +namespace ark::tooling::inspector { +class PropertyDescriptor final : public JsonSerializable { +public: + PropertyDescriptor(std::string name, RemoteObject value) : name_(std::move(name)), value_(std::move(value)) {} + + static PropertyDescriptor Accessor(std::string name, RemoteObject getter) + { + PropertyDescriptor property(std::move(name), std::move(getter)); + property.isAccessor_ = true; + return property; + } + + bool IsAccessor() const + { + return isAccessor_; + } + + bool IsConfigurable() const + { + return configurable_; + } + + bool IsEnumerable() const + { + return enumerable_; + } + + bool IsWritable() const + { + ASSERT(!IsAccessor()); + return writable_; + } + + const RemoteObject &GetGetter() const + { + ASSERT(IsAccessor()); + return value_; + } + + const std::string &GetName() const + { + return name_; + } + + const std::optional &GetSymbol() const + { + return symbol_; + } + + const RemoteObject &GetValue() const + { + ASSERT(!IsAccessor()); + return value_; + } + + RemoteObject &GetValue() + { + ASSERT(!IsAccessor()); + return value_; + } + + void SetConfigurable(bool configurable) + { + configurable_ = configurable; + } + + void SetEnumerable(bool enumerable) + { + enumerable_ = enumerable; + } + + void SetSymbol(RemoteObject symbol) + { + symbol_.emplace(std::move(symbol)); + } + + void SetWritable(bool writable) + { + ASSERT(!IsAccessor()); + writable_ = writable; + } + + void Serialize(JsonObjectBuilder &builder) const override + { + builder.AddProperty("name", name_); + + if (symbol_) { + builder.AddProperty("symbol", *symbol_); + } + + if (isAccessor_) { + builder.AddProperty("get", value_); + } else { + builder.AddProperty("value", value_); + builder.AddProperty("writable", writable_); + } + + builder.AddProperty("configurable", configurable_); + builder.AddProperty("enumerable", enumerable_); + } + +private: + std::string name_; + std::optional symbol_; + RemoteObject value_; + bool isAccessor_ {false}; + bool configurable_ {false}; + bool enumerable_ {true}; + bool writable_ {true}; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_PROPERTY_DESCRIPTOR_H diff --git a/tooling/static/types/property_preview.h b/tooling/static/types/property_preview.h new file mode 100644 index 00000000..29a6b651 --- /dev/null +++ b/tooling/static/types/property_preview.h @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_PROPERTY_PREVIEW_H +#define PANDA_TOOLING_INSPECTOR_TYPES_PROPERTY_PREVIEW_H + +#include "tooling/inspector/types/remote_object_type.h" +#include "tooling/inspector/json_serialization/serializable.h" + +#include +#include + +namespace ark::tooling::inspector { + +class PropertyPreview final : public JsonSerializable { +public: + PropertyPreview(std::string name, RemoteObjectType type) : name_(std::move(name)), type_(std::move(type)) {} + + PropertyPreview(std::string name, RemoteObjectType type, const std::string &value) + : PropertyPreview(std::move(name), std::move(type)) + { + value_ = value; + } + + void Serialize(JsonObjectBuilder &builder) const override + { + type_.Serialize(builder); + builder.AddProperty("name", name_); + + if (value_) { + builder.AddProperty("value", *value_); + } + } + +private: + std::string name_; + RemoteObjectType type_; + std::optional value_; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_PROPERTY_PREVIEW_H diff --git a/tooling/static/types/remote_object.cpp b/tooling/static/types/remote_object.cpp new file mode 100644 index 00000000..508e4dc9 --- /dev/null +++ b/tooling/static/types/remote_object.cpp @@ -0,0 +1,161 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "types/remote_object.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libpandafile/helpers.h" +#include "macros.h" +#include "utils/json_builder.h" + +#include "types/object_preview.h" +#include "types/property_descriptor.h" + +namespace ark::tooling::inspector { + +std::string RemoteObject::GetDescription(const RemoteObjectType::BigIntT &bigint) +{ + return (bigint.sign >= 0 ? "" : "-") + std::to_string(bigint.value); +} + +std::string RemoteObject::GetDescription(const RemoteObjectType::ObjectT &object) +{ + return object.description.value_or(object.className); +} + +std::string RemoteObject::GetDescription(const RemoteObjectType::ArrayT &array) +{ + return array.className + "(" + std::to_string(array.length) + ")"; +} + +std::string RemoteObject::GetDescription(const RemoteObjectType::FunctionT &function) +{ + std::stringstream desc; + + desc << "function " << function.name << "("; + + for (auto argIdx = 0U; argIdx < function.length; ++argIdx) { + if (argIdx != 0) { + desc << ", "; + } + desc << static_cast('a' + argIdx); + } + + desc << ") { [not available] }"; + + return desc.str(); +} + +std::optional RemoteObject::GetObjectId() const +{ + if (auto object = std::get_if(&value_)) { + return object->objectId; + } + if (auto array = std::get_if(&value_)) { + return array->objectId; + } + if (auto function = std::get_if(&value_)) { + return function->objectId; + } + return {}; +} + +RemoteObjectType RemoteObject::GetType() const +{ + if (std::holds_alternative(value_)) { + return RemoteObjectType("undefined"); + } + if (std::holds_alternative(value_)) { + return RemoteObjectType("object", "null"); + } + if (std::holds_alternative(value_)) { + return RemoteObjectType("boolean"); + } + if (std::holds_alternative(value_)) { + return RemoteObjectType("number"); + } + if (std::holds_alternative(value_)) { + return RemoteObjectType("bigint"); + } + if (std::holds_alternative(value_)) { + return RemoteObjectType("string"); + } + if (std::holds_alternative(value_)) { + return RemoteObjectType("symbol"); + } + if (std::holds_alternative(value_)) { + return RemoteObjectType("object"); + } + if (std::holds_alternative(value_)) { + return RemoteObjectType("object", "array"); + } + if (std::holds_alternative(value_)) { + return RemoteObjectType("function"); + } + + UNREACHABLE(); +} + +void RemoteObject::Serialize(JsonObjectBuilder &builder) const +{ + GetType().Serialize(builder); + + if (std::holds_alternative(value_)) { + builder.AddProperty("value", nullptr); + } else if (auto boolean = std::get_if(&value_)) { + builder.AddProperty("value", *boolean); + } else if (auto number = std::get_if(&value_)) { + if (auto integer = std::get_if(number)) { + builder.AddProperty("value", *integer); + } else if (auto floatingPoint = std::get_if(number)) { + builder.AddProperty("value", *floatingPoint); + } else { + UNREACHABLE(); + } + } else if (auto bigint = std::get_if(&value_)) { + builder.AddProperty("unserializableValue", GetDescription(*bigint)); + } else if (auto string = std::get_if(&value_)) { + builder.AddProperty("value", *string); + } else if (auto symbol = std::get_if(&value_)) { + builder.AddProperty("description", symbol->description); + } else if (auto object = std::get_if(&value_)) { + builder.AddProperty("className", object->className); + builder.AddProperty("description", GetDescription(*object)); + } else if (auto array = std::get_if(&value_)) { + builder.AddProperty("className", array->className); + builder.AddProperty("description", GetDescription(*array)); + } else if (auto function = std::get_if(&value_)) { + builder.AddProperty("className", function->className); + builder.AddProperty("description", GetDescription(*function)); + } + + if (auto objectId = GetObjectId()) { + builder.AddProperty("objectId", std::to_string(*objectId)); + } + + if (preview_.has_value()) { + builder.AddProperty("preview", *preview_); + } +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/remote_object.h b/tooling/static/types/remote_object.h new file mode 100644 index 00000000..13583444 --- /dev/null +++ b/tooling/static/types/remote_object.h @@ -0,0 +1,154 @@ +/** + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_REMOTE_OBJECT_H +#define PANDA_TOOLING_INSPECTOR_TYPES_REMOTE_OBJECT_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "types/numeric_id.h" +#include "types/remote_object_type.h" +#include "types/object_preview.h" + +namespace ark { +class JsonObjectBuilder; +} // namespace ark + +namespace ark::tooling::inspector { + +class RemoteObject final : public JsonSerializable { +public: + static RemoteObject Undefined() + { + return RemoteObject(); + } + + static RemoteObject Null() + { + return RemoteObject(nullptr); + } + + static RemoteObject Boolean(bool boolean) + { + return RemoteObject(boolean); + } + + static RemoteObject Number(int32_t number) + { + return RemoteObject(RemoteObjectType::NumberT {number}); + } + + template , int> = 0> + static RemoteObject Number(T number) + { + return RemoteObject(RemoteObjectType::NumberT {number}); + } + + template && std::is_signed_v && sizeof(int32_t) < sizeof(T), int> = 0> + static RemoteObject Number(T number) + { + if (INT32_MIN <= number && number <= INT32_MAX) { + return RemoteObject(RemoteObjectType::NumberT {static_cast(number)}); + } + if (number < 0) { + return RemoteObject(RemoteObjectType::BigIntT {-1, -static_cast(number)}); + } + return RemoteObject(RemoteObjectType::BigIntT {1, static_cast(number)}); + } + + template && sizeof(int32_t) <= sizeof(T), int> = 0> + static RemoteObject Number(T number) + { + if (number <= INT32_MAX) { + return RemoteObject(RemoteObjectType::NumberT {static_cast(number)}); + } + return RemoteObject(RemoteObjectType::BigIntT {1, number}); + } + + static RemoteObject String(std::string string) + { + return RemoteObject(std::move(string)); + } + + static RemoteObject Symbol(std::string description) + { + return RemoteObject(RemoteObjectType::SymbolT {std::move(description)}); + } + + static RemoteObject Object(std::string className, std::optional objectId = std::nullopt, + std::optional description = std::nullopt) + { + return RemoteObject(RemoteObjectType::ObjectT {std::move(className), objectId, std::move(description)}); + } + + static RemoteObject Array(std::string className, size_t length, + std::optional objectId = std::nullopt) + { + return RemoteObject(RemoteObjectType::ArrayT {std::move(className), objectId, length}); + } + + static RemoteObject Function(std::string className, std::string name, size_t length, + std::optional objectId = std::nullopt) + { + return RemoteObject(RemoteObjectType::FunctionT {std::move(className), objectId, std::move(name), length}); + } + + std::optional GetObjectId() const; + + void Serialize(JsonObjectBuilder &builder) const override; + + RemoteObjectType GetType() const; + + void SetObjectPreview(ObjectPreview preview) + { + preview_ = std::move(preview); + } + + RemoteObjectType::TypeValue &GetValue() + { + return value_; + } + + const RemoteObjectType::TypeValue &GetValue() const + { + return value_; + } + + static std::string GetDescription(const RemoteObjectType::BigIntT &bigint); + static std::string GetDescription(const RemoteObjectType::ObjectT &object); + static std::string GetDescription(const RemoteObjectType::ArrayT &array); + static std::string GetDescription(const RemoteObjectType::FunctionT &function); + +private: + template + explicit RemoteObject(T &&...value) : value_(std::forward(value)...) + { + } + +private: + RemoteObjectType::TypeValue value_; + + std::optional preview_; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_REMOTE_OBJECT_H diff --git a/tooling/static/types/remote_object_type.h b/tooling/static/types/remote_object_type.h new file mode 100644 index 00000000..84be7c87 --- /dev/null +++ b/tooling/static/types/remote_object_type.h @@ -0,0 +1,87 @@ +/** + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_REMOTE_OBJECT_TYPE_H +#define PANDA_TOOLING_INSPECTOR_TYPES_REMOTE_OBJECT_TYPE_H + +#include "utils/json_builder.h" +#include "tooling/inspector/types/numeric_id.h" +#include "tooling/inspector/json_serialization/serializable.h" + +#include +#include + +namespace ark::tooling::inspector { + +class RemoteObjectType final : public JsonSerializable { +public: + using NumberT = std::variant; + + struct BigIntT { + int8_t sign; + uintmax_t value; + }; + + struct SymbolT { + std::string description; + }; + + struct ObjectT { + std::string className; + std::optional objectId; + std::optional description; + }; + + struct ArrayT { + std::string className; + std::optional objectId; + size_t length; + }; + + struct FunctionT { + std::string className; + std::optional objectId; + std::string name; + size_t length; + }; + + using TypeValue = std::variant; + +public: + explicit RemoteObjectType(const char *type, const char *subtype = nullptr) : type_(type), subtype_(subtype) {} + + static RemoteObjectType Accessor() + { + return RemoteObjectType("accessor"); + } + + void Serialize(JsonObjectBuilder &builder) const override + { + builder.AddProperty("type", type_); + + if (subtype_ != nullptr) { + builder.AddProperty("subtype", subtype_); + } + } + +private: + const char *type_ {nullptr}; + const char *subtype_ {nullptr}; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_REMOTE_OBJECT_TYPE_H diff --git a/tooling/static/types/scope.cpp b/tooling/static/types/scope.cpp new file mode 100644 index 00000000..200baf93 --- /dev/null +++ b/tooling/static/types/scope.cpp @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "types/scope.h" + +#include "libpandabase/utils/json_builder.h" + +namespace ark::tooling::inspector { +static const char *GetTypeString(Scope::Type type) +{ + switch (type) { + case Scope::Type::GLOBAL: + return "global"; + case Scope::Type::LOCAL: + return "local"; + default: + UNREACHABLE(); + return nullptr; + } +} + +Scope::Scope(Scope::Type type, RemoteObject object, std::optional name) + : type_(type), object_(std::move(object)), name_(std::move(name)) +{ +} + +void Scope::Serialize(JsonObjectBuilder &builder) const +{ + builder.AddProperty("type", GetTypeString(type_)); + builder.AddProperty("object", object_); + if (name_) { + builder.AddProperty("name", *name_); + } +} +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/scope.h b/tooling/static/types/scope.h new file mode 100644 index 00000000..6800d258 --- /dev/null +++ b/tooling/static/types/scope.h @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_SCOPE_H +#define PANDA_TOOLING_INSPECTOR_TYPES_SCOPE_H + +#include "runtime/tooling/inspector/types/remote_object.h" +#include "runtime/tooling/inspector/json_serialization/serializable.h" + +#include +#include + +namespace ark { +class JsonObjectBuilder; +} // namespace ark + +namespace ark::tooling::inspector { +class Scope final : public JsonSerializable { +public: + enum class Type { GLOBAL, LOCAL }; + + Scope(Type type, RemoteObject object, std::optional name = {}); + + void Serialize(JsonObjectBuilder &builder) const override; + +private: + Type type_; + RemoteObject object_; + std::optional name_; +}; +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_SCOPE_H diff --git a/tooling/static/types/script_source_response.h b/tooling/static/types/script_source_response.h new file mode 100644 index 00000000..27f50086 --- /dev/null +++ b/tooling/static/types/script_source_response.h @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_SCRIPT_SOURCE_RESPONSE_H +#define PANDA_TOOLING_INSPECTOR_TYPES_SCRIPT_SOURCE_RESPONSE_H + +#include "tooling/inspector/json_serialization/serializable.h" + +#include "macros.h" +#include "utils/json_builder.h" + +namespace ark::tooling::inspector { + +class ScriptSourceResponse final : public JsonSerializable { +public: + explicit ScriptSourceResponse(std::string_view source) : scriptSource_(source) {} + explicit ScriptSourceResponse(std::string &&source) : scriptSource_(std::move(source)) {} + + DEFAULT_COPY_SEMANTIC(ScriptSourceResponse); + DEFAULT_MOVE_SEMANTIC(ScriptSourceResponse); + + ~ScriptSourceResponse() override = default; + + void Serialize(JsonObjectBuilder &builder) const override + { + builder.AddProperty("scriptSource", scriptSource_); + } + +private: + std::string scriptSource_; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_SCRIPT_SOURCE_RESPONSE_H diff --git a/tooling/static/types/url_breakpoint_request.cpp b/tooling/static/types/url_breakpoint_request.cpp new file mode 100644 index 00000000..1f147984 --- /dev/null +++ b/tooling/static/types/url_breakpoint_request.cpp @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "types/url_breakpoint_request.h" + +#include +#include + +#include "utils/json_parser.h" + +#include "types/numeric_id.h" + +namespace ark::tooling::inspector { + +Expected UrlBreakpointRequest::FromJson(const JsonObject &object) +{ + UrlBreakpointRequest parsed; + + auto optLineNumber = ParseSizeProperty(object, "lineNumber"); + if (!optLineNumber) { + return Unexpected(optLineNumber.Error()); + } + parsed.lineNumber_ = optLineNumber.Value() + 1; + + if (auto url = object.GetValue("url")) { + parsed.url_ = *url; + } else if (auto urlRegex = object.GetValue("urlRegex")) { + parsed.urlRegex_ = *urlRegex; + } else { + return Unexpected(std::string("Either 'url' or 'urlRegex' must be specified")); + } + + if (auto condition = object.template GetValue("condition")) { + parsed.condition_ = *condition; + } + + return parsed; +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/url_breakpoint_request.h b/tooling/static/types/url_breakpoint_request.h new file mode 100644 index 00000000..35074ecf --- /dev/null +++ b/tooling/static/types/url_breakpoint_request.h @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_URL_BREAKPOINT_REQUEST_H +#define PANDA_TOOLING_INSPECTOR_TYPES_URL_BREAKPOINT_REQUEST_H + +#include + +#include "macros.h" +#include "utils/expected.h" + +namespace ark { +class JsonObject; +} // namespace ark + +namespace ark::tooling::inspector { + +/// @brief Request parameters of `Debugger.setBreakpointByUrl` method +class UrlBreakpointRequest final { +public: + static Expected FromJson(const JsonObject &object); + + DEFAULT_COPY_SEMANTIC(UrlBreakpointRequest); + DEFAULT_MOVE_SEMANTIC(UrlBreakpointRequest); + + ~UrlBreakpointRequest() = default; + + size_t GetLineNumber() const + { + return lineNumber_; + } + + const std::optional &GetUrl() const + { + return url_; + } + + const std::optional &GetUrlRegex() const + { + return urlRegex_; + } + + const std::optional &GetCondition() const + { + return condition_; + } + +private: + UrlBreakpointRequest() = default; + +private: + size_t lineNumber_ {0}; + std::optional url_; + std::optional urlRegex_; + std::optional condition_; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_URL_BREAKPOINT_REQUEST_H diff --git a/tooling/static/types/url_breakpoint_response.cpp b/tooling/static/types/url_breakpoint_response.cpp new file mode 100644 index 00000000..56e423cf --- /dev/null +++ b/tooling/static/types/url_breakpoint_response.cpp @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "types/url_breakpoint_response.h" + +#include "utils/json_builder.h" + +#include "types/custom_url_breakpoint_response.h" + +namespace ark::tooling::inspector { + +void UrlBreakpointResponse::Serialize(JsonObjectBuilder &builder) const +{ + builder.AddProperty("breakpointId", std::to_string(breakpointId_)); + builder.AddProperty("locations", [this](JsonArrayBuilder &locations) { + for (const auto &loc : locations_) { + locations.Add(loc); + } + }); +} + +CustomUrlBreakpointResponse UrlBreakpointResponse::ToCustomUrlBreakpointResponse() const +{ + ASSERT(!GetLocations().empty()); + const auto &loc = GetLocations()[0]; + CustomUrlBreakpointResponse converted(loc.GetLineNumber()); + return converted.SetColumnNumber(loc.GetColumnNumber()) + .SetScriptId(loc.GetScriptId()) + .SetBreakpointId(GetBreakpointId()); +} + +} // namespace ark::tooling::inspector diff --git a/tooling/static/types/url_breakpoint_response.h b/tooling/static/types/url_breakpoint_response.h new file mode 100644 index 00000000..8b2358e8 --- /dev/null +++ b/tooling/static/types/url_breakpoint_response.h @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PANDA_TOOLING_INSPECTOR_TYPES_URL_BREAKPOINT_RESPONSE_H +#define PANDA_TOOLING_INSPECTOR_TYPES_URL_BREAKPOINT_RESPONSE_H + +#include "tooling/inspector/json_serialization/serializable.h" + +#include + +#include "macros.h" + +#include "types/location.h" +#include "types/numeric_id.h" + +namespace ark { +class JsonObject; +class JsonObjectBuilder; +} // namespace ark + +namespace ark::tooling::inspector { + +class CustomUrlBreakpointResponse; + +class UrlBreakpointResponse final : public JsonSerializable { +public: + UrlBreakpointResponse(BreakpointId id, std::vector &&locations) + : breakpointId_(id), locations_(std::move(locations)) + { + } + + explicit UrlBreakpointResponse(BreakpointId id) : breakpointId_(id) {} + + DEFAULT_COPY_SEMANTIC(UrlBreakpointResponse); + DEFAULT_MOVE_SEMANTIC(UrlBreakpointResponse); + + ~UrlBreakpointResponse() override = default; + + BreakpointId GetBreakpointId() const + { + return breakpointId_; + } + + void SetBreakpointId(BreakpointId id) + { + breakpointId_ = id; + } + + const std::vector &GetLocations() const + { + return locations_; + } + + void AddLocation(Location &&loc) + { + locations_.emplace_back(std::move(loc)); + } + + CustomUrlBreakpointResponse ToCustomUrlBreakpointResponse() const; + + void Serialize(JsonObjectBuilder &builder) const override; + +private: + BreakpointId breakpointId_ {0}; + std::vector locations_; +}; + +} // namespace ark::tooling::inspector + +#endif // PANDA_TOOLING_INSPECTOR_TYPES_URL_BREAKPOINT_RESPONSE_H diff --git a/websocket/client/websocket_client.h b/websocket/client/websocket_client.h index 08f50033..6a6f4fc8 100644 --- a/websocket/client/websocket_client.h +++ b/websocket/client/websocket_client.h @@ -16,7 +16,6 @@ #ifndef ARKCOMPILER_TOOLCHAIN_WEBSOCKET_CLIENT_WEBSOCKET_CLIENT_H #define ARKCOMPILER_TOOLCHAIN_WEBSOCKET_CLIENT_WEBSOCKET_CLIENT_H -#include "http.h" #include "websocket_base.h" #include -- Gitee From d705f3a1cd65e10583aeab4e83222c11ed19a4b1 Mon Sep 17 00:00:00 2001 From: fangting Date: Mon, 30 Jun 2025 16:21:18 +0800 Subject: [PATCH 2/8] mac fix Issue:#ICIUQ5 Signed-off-by: fangting --- tooling/BUILD.gn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tooling/BUILD.gn b/tooling/BUILD.gn index a3d5d094..0a9ca09b 100644 --- a/tooling/BUILD.gn +++ b/tooling/BUILD.gn @@ -20,6 +20,8 @@ ohos_shared_library("libark_ecma_debugger") { if (is_mingw || is_win) { output_extension = "dll" + } else if (is_mac) { + output_extension = "dylib" } else { output_extension = "so" } -- Gitee From 0fb115efec3c58b36cdf230a42b89b759f15453e Mon Sep 17 00:00:00 2001 From: zhaoziming Date: Mon, 30 Jun 2025 23:47:32 +0800 Subject: [PATCH 3/8] Revert "rename ark_hybrid flag" Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/ICIYSD Signed-off-by: zhaoziming Change-Id: I9151c197d85e4a55bc7bd309ebeda196608e28ff --- build/core/gn/BUILD.gn | 140 -------------------------------- tooling/dynamic/BUILD.gn | 27 ++---- tooling/dynamic/client/BUILD.gn | 6 +- 3 files changed, 6 insertions(+), 167 deletions(-) delete mode 100644 build/core/gn/BUILD.gn diff --git a/build/core/gn/BUILD.gn b/build/core/gn/BUILD.gn deleted file mode 100644 index e7f0c607..00000000 --- a/build/core/gn/BUILD.gn +++ /dev/null @@ -1,140 +0,0 @@ -# Copyright (c) 2022-2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//arkcompiler/toolchain/toolchain.gni") -import("$build_root/config/components/ets_frontend/ets_frontend_config.gni") - -print("root_out_dir=$root_out_dir") -print("root_build_dir=$root_build_dir") -print("root_gen_dir=$root_gen_dir") -print("default_toolchain=$default_toolchain") -print("current_toolchain=$current_toolchain") -print("host_toolchain=$host_toolchain") -print("current_os=$current_os, current_cpu=$current_cpu") -print("host_os=$host_os, host_cpu=$host_cpu") -print("target_os=$target_os, target_cpu=$target_cpu") - -print() - -group("default") { - deps = [ - ":ets_frontend", - ":ets_runtime", - ":runtime_core", - ":toolchain", - ] -} - -group("unittest_packages") { - testonly = true - deps = [ - "$js_root:ark_runtime_host_unittest", - "$toolchain_root:ark_toolchain_host_unittest", - ] -} - -group("runtime_core_unittest_packages") { - testonly = true - deps = [ "$toolchain_root:runtime_core_host_ut" ] -} - -group("ets_runtime") { - deps = [ - "$js_root:js_type_metadata", - "$js_root:libark_jsruntime", - "$js_root/ecmascript/dfx/hprof:ark_js_heap_snapshot_tool", - "$js_root/ecmascript/dfx/hprof/rawheap_translate:rawheap_translator", - "$js_root/ecmascript/js_vm:ark_js_vm", - "$js_root/ecmascript/quick_fix:quick_fix", - ] - if ((target_os == "linux" && target_cpu == "x64") || - (target_cpu == "arm64" && target_os == "ohos") || - (target_cpu == "arm64" && target_os == "mac")) { - deps += [ - "$js_root/ecmascript/compiler:ark_aot_compiler", - "$js_root/ecmascript/compiler:ark_stub_compiler", - "$js_root/ecmascript/compiler:libark_jsoptimizer", - "$js_root/ecmascript/compiler:stub.an", - "$js_root/ecmascript/pgo_profiler/prof_dump:profdump", - ] - } -} - -group("ets_frontend") { - if ((target_os == "linux" && target_cpu == "x64") || target_os == "mingw" || - target_os == "mac") { - deps = [ - "$ets_frontend_root/es2panda:es2panda", - "$ets_frontend_root/merge_abc:merge_abc", - ] - if (target_os != "mac") { - deps += [ "$ets_frontend_root/ets2panda/lsp:lsp_packages" ] - } - } -} - -group("runtime_core") { - deps = [ - "$ark_root:ark_host_defectscanaux_tools", - "$ark_root/disassembler:ark_disasm", - ] -} - -group("static_core") { - deps = [ - "$ark_root/static_core/assembler:libarktsassembler", - "$ark_root/static_core/compiler:libarktscompiler", - "$ark_root/static_core/libpandabase:libarktsbase", - "$ark_root/static_core/libpandafile:libarktsfile", - ] - if (target_os != "mac") { - deps += [ "$ark_root/static_core/static_linker:static_linker" ] - } - if (target_os != "mingw" && target_os != "mac") { - deps += [ "$ark_root/static_core/runtime:libarkruntime" ] - } -} - -group("hybrid") { - deps = [ - ":ets_frontend", - ":ets_runtime", - ":static_core", - "$ark_root/static_core/plugins/ets:etsstdlib(${host_toolchain})", - ] - if (target_os != "mingw" && target_os != "mac") { - deps += [ - "$ark_root/static_core/plugins/ets/runtime/interop_js:ets_interop_js_napi", - "$ark_root/static_core/plugins/ets/tests/interop_js/test_helper:interop_test_helper", - "$ark_root/static_core/tools/ark_js_napi_cli:ark_js_napi_cli", - ] - } -} - -group("toolchain") { - deps = [] - if (target_cpu != "mipsel") { - deps += [ - "$toolchain_root/inspector:ark_debugger", - "$toolchain_root/inspector:connectserver_debugger", - "$toolchain_root/tooling:libark_ecma_debugger", - ] - } - if (target_os != "mingw") { - deps += [ - "$toolchain_root/tooling/dynamic/client:libark_client", - "$toolchain_root/tooling/dynamic/client/ark_cli:arkdb", - "$toolchain_root/tooling/dynamic/client/ark_multi:ark_multi", - ] - } -} diff --git a/tooling/dynamic/BUILD.gn b/tooling/dynamic/BUILD.gn index c04d3a08..73a659c9 100644 --- a/tooling/dynamic/BUILD.gn +++ b/tooling/dynamic/BUILD.gn @@ -60,12 +60,7 @@ ohos_source_set("libark_ecma_debugger_set") { defines = [] deps = [] - external_deps = [] - if (defined(ark_hybrid) && ark_hybrid) { - external_deps += [ "runtime_core:libarkruntime" ] - } else { - external_deps += [ "ets_runtime:libark_jsruntime" ] - } + external_deps = [ "ets_runtime:libark_jsruntime" ] if (is_arkui_x && target_os == "ios") { sources -= [ "../../common/log_wrapper.cpp" ] external_deps += [ "cJSON:cjson_static" ] @@ -116,17 +111,9 @@ ohos_static_library("libark_ecma_debugger_static") { external_deps += [ "hilog:libhilog" ] } if (!is_arkui_x) { - if (defined(ark_hybrid) && ark_hybrid) { - external_deps += [ "runtime_core:libarkruntime" ] - } else { - external_deps += [ "ets_runtime:libark_jsruntime" ] - } + external_deps += [ "ets_runtime:libark_jsruntime" ] } else { - if (defined(ark_hybrid) && ark_hybrid) { - deps += [ "../../../runtime_core:libarkruntime" ] - } else { - deps += [ "../../../ets_runtime:libark_jsruntime" ] - } + deps += [ "../../../ets_runtime:libark_jsruntime" ] } deps += hiviewdfx_deps @@ -155,11 +142,7 @@ ohos_static_library("libark_ecma_debugger_test") { "icu:shared_icuuc", "libuv:uv", ] - if (defined(ark_hybrid) && ark_hybrid) { - external_deps += [ "runtime_core:libarkruntime" ] - } else { - external_deps += [ "ets_runtime:libark_jsruntime" ] - } + external_deps += [ "ets_runtime:libark_jsruntime" ] if ((is_arkui_x && target_os == "ios") || target_os == "mac") { external_deps += [ "cJSON:cjson_static" ] } else { @@ -177,4 +160,4 @@ ohos_static_library("libark_ecma_debugger_test") { output_extension = "so" } subsystem_name = "test" -} \ No newline at end of file +} diff --git a/tooling/dynamic/client/BUILD.gn b/tooling/dynamic/client/BUILD.gn index a2772b8f..3aff4fe5 100644 --- a/tooling/dynamic/client/BUILD.gn +++ b/tooling/dynamic/client/BUILD.gn @@ -56,11 +56,7 @@ ohos_source_set("libark_client_set") { "libuv:uv", ] - if (defined(ark_hybrid) && ark_hybrid) { - external_deps += [ "runtime_core:libarkruntime" ] - } else { - external_deps += [ "ets_runtime:libark_jsruntime" ] - } + external_deps += [ "ets_runtime:libark_jsruntime" ] configs = [ "../../..:ark_toolchain_common_config" ] -- Gitee From d1784236a641b94081d857ef2ccb5e2911bce956 Mon Sep 17 00:00:00 2001 From: fangting Date: Tue, 1 Jul 2025 21:29:47 +0800 Subject: [PATCH 4/8] hybrid debugger support Issue:#ICJ6U7 Signed-off-by: fangting --- BUILD.gn | 1 + inspector/BUILD.gn | 3 +- inspector/init_static.cpp | 137 ++++++++++++++++++ .../init_static.h | 36 ++--- inspector/inspector.cpp | 88 +++++++++-- inspector/inspector.h | 14 +- inspector/ws_server.cpp | 8 +- inspector/ws_server.h | 6 +- toolchain_config.gni | 1 + tooling/BUILD.gn | 19 ++- tooling/dynamic/BUILD.gn | 8 +- tooling/dynamic/backend/js_pt_hooks.cpp | 9 +- tooling/dynamic/test/BUILD.gn | 7 +- tooling/hybrid_step/BUILD.gn | 60 ++++++++ tooling/hybrid_step/debug_step_flags.cpp | 95 ++++++++++++ tooling/hybrid_step/debug_step_flags.h | 50 +++++++ tooling/static/BUILD.gn | 30 +++- tooling/static/connection/event_loop.cpp | 9 +- tooling/static/connection/event_loop.h | 6 +- .../connection/ohos_ws/ohos_ws_server.cpp | 47 +++--- .../connection/ohos_ws/ohos_ws_server.h | 3 +- .../ohos_ws/ohos_ws_server_endpoint.cpp | 20 +-- .../ohos_ws/ohos_ws_server_endpoint.h | 13 +- tooling/static/debugger_arkapi.cpp | 88 ----------- tooling/static/init.cpp | 73 ++++++---- tooling/static/init.h | 38 +++++ tooling/static/inspector.cpp | 11 +- tooling/static/inspector.h | 2 +- tooling/static/inspector_server.cpp | 4 +- tooling/static/inspector_server.h | 4 +- tooling/static/types/evaluation_result.h | 2 +- tooling/static/types/exception_details.h | 2 +- tooling/static/types/location.h | 2 +- tooling/static/types/object_preview.cpp | 6 +- .../types/possible_breakpoints_response.h | 2 +- tooling/static/types/property_descriptor.h | 6 +- tooling/static/types/property_preview.h | 6 +- tooling/static/types/remote_object_type.h | 6 +- tooling/static/types/script_source_response.h | 2 +- .../static/types/url_breakpoint_response.h | 2 +- websocket/websocket_base.cpp | 4 +- 41 files changed, 672 insertions(+), 258 deletions(-) create mode 100644 inspector/init_static.cpp rename tooling/static/debugger_arkapi.h => inspector/init_static.h (45%) create mode 100644 tooling/hybrid_step/BUILD.gn create mode 100644 tooling/hybrid_step/debug_step_flags.cpp create mode 100644 tooling/hybrid_step/debug_step_flags.h delete mode 100644 tooling/static/debugger_arkapi.cpp create mode 100644 tooling/static/init.h diff --git a/BUILD.gn b/BUILD.gn index 6e2cea7d..1c732cc6 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -253,6 +253,7 @@ group("ark_toolchain_packages") { "./inspector:ark_debugger", "./inspector:connectserver_debugger", "./tooling:libark_ecma_debugger", + "./tooling:libarkinspector_plus", "./tooling/dynamic/client:libark_client", "./tooling/dynamic/client/ark_cli:arkdb", "./tooling/dynamic/client/ark_multi:ark_multi", diff --git a/inspector/BUILD.gn b/inspector/BUILD.gn index b7703724..220a77dd 100644 --- a/inspector/BUILD.gn +++ b/inspector/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -34,6 +34,7 @@ ohos_source_set("ark_debugger_static") { sources = [ "../common/log_wrapper.cpp", "inspector.cpp", + "init_static.cpp", "library_loader.cpp", "ws_server.cpp", ] diff --git a/inspector/init_static.cpp b/inspector/init_static.cpp new file mode 100644 index 00000000..a57b5351 --- /dev/null +++ b/inspector/init_static.cpp @@ -0,0 +1,137 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include + +#include "library_loader.h" +#include "common/log_wrapper.h" +#include "init_static.h" + +#if defined(UNIX_PLATFORM) +#include +#elif defined(WINDOWS_PLATFORM) +#include +#ifdef ERROR +#undef ERROR +#endif +#else +#error "Unsupported platform" +#endif + +namespace OHOS::ArkCompiler::Toolchain { + + +using InitializeInspectorFunc = void(*)(std::shared_ptr, bool); +using HandleMessageFunc = void(*)(std::string&&); +using StopInspectorFunc = void(*)(); +using WaitForDebuggerFunc = void(*)(); +using StartDebuggerFunc = void(*)(uint32_t, bool); +using StopDebuggerFunc = void(*)(); + +static void* g_debuggerHandle = nullptr; + +static InitializeInspectorFunc g_initializeInspectorForStatic = nullptr; +static HandleMessageFunc g_handleMessageForStatic = nullptr; +static StopInspectorFunc g_stopInspectorForStatic = nullptr; +static WaitForDebuggerFunc g_waitForDebuggerForStatic = nullptr; +static StartDebuggerFunc g_startDebuggerForStatic = nullptr; +static StopDebuggerFunc g_stopDebuggerForStatic = nullptr; + +bool InitializeArkFunctionsForStatic() +{ + if (g_debuggerHandle) { + return true; + } + g_debuggerHandle = Load("libarkinspector.so"); + if (g_debuggerHandle == nullptr) { + return false; + } + g_initializeInspectorForStatic = reinterpret_cast( + ResolveSymbol(g_debuggerHandle, "InitializeInspector")); + if (g_initializeInspectorForStatic == nullptr) { + return false; + } + g_startDebuggerForStatic = reinterpret_cast( + ResolveSymbol(g_debuggerHandle, "StartDebugger")); + if (g_startDebuggerForStatic == nullptr) { + return false; + } + g_stopDebuggerForStatic = reinterpret_cast( + ResolveSymbol(g_debuggerHandle, "StopDebugger")); + if (g_stopDebuggerForStatic == nullptr) { + return false; + } + g_handleMessageForStatic = reinterpret_cast( + ResolveSymbol(g_debuggerHandle, "HandleMessage")); + if (g_handleMessageForStatic == nullptr) { + return false; + } + g_stopInspectorForStatic = reinterpret_cast( + ResolveSymbol(g_debuggerHandle, "StopInspector")); + if (g_stopInspectorForStatic == nullptr) { + return false; + } + g_waitForDebuggerForStatic = reinterpret_cast( + ResolveSymbol(g_debuggerHandle, "WaitForDebugger")); + if (g_waitForDebuggerForStatic == nullptr) { + return false; + } + return true; +} + +void HandleMessage(std::string&& message) +{ + g_handleMessageForStatic(std::move(message)); +} + +int StopDebuggerForStatic() +{ + g_stopInspectorForStatic(); + return 0; +} + +bool StartDebuggerForStatic(std::shared_ptr endpoint, bool breakOnStart) +{ + if (endpoint == nullptr) { + LOGE("StartDebuggerForStatic Endpoint == nullptr"); + } + g_initializeInspectorForStatic(endpoint, breakOnStart); + return true; +} +void WaitForDebuggerForStatic() +{ + g_waitForDebuggerForStatic(); +} + +int StartDebuggerInitForStatic(uint32_t port, bool breakOnStart) +{ + if (!InitializeArkFunctionsForStatic()) { + LOGE("StartDebuggerInitForStatic Error"); + } + g_startDebuggerForStatic(port, breakOnStart); + return 1; +} + +int StopDebuggerInitForStatic() +{ + if (!InitializeArkFunctionsForStatic()) { + LOGE("StopDebuggerInitForStatic Error"); + } + g_stopDebuggerForStatic(); + return 1; +} +} diff --git a/tooling/static/debugger_arkapi.h b/inspector/init_static.h similarity index 45% rename from tooling/static/debugger_arkapi.h rename to inspector/init_static.h index af3039ea..0d8e6ee5 100644 --- a/tooling/static/debugger_arkapi.h +++ b/inspector/init_static.h @@ -13,31 +13,27 @@ * limitations under the License. */ -#ifndef PANDA_DEBUGGER_ARKAPI_H -#define PANDA_DEBUGGER_ARKAPI_H +#ifndef ECMASCRIPT_TOOLING_INIT_STATIC_H +#define ECMASCRIPT_TOOLING_INIT_STATIC_H -#include -#include +#include +#include +#include "common/log_wrapper.h" -#include "libpandabase/macros.h" +namespace OHOS::ArkCompiler::Toolchain { +bool InitializeArkFunctionsForStatic(); -namespace ark { -class PANDA_PUBLIC_API ArkDebugNativeAPI final { -public: - using DebuggerPostTask = std::function &&)>; +void HandleMessage(std::string &&message); - static bool StartDebuggerForSocketPair(int tid, int socketfd = -1); - static bool NotifyDebugMode(int tid, int32_t instanceId = 0, bool debugApp = false); - static bool StopDebugger(); - static bool IsDebugModeEnabled(); +int StopDebuggerForStatic(); - ArkDebugNativeAPI() = delete; - ~ArkDebugNativeAPI() = delete; +bool StartDebuggerForStatic(std::shared_ptr endpoint, bool breakOnStart); - NO_COPY_SEMANTIC(ArkDebugNativeAPI); - NO_MOVE_SEMANTIC(ArkDebugNativeAPI); -}; +void WaitForDebuggerForStatic(); -} // namespace ark +int StartDebuggerInitForStatic(uint32_t port, bool breakOnStart); -#endif // PANDA_DEBUGGER_ARKAPI_H +int StopDebuggerInitForStatic(); +} + +#endif //ECMASCRIPT_TOOLING_INIT_STATIC_H \ No newline at end of file diff --git a/inspector/inspector.cpp b/inspector/inspector.cpp index 6af88825..0ef5bba2 100644 --- a/inspector/inspector.cpp +++ b/inspector/inspector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,6 +14,7 @@ */ #include "inspector.h" +#include "init_static.h" #include #if defined(OHOS_PLATFORM) @@ -81,7 +82,33 @@ constexpr char ARK_DEBUGGER_SHARED_LIB[] = "libark_tooling.so"; #endif #endif -void* HandleClient(void* const server) +struct ClientArgs { + void* server; + bool isHybrid; +}; + +void* HandleHybridClient(void* arg) +{ + ClientArgs* args = static_cast(arg); + auto server = args->server; + LOGI("HandleClient"); + if (server == nullptr) { + LOGE("HandleClient server nullptr"); + return nullptr; + } + +#if defined(IOS_PLATFORM) || defined(MAC_PLATFORM) + pthread_setname_np("OS_DebugThread"); +#else + pthread_setname_np(pthread_self(), "OS_DebugThread"); +#endif + + static_cast(server)->RunServer(args->isHybrid); + delete args; + return nullptr; +} + +void* HandleNormalClient(void* const server) { LOGI("HandleClient"); if (server == nullptr) { @@ -149,7 +176,9 @@ void ResetServiceLocked(void *vm, bool isCloseHandle) } bool InitializeInspector( - void* vm, const DebuggerPostTask& debuggerPostTask, const DebugInfo& debugInfo, int tidForSocketPair = 0) + void* vm, const DebuggerPostTask& debuggerPostTask, + const DebugInfo& debugInfo, + int tidForSocketPair = 0, bool isHybrid = false) { std::unique_lock lock(g_mutex); auto iter = g_inspectors.find(vm); @@ -166,14 +195,24 @@ bool InitializeInspector( newInspector->vm_ = vm; newInspector->debuggerPostTask_ = debuggerPostTask; newInspector->websocketServer_ = std::make_unique(debugInfo, - std::bind(&Inspector::OnMessage, newInspector, std::placeholders::_1)); + std::bind(&Inspector::OnMessage, newInspector, std::placeholders::_1, isHybrid)); pthread_t tid; - if (pthread_create(&tid, nullptr, &HandleClient, static_cast( - newInspector->websocketServer_.get())) != 0) { - LOGE("Create inspector thread failed"); - return false; + + auto server = static_cast(newInspector->websocketServer_.get()); + if (isHybrid) { + ClientArgs* args = new ClientArgs{server, isHybrid}; + if (pthread_create(&tid, nullptr, &HandleHybridClient, args)) { + LOGE("Create inspector thread failed"); + return false; + }; + } else { + if (pthread_create(&tid, nullptr, &HandleNormalClient, server)) { + LOGE("Create inspector thread failed"); + return false; + }; } + newInspector->websocketServer_->tid_ = tid; return true; @@ -273,8 +312,11 @@ bool InitializeArkFunctions() } // namespace -void Inspector::OnMessage(std::string&& msg) +void Inspector::OnMessage(std::string&& msg, bool isHybrid) { + if (isHybrid) { + HandleMessage(std::move(msg)); + } g_onMessage(vm_, std::move(msg)); // message will be processed soon if the debugger thread is in running or waiting status @@ -348,7 +390,7 @@ void *GetEcmaVM(int tid) return g_debuggerInfo[tid].first; } -bool InitializeDebuggerForSocketpair(void* vm) +bool InitializeDebuggerForSocketpair(void* vm, bool isHybrid) { #if !defined(IOS_PLATFORM) if (!LoadArkDebuggerLibrary()) { @@ -359,12 +401,18 @@ bool InitializeDebuggerForSocketpair(void* vm) LOGE("Initialize ark functions failed"); return false; } + if (isHybrid) { + if (!InitializeArkFunctionsForStatic()) { + LOGE("Initialize ark functions failed"); + return false; + }; + } g_initializeDebugger(vm, std::bind(&SendReply, vm, std::placeholders::_2)); return true; } // for ohos platform. -bool StartDebugForSocketpair(int tid, int socketfd) +bool StartDebugForSocketpair(int tid, int socketfd, bool isHybrid) { LOGI("StartDebugForSocketpair, tid = %{private}d, socketfd = %{private}d", tid, socketfd); void* vm = GetEcmaVM(tid); @@ -378,7 +426,7 @@ bool StartDebugForSocketpair(int tid, int socketfd) } const DebuggerPostTask &debuggerPostTask = GetDebuggerPostTask(tid); DebugInfo debugInfo = {socketfd}; - if (!InitializeInspector(vm, debuggerPostTask, debugInfo, tid)) { + if (!InitializeInspector(vm, debuggerPostTask, debugInfo, tid, isHybrid)) { LOGE("Initialize inspector failed"); return false; } @@ -425,7 +473,18 @@ void WaitForDebugger(void* vm) g_waitForDebugger(vm); } -void StopDebug(void* vm) + +int StartDebugger(uint32_t port, bool breakOnStart) +{ + return StartDebuggerInitForStatic(port, breakOnStart); +} + +int StopDebugger() +{ + return StopDebuggerInitForStatic(); +} + +void StopDebug(void* vm, bool isHybrid) { LOGI("StopDebug start, vm is %{private}p", vm); std::unique_lock lock(g_mutex); @@ -444,6 +503,9 @@ void StopDebug(void* vm) } ResetServiceLocked(vm, true); g_uninitializeDebugger(vm); + if (isHybrid) { + StopDebuggerForStatic(); + } LOGI("StopDebug end"); } diff --git a/inspector/inspector.h b/inspector/inspector.h index 9dc21e8c..430dda76 100644 --- a/inspector/inspector.h +++ b/inspector/inspector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -35,16 +35,20 @@ extern "C" { bool StartDebug(const std::string& componentName, void* vm, bool isDebugMode, int32_t instanceId, const DebuggerPostTask& debuggerPostTask, int port); -bool StartDebugForSocketpair(int tid, int socketfd); +bool StartDebugForSocketpair(int tid, int socketfd, bool isHybrid = false); -bool InitializeDebuggerForSocketpair(void* vm); +bool InitializeDebuggerForSocketpair(void* vm, bool isHybrid = false); -void StopDebug(void* vm); +void StopDebug(void* vm, bool isHybrid = false); void StopOldDebug(int tid, const std::string& componentName); void WaitForDebugger(void* vm); +int StartDebugger(uint32_t port, bool breakOnStart); + +int StopDebugger(); + void StoreDebuggerInfo(int tid, void* vm, const DebuggerPostTask& debuggerPostTask); // The returned pointer must be released using free() after it is no longer needed. @@ -61,7 +65,7 @@ public: Inspector() = default; ~Inspector() = default; - void OnMessage(std::string&& msg); + void OnMessage(std::string&& msg, bool isHybrid = false); #if defined(OHOS_PLATFORM) static uint64_t GetThreadOrTaskId(); #endif // defined(OHOS_PLATFORM) diff --git a/inspector/ws_server.cpp b/inspector/ws_server.cpp index 744bdb5e..ffb7b988 100644 --- a/inspector/ws_server.cpp +++ b/inspector/ws_server.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,6 +14,7 @@ */ #include "ws_server.h" +#include "init_static.h" #include @@ -30,7 +31,7 @@ WsServer::WsServer(const DebugInfo& debugInfo, const std::function lock(wsMutex_); @@ -66,6 +67,9 @@ void WsServer::RunServer() return; } } + if (isHybrid) { + StartDebuggerForStatic(webSocket_, true); + } #endif } ContinueRunserver(); diff --git a/inspector/ws_server.h b/inspector/ws_server.h index 47df2dc6..f0f18d24 100644 --- a/inspector/ws_server.h +++ b/inspector/ws_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -39,7 +39,7 @@ class WsServer { public: WsServer(const DebugInfo& debugInfo, const std::function& onMessage); ~WsServer(); - void RunServer(); + void RunServer(bool isHybrid = false); void ContinueRunserver(); void StopServer(); void SendReply(const std::string& message) const; @@ -53,7 +53,7 @@ private: std::mutex wsMutex_; DebugInfo debugInfo_ {}; std::function wsOnMessage_ {}; - std::unique_ptr webSocket_ { nullptr }; + std::shared_ptr webSocket_ { nullptr }; }; } // namespace OHOS::ArkCompiler::Toolchain diff --git a/toolchain_config.gni b/toolchain_config.gni index 578cad4c..51120f4d 100644 --- a/toolchain_config.gni +++ b/toolchain_config.gni @@ -117,3 +117,4 @@ enable_local_code_sign = false if (have_local_code_sign && enable_target_compilation) { enable_local_code_sign = true } +sdk_libc_secshared_ext_dep = "bounds_checking_function:libsec_static" diff --git a/tooling/BUILD.gn b/tooling/BUILD.gn index 0a9ca09b..a7b847fc 100644 --- a/tooling/BUILD.gn +++ b/tooling/BUILD.gn @@ -31,14 +31,29 @@ ohos_shared_library("libark_ecma_debugger") { output_name = "libark_tooling" } -ohos_shared_library("libark_tooling_plus") { - deps = [ "./static/:libark_tooling_plus_static" ] +ohos_shared_library("libarkinspector_plus") { + deps = [ + "./static/:libarkinspector_plus_static", + ] + install_enable = true + external_deps = [ + "runtime_core:arktsdisassembler", + "runtime_core:libarktsbase_package", + "runtime_core:libarkruntime", + ] + + external_deps += hiviewdfx_ext_deps + if (is_mingw || is_win) { output_extension = "dll" + } else if (is_mac) { + output_extension = "dylib" } else { output_extension = "so" } + + output_name = "arkinspector" part_name = "toolchain" subsystem_name = "arkcompiler" } diff --git a/tooling/dynamic/BUILD.gn b/tooling/dynamic/BUILD.gn index 73a659c9..66345008 100644 --- a/tooling/dynamic/BUILD.gn +++ b/tooling/dynamic/BUILD.gn @@ -67,9 +67,11 @@ ohos_source_set("libark_ecma_debugger_set") { } else { external_deps += [ "cJSON:cjson" ] } + external_deps += [ "ets_runtime:libark_jsruntime" ] external_deps += [ "icu:shared_icuuc", "libuv:uv", + sdk_libc_secshared_dep ] if (is_ohos && is_standard_system && !is_arkui_x) { @@ -82,7 +84,8 @@ ohos_source_set("libark_ecma_debugger_set") { external_deps += [ "runtime_core:libarkfile_static" ] deps += hiviewdfx_deps - + deps += [ "../hybrid_step:arkhybridstep" ] + if (enable_leak_check) { sources += [ "$js_root/ecmascript/dfx/native_dfx/backtrace.cpp" ] defines += [ @@ -103,8 +106,6 @@ ohos_static_library("libark_ecma_debugger_static") { external_deps += [ "cJSON:cjson_static" ] } - - # hiviewdfx libraries external_deps += hiviewdfx_ext_deps if (enable_hilog) { @@ -151,6 +152,7 @@ ohos_static_library("libark_ecma_debugger_test") { # hiviewdfx libraries external_deps += hiviewdfx_ext_deps + deps += [ "../hybrid_step:arkhybridstep" ] deps += hiviewdfx_deps if (enable_hilog) { external_deps += [ "hilog:libhilog" ] diff --git a/tooling/dynamic/backend/js_pt_hooks.cpp b/tooling/dynamic/backend/js_pt_hooks.cpp index c84e885f..c72be824 100644 --- a/tooling/dynamic/backend/js_pt_hooks.cpp +++ b/tooling/dynamic/backend/js_pt_hooks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,8 +14,8 @@ */ #include "backend/js_pt_hooks.h" - #include "agent/debugger_impl.h" +#include "../hybrid_step/debug_step_flags.h" namespace panda::ecmascript::tooling { void JSPtHooks::DebuggerStmt([[maybe_unused]] const JSPtLocation &location) @@ -47,6 +47,11 @@ bool JSPtHooks::SingleStep(const JSPtLocation &location) LOG_DEBUGGER(VERBOSE) << "JSPtHooks: SingleStep => " << location.GetBytecodeOffset(); [[maybe_unused]] LocalScope scope(debugger_->vm_); + + if (DebugStepFlags::Get().GetStat2DynInto()) { + debugger_->NotifyPaused({}, BREAK_ON_START); + DebugStepFlags::Get().SetStat2DynInto(false); + } if (UNLIKELY(firstTime_)) { firstTime_ = false; diff --git a/tooling/dynamic/test/BUILD.gn b/tooling/dynamic/test/BUILD.gn index ed8586b0..667272e9 100644 --- a/tooling/dynamic/test/BUILD.gn +++ b/tooling/dynamic/test/BUILD.gn @@ -95,7 +95,10 @@ ohos_shared_library("debugger_entry") { foreach(file, test_js_files) { deps += [ ":gen_${file}_abc" ] } - external_deps = [ "libuv:uv" ] + external_deps = [ + "libuv:uv", + "ets_runtime:libark_jsruntime" + ] if (enable_hilog) { external_deps += [ "hilog:libhilog" ] } @@ -312,6 +315,7 @@ host_unittest_action("DebuggerClientTest") { external_deps += [ "bounds_checking_function:libsec_shared", "cJSON:cjson_static", + "ets_runtime:libark_jsruntime", "icu:shared_icui18n", "icu:shared_icuuc", "libuv:uv", @@ -359,6 +363,7 @@ host_unittest_action("DebuggerCIntClientTest") { external_deps += [ "bounds_checking_function:libsec_shared", "cJSON:cjson_static", + "ets_runtime:libark_jsruntime", "icu:shared_icui18n", "icu:shared_icuuc", "libuv:uv", diff --git a/tooling/hybrid_step/BUILD.gn b/tooling/hybrid_step/BUILD.gn new file mode 100644 index 00000000..f615c351 --- /dev/null +++ b/tooling/hybrid_step/BUILD.gn @@ -0,0 +1,60 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../../toolchain.gni") + +ohos_source_set("libarkhybridstep_set") { + stack_protector_ret = true + defines = [] + deps = [] + + include_dirs = [ + "./", + ] + + sources = [ "debug_step_flags.cpp" ] + + external_deps = [] + + cflags_cc = [ "-Wno-vla-extension" ] + + subsystem_name = "arkcompiler" + part_name = "toolchain" +} + +ohos_shared_library("arkhybridstep") +{ + stack_protector_ret = true + deps = [ ":libarkhybridstep_set" ] + + install_enable = true + external_deps = [] + # hiviewdfx libraries + external_deps += hiviewdfx_ext_deps + if (enable_hilog) { + external_deps += [ "hilog:libhilog" ] + } + + deps += hiviewdfx_deps + + if (!is_mingw && !is_mac) { + output_extension = "so" + } + + if (!is_standard_system) { + relative_install_dir = "ark" + } + subsystem_name = "arkcompiler" + part_name = "toolchain" + output_name = "libarkhybridstep" +} \ No newline at end of file diff --git a/tooling/hybrid_step/debug_step_flags.cpp b/tooling/hybrid_step/debug_step_flags.cpp new file mode 100644 index 00000000..1f492d18 --- /dev/null +++ b/tooling/hybrid_step/debug_step_flags.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "debug_step_flags.h" + +DebugStepFlags& DebugStepFlags::Get() +{ + static DebugStepFlags instance; + return instance; +} + +// 设置函数实现 +void DebugStepFlags::SetDyn2StatInto(bool value) +{ + std::lock_guard lock(mutex_); + dyn2statInto_ = value; +} + +void DebugStepFlags::SetDyn2StatOut(bool value) +{ + std::lock_guard lock(mutex_); + dyn2statOut_ = value; +} + +void DebugStepFlags::SetDyn2StatOver(bool value) +{ + std::lock_guard lock(mutex_); + dyn2statOver_ = value; +} + +void DebugStepFlags::SetStat2DynInto(bool value) +{ + std::lock_guard lock(mutex_); + stat2dynInto_ = value; +} + +void DebugStepFlags::SetStat2DynOut(bool value) +{ + std::lock_guard lock(mutex_); + stat2dynOut_ = value; +} + +void DebugStepFlags::SetStat2DynOver(bool value) +{ + std::lock_guard lock(mutex_); + stat2dynOver_ = value; +} + +bool DebugStepFlags::GetDyn2StatInto() +{ + std::lock_guard lock(mutex_); + return dyn2statInto_; +} + +bool DebugStepFlags::GetDyn2StatOut() +{ + std::lock_guard lock(mutex_); + return dyn2statOut_; +} + +bool DebugStepFlags::GetDyn2StatOver() +{ + std::lock_guard lock(mutex_); + return dyn2statOver_; +} + +bool DebugStepFlags::GetStat2DynInto() +{ + std::lock_guard lock(mutex_); + return stat2dynInto_; +} + +bool DebugStepFlags::GetStat2DynOut() +{ + std::lock_guard lock(mutex_); + return stat2dynOut_; +} + +bool DebugStepFlags::GetStat2DynOver() +{ + std::lock_guard lock(mutex_); + return stat2dynOver_; +} \ No newline at end of file diff --git a/tooling/hybrid_step/debug_step_flags.h b/tooling/hybrid_step/debug_step_flags.h new file mode 100644 index 00000000..e6e19651 --- /dev/null +++ b/tooling/hybrid_step/debug_step_flags.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef DEBUG_STEP_FLAGS_H +#define DEBUG_STEP_FLAGS_H + +#include + +class DebugStepFlags { +public: + static DebugStepFlags& Get(); + void SetDyn2StatInto(bool value); + void SetDyn2StatOut(bool value); + void SetDyn2StatOver(bool value); + void SetStat2DynInto(bool value); + void SetStat2DynOut(bool value); + void SetStat2DynOver(bool value); + + bool GetDyn2StatInto(); + bool GetDyn2StatOut(); + bool GetDyn2StatOver(); + bool GetStat2DynInto(); + bool GetStat2DynOut(); + bool GetStat2DynOver(); + +private: + bool dyn2statInto_ = false; + bool dyn2statOut_ = false; + bool dyn2statOver_ = false; + + bool stat2dynInto_ = false; + bool stat2dynOut_ = false; + bool stat2dynOver_ = false; + + std::mutex mutex_; +}; + +#endif // DEBUG_STEP_FLAGS_H \ No newline at end of file diff --git a/tooling/static/BUILD.gn b/tooling/static/BUILD.gn index 1e1decd2..72e6ef34 100644 --- a/tooling/static/BUILD.gn +++ b/tooling/static/BUILD.gn @@ -14,6 +14,7 @@ import("../../toolchain.gni") libarkinspector_sources = [ + "init.cpp", "connection/endpoint_base.cpp", "connection/event_loop.cpp", "connection/ohos_ws/ohos_ws_server.cpp", @@ -28,7 +29,6 @@ libarkinspector_sources = [ "debugger/thread_state.cpp", "error.cpp", "evaluation/evaluation_engine.cpp", - "init.cpp", "inspector.cpp", "inspector_server.cpp", "json_serialization/jrpc_error.cpp", @@ -54,19 +54,39 @@ config("libarkinspector_config") { "-Wno-null-pointer-subtraction", "-Wno-error=unknown-warning-option", ] - + include_dirs = [ "./" ] + include_dirs += [ "../" ] + include_dirs += [ "../../" ] + defines = [] + if (enable_hilog) { + defines += [ "ENABLE_HILOG" ] + } # required for arkcompiler_toolchain compilation if (is_ohos) { - defines = [ "OHOS_PLATFORM" ] + defines += [ "OHOS_PLATFORM" ] } } -ohos_static_library("libark_tooling_plus_static") { +ohos_static_library("libarkinspector_plus_static") { sources = libarkinspector_sources - external_deps = hiviewdfx_ext_deps + + configs = [ + ":libarkinspector_config" + ] + external_deps = [ + "runtime_core:libarktscompiler", + "runtime_core:arktsdisassembler", + "runtime_core:libarktsbase_package", + ] + deps = [ + "../../websocket:websocket_server", + "../hybrid_step:arkhybridstep", + ] if (is_mingw || is_win) { output_extension = "dll" + } else if (is_mac) { + output_extension = "dylib" } else { output_extension = "so" } diff --git a/tooling/static/connection/event_loop.cpp b/tooling/static/connection/event_loop.cpp index a9940f42..c55b4da3 100644 --- a/tooling/static/connection/event_loop.cpp +++ b/tooling/static/connection/event_loop.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -23,13 +23,10 @@ bool EventLoop::Kill() return running_.exchange(false); } -void EventLoop::Run() +void EventLoop::Run(const std::string& msg) { ASSERT_PRINT(!running_, "Event loop is already running"); - for (running_ = true; running_;) { - os::memory::WriteLockHolder lock(taskExecution_); - RunOne(); - } + ParseMessage(msg); } } // namespace ark::tooling::inspector diff --git a/tooling/static/connection/event_loop.h b/tooling/static/connection/event_loop.h index 06b7e668..73e2f518 100644 --- a/tooling/static/connection/event_loop.h +++ b/tooling/static/connection/event_loop.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -27,10 +27,10 @@ public: bool Kill(); // Run the event loop until paused. - void Run(); + void Run(const std::string& msg); // Run at most one event loop handler, may block. - virtual bool RunOne() = 0; + virtual bool ParseMessage(const std::string& msg) = 0; // Pause the event loop. Wait for the current task to finish. void Pause() ACQUIRE_SHARED(taskExecution_) diff --git a/tooling/static/connection/ohos_ws/ohos_ws_server.cpp b/tooling/static/connection/ohos_ws/ohos_ws_server.cpp index 3d7894d6..5d9e8065 100644 --- a/tooling/static/connection/ohos_ws/ohos_ws_server.cpp +++ b/tooling/static/connection/ohos_ws/ohos_ws_server.cpp @@ -20,59 +20,50 @@ #include "os/thread.h" #include "utils/logger.h" +#include "inspector.h" namespace ark::tooling::inspector { [[maybe_unused]] static constexpr std::string_view G_ARK_TS_INSPECTOR_NAME = "ArkEtsDebugger"; -bool OhosWsServer::RunOne() +bool OhosWsServer::ParseMessage(const std::string& msg) { - if (!endpoint_.IsConnected() && !AcceptNewWsConnection()) { + if (endpoint_ == nullptr) { + return false; + } + if (!endpoint_->IsConnected() && !AcceptNewWsConnection()) { LOG(WARNING, DEBUGGER) << "Inspector server is unable to establish a new connection, exiting"; return false; } - auto message = endpoint_.Decode(); - if (!message.empty()) { - if (Endpoint::IsDecodeDisconnectMsg(message)) { - LOG(WARNING, DEBUGGER) << "Inspector server received `disconnect`, exiting"; - return false; - } - HandleMessage(message); - } + HandleMessage(msg); return true; } bool OhosWsServer::Start([[maybe_unused]] uint32_t port) { - bool succeeded = false; + return true; +} -#if !defined(PANDA_TARGET_OHOS) - succeeded = endpoint_.InitTcpWebSocket(port); - uint32_t name = port; -#else - auto pid = os::thread::GetPid(); - std::string name = std::to_string(pid) + std::string(G_ARK_TS_INSPECTOR_NAME); - succeeded = endpoint_.InitUnixWebSocket(name); -#endif - if (succeeded) { - LOG(INFO, DEBUGGER) << "Inspector server listening on " << name; - return true; +void OhosWsServer::InitEndPoint(std::shared_ptr endPoint) +{ + if (endPoint == nullptr) { + LOG(ERROR, DEBUGGER) << "OhosWsServer::InitEndPoint endPoint is nullptr"; + return; } - LOG(ERROR, DEBUGGER) << "Failed to bind Inspector server on " << name; - return false; + + endpoint_ = std::static_pointer_cast(endPoint); } bool OhosWsServer::Stop() { // Stop event loop before closing endpoint server. Kill(); - endpoint_.Close(); socketpairMode_ = false; return true; } bool OhosWsServer::StartForSocketpair(int socketfd) { - bool succeeded = endpoint_.InitUnixWebSocket(socketfd); + bool succeeded = endpoint_->InitUnixWebSocket(socketfd); if (succeeded) { LOG(INFO, DEBUGGER) << "Inspector server listening on " << socketfd; socketpairMode_ = true; @@ -86,9 +77,9 @@ bool OhosWsServer::StartForSocketpair(int socketfd) bool OhosWsServer::AcceptNewWsConnection() { if (socketpairMode_) { - return endpoint_.ConnectUnixWebSocketBySocketpair(); + return endpoint_->ConnectUnixWebSocketBySocketpair(); } - return endpoint_.AcceptNewConnection(); + return endpoint_->AcceptNewConnection(); } } // namespace ark::tooling::inspector diff --git a/tooling/static/connection/ohos_ws/ohos_ws_server.h b/tooling/static/connection/ohos_ws/ohos_ws_server.h index 870b8cc1..151b828e 100644 --- a/tooling/static/connection/ohos_ws/ohos_ws_server.h +++ b/tooling/static/connection/ohos_ws/ohos_ws_server.h @@ -24,12 +24,13 @@ namespace ark::tooling::inspector { // NOLINTNEXTLINE(fuchsia-multiple-inheritance) class OhosWsServer final : public OhosWsServerEndpoint { public: - bool RunOne() override; + bool ParseMessage(const std::string& msg) override; // Creates socket and starts listening bool Start(uint32_t port = 0); bool Stop(); bool StartForSocketpair(int socketfd); + void InitEndPoint(std::shared_ptr endPoint); private: bool socketpairMode_ {false}; diff --git a/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.cpp b/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.cpp index 8a6ef8a8..fc58b308 100644 --- a/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.cpp +++ b/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,14 +18,16 @@ namespace ark::tooling::inspector { OhosWsServerEndpoint::OhosWsServerEndpoint() noexcept { - endpoint_.SetValidateConnectionCallback([this](auto) { - // a new connection will be accepted only after the prior is finished, - // which is ensured by websocket implementation - onValidate_(); - return true; - }); + if (endpoint_ != nullptr) { + endpoint_->SetValidateConnectionCallback([this](auto) { + // a new connection will be accepted only after the prior is finished, + // which is ensured by websocket implementation + onValidate_(); + return true; + }); - endpoint_.SetOpenConnectionCallback([this] { onOpen_(); }); - endpoint_.SetFailConnectionCallback([this] { onFail_(); }); + endpoint_->SetOpenConnectionCallback([this] { onOpen_(); }); + endpoint_->SetFailConnectionCallback([this] { onFail_(); }); + } } } // namespace ark::tooling::inspector diff --git a/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.h b/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.h index 3ab4b77e..e248ec43 100644 --- a/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.h +++ b/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,7 +19,8 @@ #include "server/websocket_server.h" #include "connection/server_endpoint_base.h" - +#include "../../common/macros.h" +#include "inspector.h" namespace ark::tooling::inspector { // Server endpoint based on OHOS websocket implementation // NOLINTNEXTLINE(fuchsia-multiple-inheritance) @@ -31,14 +32,16 @@ public: OhosWsServerEndpoint() noexcept; protected: - Endpoint endpoint_; // NOLINT(misc-non-private-member-variables-in-classes) + std::shared_ptr endpoint_; // NOLINT(misc-non-private-member-variables-in-classes) private: void SendMessage(const std::string &message) override { auto wasSent = false; - if (endpoint_.IsConnected()) { - wasSent = endpoint_.SendReply(message); + if (endpoint_ != nullptr) { + if (endpoint_->IsConnected()) { + wasSent = endpoint_->SendReply(message); + } } if (!wasSent) { LOG(INFO, DEBUGGER) << "Did not send message: " << message; diff --git a/tooling/static/debugger_arkapi.cpp b/tooling/static/debugger_arkapi.cpp deleted file mode 100644 index 89d9e89c..00000000 --- a/tooling/static/debugger_arkapi.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "debugger_arkapi.h" -#include "runtime/include/panda_vm.h" - -namespace ark { -bool ArkDebugNativeAPI::NotifyDebugMode([[maybe_unused]] int tid, [[maybe_unused]] int32_t instanceId, - [[maybe_unused]] bool debugApp) -{ - LOG(INFO, DEBUGGER) << "ArkDebugNativeAPI::NotifyDebugMode, tid = " << tid << ", debugApp = " << debugApp - << ", instanceId = " << instanceId; - if ((!debugApp) || (!Runtime::GetOptions().IsDebuggerEnable())) { - return true; - } - - auto loadRes = os::library_loader::Load(Runtime::GetOptions().GetDebuggerLibraryPath()); - if (!loadRes) { - LOG(ERROR, DEBUGGER) << "Load library fail: " << Runtime::GetOptions().GetDebuggerLibraryPath() << " " << errno; - return false; - } - os::library_loader::LibraryHandle handle = std::move(loadRes.Value()); - - Runtime::GetCurrent()->SetDebugMode(true); - - using WaitForDebugger = void (*)(); - auto symOfWaitForDebugger = os::library_loader::ResolveSymbol(handle, "WaitForDebugger"); - if (!symOfWaitForDebugger) { - LOG(ERROR, DEBUGGER) << "Resolve symbol WaitForDebugger fail: " << symOfWaitForDebugger.Error().ToString(); - return false; - } - reinterpret_cast(symOfWaitForDebugger.Value())(); - - return true; -} - -bool ArkDebugNativeAPI::StopDebugger() -{ - LOG(INFO, DEBUGGER) << "ArkDebugNativeAPI::StopDebugger"; - - ark::Runtime::GetCurrent()->SetDebugMode(false); - return true; -} - -bool ArkDebugNativeAPI::StartDebuggerForSocketPair([[maybe_unused]] int tid, [[maybe_unused]] int socketfd) -{ - LOG(INFO, DEBUGGER) << "ArkDebugNativeAPI::StartDebuggerForSocketPair, tid = " << tid; - - auto loadRes = os::library_loader::Load(Runtime::GetOptions().GetDebuggerLibraryPath()); - if (!loadRes) { - LOG(ERROR, DEBUGGER) << "Load library fail: " << Runtime::GetOptions().GetDebuggerLibraryPath() << " " << errno; - return false; - } - os::library_loader::LibraryHandle handle = std::move(loadRes.Value()); - - using StartDebuggerForSocketpair = bool (*)(int, bool); - auto sym = os::library_loader::ResolveSymbol(handle, "StartDebuggerForSocketpair"); - if (!sym) { - LOG(ERROR, DEBUGGER) << "[StartDebuggerForSocketPair] Resolve symbol fail: " << sym.Error().ToString(); - return false; - } - bool breakOnStart = Runtime::GetOptions().IsDebuggerBreakOnStart(); - bool ret = reinterpret_cast(sym.Value())(socketfd, breakOnStart); - if (!ret) { - // Reset the config - ark::Runtime::GetCurrent()->SetDebugMode(false); - } - return ret; -} -bool ArkDebugNativeAPI::IsDebugModeEnabled() -{ - LOG(INFO, DEBUGGER) << "ArkDebugNativeAPI::IsDebugModeEnabled is " << ark::Runtime::GetCurrent()->IsDebugMode(); - - return ark::Runtime::GetCurrent()->IsDebugMode(); -} -} // namespace ark diff --git a/tooling/static/init.cpp b/tooling/static/init.cpp index ae58884a..9c336696 100644 --- a/tooling/static/init.cpp +++ b/tooling/static/init.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,6 +14,7 @@ */ #include +#include #include #ifdef PANDA_TOOLING_ASIO @@ -22,80 +23,84 @@ #include "connection/ohos_ws/ohos_ws_server.h" #endif // PANDA_TOOLING_ASIO +#include "init.h" #include "inspector.h" -namespace ark::tooling { -class DebugInterface; -} // namespace ark::tooling - #ifdef PANDA_TOOLING_ASIO using InspectorWebSocketServer = ark::tooling::inspector::AsioServer; #else using InspectorWebSocketServer = ark::tooling::inspector::OhosWsServer; #endif // PANDA_TOOLING_ASIO + // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) -static ark::Runtime::DebugSessionHandle g_debugSession; +std::optional g_inspector; // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) -static InspectorWebSocketServer g_server; +static ark::Runtime::DebugSessionHandle g_debugSession; // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) -static std::optional g_inspector; +static InspectorWebSocketServer g_server; -extern "C" int StartDebugger(uint32_t port, bool breakOnStart) +int StartDebugger(uint32_t port, bool breakOnStart) { if (g_inspector) { LOG(ERROR, DEBUGGER) << "Debugger has already been started"; return 1; } - if (!g_server.Start(port)) { + LOG(ERROR, DEBUGGER) << "call g_server.Start failed"; return 1; } - g_debugSession = ark::Runtime::GetCurrent()->StartDebugSession(); g_inspector.emplace(g_server, g_debugSession->GetDebugger(), breakOnStart); - g_inspector->Run(); return 0; } -extern "C" int StopDebugger() +void InitializeInspector(std::shared_ptr endPoint, bool breakOnStart) +{ + if (g_inspector) { + g_server.Stop(); + } + g_server.InitEndPoint(endPoint); + g_debugSession = ark::Runtime::GetCurrent()->StartDebugSession(); + if (!g_inspector) { + LOG(INFO, DEBUGGER) << "InitializeInspector started"; + g_debugSession = ark::Runtime::GetCurrent()->StartDebugSession(); + g_inspector.emplace(g_server, g_debugSession->GetDebugger(), breakOnStart); + } +} + +void StopInspector() { if (!g_inspector) { LOG(ERROR, DEBUGGER) << "Debugger has not been started"; - return 1; + return; } if (!g_server.Stop()) { - return 1; + return; } g_inspector.reset(); g_debugSession.reset(); - return 0; } -extern "C" bool StartDebuggerForSocketpair(int socketfd, bool breakOnStart) +int StopDebugger() { - if (g_inspector) { - g_server.Stop(); - g_inspector->Stop(); - } - - if (!g_server.StartForSocketpair(socketfd)) { - return false; - } - if (!g_inspector) { - g_debugSession = ark::Runtime::GetCurrent()->StartDebugSession(); - g_inspector.emplace(g_server, g_debugSession->GetDebugger(), breakOnStart); + LOG(ERROR, DEBUGGER) << "Debugger has not been started"; + return 1; } - g_inspector->Run(); - return true; + if (!g_server.Stop()) { + return 1; + } + g_inspector.reset(); + g_debugSession.reset(); + return 0; } -extern "C" void WaitForDebugger() +void WaitForDebugger() { if (!g_inspector) { LOG(ERROR, DEBUGGER) << "Debugger has not been started"; @@ -104,3 +109,9 @@ extern "C" void WaitForDebugger() g_inspector->WaitForDebugger(); } + +void HandleMessage(std::string &&msg) +{ + LOG(ERROR, DEBUGGER) << "FTDEG HandleMessage start"; + g_inspector->Run(msg); +} \ No newline at end of file diff --git a/tooling/static/init.h b/tooling/static/init.h new file mode 100644 index 00000000..1ff9e153 --- /dev/null +++ b/tooling/static/init.h @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ECMASCRIPT_TOOLING_INIT_H +#define ECMASCRIPT_TOOLING_INIT_H +#include "common/macros.h" +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* End of #ifdef __cplusplus */ + +TOOLCHAIN_EXPORT int StartDebugger(uint32_t port, bool breakOnStart); +TOOLCHAIN_EXPORT void InitializeInspector(std::shared_ptr vm, bool breakOnStart); +TOOLCHAIN_EXPORT void HandleMessage(std::string &&msg); +TOOLCHAIN_EXPORT void StopInspector(); +TOOLCHAIN_EXPORT void WaitForDebugger(); +TOOLCHAIN_EXPORT int StopDebugger(); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* End of #ifdef __cplusplus */ + +#endif //ECMASCRIPT_TOOLING_INIT_H \ No newline at end of file diff --git a/tooling/static/inspector.cpp b/tooling/static/inspector.cpp index 561aa6a2..136a120b 100644 --- a/tooling/static/inspector.cpp +++ b/tooling/static/inspector.cpp @@ -23,12 +23,12 @@ #include "debugger/breakpoint.h" #include "macros.h" #include "os/mutex.h" -#include "runtime.h" +#include "include/runtime.h" #include "utils/logger.h" #include "error.h" #include "evaluation/base64.h" -#include "sampler/sampling_profiler.h" +#include "tooling/sampler/sampling_profiler.h" #include "types/remote_object.h" #include "types/scope.h" @@ -73,7 +73,6 @@ Inspector::~Inspector() // Current implementation destroys `Inspector` after server connection is closed, // hence no need to notify client inspectorServer_.Kill(); - serverThread_.join(); HandleError(debugger_.UnregisterHooks()); } @@ -87,12 +86,11 @@ void Inspector::CollectModules() }); } -void Inspector::Run() +void Inspector::Run(const std::string& msg) { CollectModules(); - serverThread_ = std::thread(&InspectorServer::Run, &inspectorServer_); - os::thread::SetThreadName(serverThread_.native_handle(), "InspectorServer"); + inspectorServer_.Run(msg); } void Inspector::Stop() @@ -269,6 +267,7 @@ void Inspector::RunIfWaitingForDebugger(PtThread thread) waitDebuggerCond_.Signal(); } +//For Hybrid it was not used, instead it use 1.0 waitForDebugger void Inspector::WaitForDebugger() { os::memory::LockHolder lock(waitDebuggerMutex_); diff --git a/tooling/static/inspector.h b/tooling/static/inspector.h index 5effd413..e81e29a6 100644 --- a/tooling/static/inspector.h +++ b/tooling/static/inspector.h @@ -71,7 +71,7 @@ public: void ThreadEnd(PtThread thread) override; void VmDeath() override; - void Run(); + void Run(const std::string& msg); void Stop(); void WaitForDebugger(); diff --git a/tooling/static/inspector_server.cpp b/tooling/static/inspector_server.cpp index b5019279..5130066c 100644 --- a/tooling/static/inspector_server.cpp +++ b/tooling/static/inspector_server.cpp @@ -50,9 +50,9 @@ void InspectorServer::Kill() server_.Kill(); } -void InspectorServer::Run() +void InspectorServer::Run(const std::string& msg) { - server_.Run(); + server_.Run(msg); } void InspectorServer::OnValidate(std::function &&handler) diff --git a/tooling/static/inspector_server.h b/tooling/static/inspector_server.h index 545a52ef..f6236e6a 100644 --- a/tooling/static/inspector_server.h +++ b/tooling/static/inspector_server.h @@ -24,7 +24,7 @@ #include #include -#include "console_call_type.h" +#include "include/console_call_type.h" #include "include/tooling/pt_thread.h" #include "common.h" @@ -59,7 +59,7 @@ public: NO_MOVE_SEMANTIC(InspectorServer); void Kill(); - void Run(); + void Run(const std::string& msg); void OnValidate(std::function &&handler); void OnOpen(std::function &&handler); diff --git a/tooling/static/types/evaluation_result.h b/tooling/static/types/evaluation_result.h index 08f79ad5..0f40ea45 100644 --- a/tooling/static/types/evaluation_result.h +++ b/tooling/static/types/evaluation_result.h @@ -16,7 +16,7 @@ #ifndef PANDA_TOOLING_INSPECTOR_TYPES_EVALUATION_RESULT_H #define PANDA_TOOLING_INSPECTOR_TYPES_EVALUATION_RESULT_H -#include "tooling/inspector/json_serialization/serializable.h" +#include "json_serialization/serializable.h" #include "macros.h" #include "utils/json_builder.h" diff --git a/tooling/static/types/exception_details.h b/tooling/static/types/exception_details.h index 935890b1..24edac01 100644 --- a/tooling/static/types/exception_details.h +++ b/tooling/static/types/exception_details.h @@ -15,7 +15,7 @@ #ifndef PANDA_TOOLING_INSPECTOR_EXCEPTION_DETAILS_H #define PANDA_TOOLING_INSPECTOR_EXCEPTION_DETAILS_H -#include "tooling/inspector/json_serialization/serializable.h" +#include "json_serialization/serializable.h" #include #include diff --git a/tooling/static/types/location.h b/tooling/static/types/location.h index ff73eeac..44083977 100644 --- a/tooling/static/types/location.h +++ b/tooling/static/types/location.h @@ -16,7 +16,7 @@ #ifndef PANDA_TOOLING_INSPECTOR_TYPES_LOCATION_H #define PANDA_TOOLING_INSPECTOR_TYPES_LOCATION_H -#include "tooling/inspector/json_serialization/serializable.h" +#include "json_serialization/serializable.h" #include #include diff --git a/tooling/static/types/object_preview.cpp b/tooling/static/types/object_preview.cpp index 2bcdda94..8561d65d 100644 --- a/tooling/static/types/object_preview.cpp +++ b/tooling/static/types/object_preview.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,8 +13,8 @@ * limitations under the License. */ -#include "tooling/inspector/types/object_preview.h" -#include "tooling/inspector/types/property_descriptor.h" +#include "types/object_preview.h" +#include "types/property_descriptor.h" #include "utils/string_helpers.h" diff --git a/tooling/static/types/possible_breakpoints_response.h b/tooling/static/types/possible_breakpoints_response.h index 0a657ecc..582716f4 100644 --- a/tooling/static/types/possible_breakpoints_response.h +++ b/tooling/static/types/possible_breakpoints_response.h @@ -16,7 +16,7 @@ #ifndef PANDA_TOOLING_INSPECTOR_TYPES_POSSIBLE_BREAKPOINTS_RESPONSE_H #define PANDA_TOOLING_INSPECTOR_TYPES_POSSIBLE_BREAKPOINTS_RESPONSE_H -#include "tooling/inspector/json_serialization/serializable.h" +#include "json_serialization/serializable.h" #include "utils/json_builder.h" diff --git a/tooling/static/types/property_descriptor.h b/tooling/static/types/property_descriptor.h index 325e2100..2be39438 100644 --- a/tooling/static/types/property_descriptor.h +++ b/tooling/static/types/property_descriptor.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,8 +18,8 @@ #include "macros.h" -#include "tooling/inspector/types/remote_object.h" -#include "tooling/inspector/json_serialization/serializable.h" +#include "types/remote_object.h" +#include "json_serialization/serializable.h" #include "remote_object.h" diff --git a/tooling/static/types/property_preview.h b/tooling/static/types/property_preview.h index 29a6b651..2d32aae5 100644 --- a/tooling/static/types/property_preview.h +++ b/tooling/static/types/property_preview.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,8 +16,8 @@ #ifndef PANDA_TOOLING_INSPECTOR_TYPES_PROPERTY_PREVIEW_H #define PANDA_TOOLING_INSPECTOR_TYPES_PROPERTY_PREVIEW_H -#include "tooling/inspector/types/remote_object_type.h" -#include "tooling/inspector/json_serialization/serializable.h" +#include "types/remote_object_type.h" +#include "json_serialization/serializable.h" #include #include diff --git a/tooling/static/types/remote_object_type.h b/tooling/static/types/remote_object_type.h index 84be7c87..9cc97904 100644 --- a/tooling/static/types/remote_object_type.h +++ b/tooling/static/types/remote_object_type.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,8 +17,8 @@ #define PANDA_TOOLING_INSPECTOR_TYPES_REMOTE_OBJECT_TYPE_H #include "utils/json_builder.h" -#include "tooling/inspector/types/numeric_id.h" -#include "tooling/inspector/json_serialization/serializable.h" +#include "types/numeric_id.h" +#include "json_serialization/serializable.h" #include #include diff --git a/tooling/static/types/script_source_response.h b/tooling/static/types/script_source_response.h index 27f50086..32c4486e 100644 --- a/tooling/static/types/script_source_response.h +++ b/tooling/static/types/script_source_response.h @@ -16,7 +16,7 @@ #ifndef PANDA_TOOLING_INSPECTOR_TYPES_SCRIPT_SOURCE_RESPONSE_H #define PANDA_TOOLING_INSPECTOR_TYPES_SCRIPT_SOURCE_RESPONSE_H -#include "tooling/inspector/json_serialization/serializable.h" +#include "json_serialization/serializable.h" #include "macros.h" #include "utils/json_builder.h" diff --git a/tooling/static/types/url_breakpoint_response.h b/tooling/static/types/url_breakpoint_response.h index 8b2358e8..9985a820 100644 --- a/tooling/static/types/url_breakpoint_response.h +++ b/tooling/static/types/url_breakpoint_response.h @@ -16,7 +16,7 @@ #ifndef PANDA_TOOLING_INSPECTOR_TYPES_URL_BREAKPOINT_RESPONSE_H #define PANDA_TOOLING_INSPECTOR_TYPES_URL_BREAKPOINT_RESPONSE_H -#include "tooling/inspector/json_serialization/serializable.h" +#include "json_serialization/serializable.h" #include diff --git a/websocket/websocket_base.cpp b/websocket/websocket_base.cpp index 0e607f20..9025005e 100644 --- a/websocket/websocket_base.cpp +++ b/websocket/websocket_base.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -23,6 +23,7 @@ #include namespace OHOS::ArkCompiler::Toolchain { +std::mutex g_sendReplymutex; static std::string ToString(CloseStatusCode status) { if (status == CloseStatusCode::NO_STATUS_CODE) { @@ -48,6 +49,7 @@ WebSocketBase::~WebSocketBase() noexcept // we just add the 'isLast' parameter to indicate whether it is the last frame. bool WebSocketBase::SendReply(const std::string& message, FrameType frameType, bool isLast) const { + std::lock_guard lock(g_sendReplymutex); if (connectionState_.load() != ConnectionState::OPEN) { LOGE("SendReply failed, websocket not connected"); return false; -- Gitee From cfa76d29e0ca93be09b99b9439dc4bb0474b66a5 Mon Sep 17 00:00:00 2001 From: kanghonglin Date: Mon, 7 Jul 2025 17:14:11 +0800 Subject: [PATCH 5/8] Description: fix 1.2 debugger problem Issue:https://gitee.com/openharmony/arkcompiler_runtime_core/issues/ICKIRZ Change-Id: I81ed7332f3ac11aefc249e46a2008aebf0ace16c Signed-off-by: kanghonglin --- tooling/static/debugger/debug_info_cache.cpp | 17 ++++++++++++++--- tooling/static/debugger/debug_info_cache.h | 4 +++- tooling/static/inspector.cpp | 8 ++++++-- tooling/static/tests/debug_info_cache.cpp | 2 +- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/tooling/static/debugger/debug_info_cache.cpp b/tooling/static/debugger/debug_info_cache.cpp index af65685f..68add1ee 100644 --- a/tooling/static/debugger/debug_info_cache.cpp +++ b/tooling/static/debugger/debug_info_cache.cpp @@ -22,10 +22,10 @@ #include "os/mutex.h" namespace ark::tooling::inspector { -void DebugInfoCache::AddPandaFile(const panda_file::File &file) +void DebugInfoCache::AddPandaFile(const panda_file::File &file, bool isUserPandafile) { os::memory::LockHolder lock(debugInfosMutex_); - const auto &debugInfo = + auto &debugInfo = debugInfos_ .emplace(std::piecewise_construct, std::forward_as_tuple(&file), std::forward_as_tuple(file, @@ -36,6 +36,7 @@ void DebugInfoCache::AddPandaFile(const panda_file::File &file) std::forward_as_tuple(file, methodId)); })) .first->second; + debugInfo.SetUserFile(isUserPandafile); // For all methods add non-empty source code read from debug-info for (auto methodId : debugInfo.GetMethodIdList()) { @@ -57,7 +58,7 @@ void DebugInfoCache::GetSourceLocation(const PtFrame &frame, std::string_view &s auto method = frame.GetMethod(); auto pandaFile = method->GetPandaFile(); auto debugInfo = GetDebugInfo(pandaFile); - if (debugInfo == nullptr) { + if (debugInfo == nullptr || !debugInfo->IsUserFile()) { lineNumber = 1; return; } @@ -419,4 +420,14 @@ const char *DebugInfoCache::GetSourceFile(Method *method) return debugInfo->GetSourceFile(method->GetFileId()); } +const char *DebugInfoCache::GetUserSourceFile(Method *method) +{ + auto pandaFile = method->GetPandaFile(); + auto debugInfo = GetDebugInfo(pandaFile); + if ((debugInfo == nullptr) || !debugInfo->IsUserFile()) { + return nullptr; + } + return debugInfo->GetSourceFile(method->GetFileId()); +} + } // namespace ark::tooling::inspector diff --git a/tooling/static/debugger/debug_info_cache.h b/tooling/static/debugger/debug_info_cache.h index 27b8dce3..f0180428 100644 --- a/tooling/static/debugger/debug_info_cache.h +++ b/tooling/static/debugger/debug_info_cache.h @@ -35,7 +35,7 @@ public: NO_COPY_SEMANTIC(DebugInfoCache); NO_MOVE_SEMANTIC(DebugInfoCache); - void AddPandaFile(const panda_file::File &file); + void AddPandaFile(const panda_file::File &file, bool isUserPandafile = false); void GetSourceLocation(const PtFrame &frame, std::string_view &sourceFile, std::string_view &methodName, size_t &lineNumber); std::unordered_set GetCurrentLineLocations(const PtFrame &frame); @@ -54,6 +54,8 @@ public: const char *GetSourceFile(Method *method); + const char *GetUserSourceFile(Method *method); + const panda_file::DebugInfoExtractor *GetDebugInfo(const panda_file::File *file) const; private: diff --git a/tooling/static/inspector.cpp b/tooling/static/inspector.cpp index 136a120b..cc55c7c0 100644 --- a/tooling/static/inspector.cpp +++ b/tooling/static/inspector.cpp @@ -134,6 +134,10 @@ void Inspector::MethodEntry(PtThread thread, Method * /* method */) auto *debuggableThread = GetDebuggableThread(thread); ASSERT(debuggableThread != nullptr); + auto stack = StackWalker::Create(thread.GetManagedThread()); + if (stack.IsCFrame()) { + return; + } if (debuggableThread->OnMethodEntry()) { HandleError(debugger_.NotifyFramePop(thread, 0)); } @@ -160,7 +164,7 @@ void Inspector::LoadModule(std::string_view fileName) Runtime::GetCurrent()->GetClassLinker()->EnumeratePandaFiles( [this, fileName](auto &file) { if (file.GetFilename() == fileName) { - debugInfoCache_.AddPandaFile(file); + debugInfoCache_.AddPandaFile(file, true); const auto *extractor = debugInfoCache_.GetDebugInfo(&file); SourceNameInsert(extractor); ResolveBreakpoints(file, extractor); @@ -180,7 +184,7 @@ void Inspector::SingleStep(PtThread thread, Method *method, const PtLocation &lo { os::memory::ReadLockHolder lock(debuggerEventsLock_); - auto sourceFile = debugInfoCache_.GetSourceFile(method); + auto sourceFile = debugInfoCache_.GetUserSourceFile(method); // NOTE(fangting, #IC98Z2): etsstdlib.ets should not call loadModule in pytest. if ((sourceFile == nullptr) || (strcmp(sourceFile, "etsstdlib.ets") == 0)) { return; diff --git a/tooling/static/tests/debug_info_cache.cpp b/tooling/static/tests/debug_info_cache.cpp index ca96a741..57906985 100644 --- a/tooling/static/tests/debug_info_cache.cpp +++ b/tooling/static/tests/debug_info_cache.cpp @@ -53,7 +53,7 @@ protected: auto pf = panda_file::OpenPandaFile(ASM_FILE_NAME); ASSERT_NE(pf, nullptr); - cache.AddPandaFile(*pf); + cache.AddPandaFile(*pf, true); RuntimeOptions options; options.SetShouldInitializeIntrinsics(false); -- Gitee From b73f60058ef96074597c7773fd6ec869159afccb Mon Sep 17 00:00:00 2001 From: Panferov Ivan Date: Fri, 11 Jul 2025 16:13:41 +0800 Subject: [PATCH 6/8] Fix linkage with libarktsbase Issue: #ICLPY3 Signed-off-by: Panferov Ivan Change-Id: I7e781dd748c08b51eacbbcef10c913b1ac88fefe --- tooling/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tooling/BUILD.gn b/tooling/BUILD.gn index a7b847fc..503db01b 100644 --- a/tooling/BUILD.gn +++ b/tooling/BUILD.gn @@ -39,7 +39,7 @@ ohos_shared_library("libarkinspector_plus") { install_enable = true external_deps = [ "runtime_core:arktsdisassembler", - "runtime_core:libarktsbase_package", + "runtime_core:libarktsbase", "runtime_core:libarkruntime", ] -- Gitee From 52c2b6fa607caaf18fc3d490febe53cec972607c Mon Sep 17 00:00:00 2001 From: yanzhiqi1 Date: Mon, 28 Jul 2025 16:53:54 +0800 Subject: [PATCH 7/8] change int32 to uint32 Issue: #ICPB9Z Signed-off-by: yanzhiqi1 Change-Id: Ifd03cd2c683c18804427d9b3000d68818d99760b --- tooling/static/inspector.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tooling/static/inspector.cpp b/tooling/static/inspector.cpp index cc55c7c0..1fc2044f 100644 --- a/tooling/static/inspector.cpp +++ b/tooling/static/inspector.cpp @@ -715,10 +715,10 @@ void Inspector::ReplyNativeCalling(PtThread thread) void Inspector::ProfilerSetSamplingInterval(int32_t interval) { os::memory::ReadLockHolder lock(vmDeathLock_); - if (UNLIKELY(CheckVmDead())) { + if (UNLIKELY(CheckVmDead() || interval < 0)) { return; } - samplingInterval_ = interval; + samplingInterval_ = static_cast(interval); } Expected Inspector::ProfilerStart() -- Gitee From 03e02872d483ff3f467a7d094cd5239b9f08e67f Mon Sep 17 00:00:00 2001 From: jiachongchong Date: Thu, 31 Jul 2025 20:51:58 +0800 Subject: [PATCH 8/8] fix breakpoint debug problem Issue: https://gitee.com/openharmony/arkcompiler_toolchain/issues/ICQ7FQ Signed-off-by: jiachongchong Change-Id: I1028288717d67405c24b4fdda94d7ff33d132bd8 --- tooling/static/connection/endpoint_base.cpp | 2 +- tooling/static/connection/endpoint_base.h | 2 +- tooling/static/inspector.cpp | 15 ++++----------- tooling/static/inspector_server.cpp | 12 ++++++++++-- tooling/static/source_manager.cpp | 5 +++-- tooling/static/source_manager.h | 3 ++- tooling/static/tests/source_manager.cpp | 20 +++++++++----------- 7 files changed, 30 insertions(+), 29 deletions(-) diff --git a/tooling/static/connection/endpoint_base.cpp b/tooling/static/connection/endpoint_base.cpp index 5f06a37a..1454419f 100644 --- a/tooling/static/connection/endpoint_base.cpp +++ b/tooling/static/connection/endpoint_base.cpp @@ -36,7 +36,7 @@ void EndpointBase::HandleMessage(const std::string &message) return; } - LOG(DEBUG, DEBUGGER) << "Received " << message; + LOG(INFO, DEBUGGER) << "Received " << message; auto sessionId = request.GetValue("sessionId"); auto id = request.GetValue("id"); diff --git a/tooling/static/connection/endpoint_base.h b/tooling/static/connection/endpoint_base.h index 629bd741..ffe1ddda 100644 --- a/tooling/static/connection/endpoint_base.h +++ b/tooling/static/connection/endpoint_base.h @@ -103,7 +103,7 @@ private: JsonObjectBuilder builder; build(builder); auto message = std::move(builder).Build(); - LOG(DEBUG, DEBUGGER) << "Sending " << message; + LOG(INFO, DEBUGGER) << "Sending " << message; SendMessage(message); } diff --git a/tooling/static/inspector.cpp b/tooling/static/inspector.cpp index 1fc2044f..641f5fd8 100644 --- a/tooling/static/inspector.cpp +++ b/tooling/static/inspector.cpp @@ -88,8 +88,6 @@ void Inspector::CollectModules() void Inspector::Run(const std::string& msg) { - CollectModules(); - inspectorServer_.Run(msg); } @@ -138,6 +136,9 @@ void Inspector::MethodEntry(PtThread thread, Method * /* method */) if (stack.IsCFrame()) { return; } + if (debuggableThread == nullptr) { + return; + } if (debuggableThread->OnMethodEntry()) { HandleError(debugger_.NotifyFramePop(thread, 0)); } @@ -152,7 +153,7 @@ void Inspector::SourceNameInsert(const panda_file::DebugInfoExtractor *extractor } for (const auto &sourceName : sourceNames) { // Get src file name - auto scriptId = inspectorServer_.GetSourceManager().GetScriptId(sourceName); + auto [scriptId, isNew] = inspectorServer_.GetSourceManager().GetScriptId(sourceName); inspectorServer_.CallDebuggerScriptParsed(scriptId, sourceName); } } @@ -165,9 +166,6 @@ void Inspector::LoadModule(std::string_view fileName) [this, fileName](auto &file) { if (file.GetFilename() == fileName) { debugInfoCache_.AddPandaFile(file, true); - const auto *extractor = debugInfoCache_.GetDebugInfo(&file); - SourceNameInsert(extractor); - ResolveBreakpoints(file, extractor); } return true; @@ -767,11 +765,6 @@ void Inspector::DebuggerEnable() dbgThread.Reset(); } breakpointStorage_.Reset(); - Runtime::GetCurrent()->GetClassLinker()->EnumeratePandaFiles([this](auto &file) { - const auto *extractor = debugInfoCache_.GetDebugInfo(&file); - SourceNameInsert(extractor); - return true; - }); } void Inspector::RegisterMethodHandlers() diff --git a/tooling/static/inspector_server.cpp b/tooling/static/inspector_server.cpp index 5130066c..8639e37c 100644 --- a/tooling/static/inspector_server.cpp +++ b/tooling/static/inspector_server.cpp @@ -1025,7 +1025,11 @@ void InspectorServer::AddCallFrameInfo(JsonArrayBuilder &callFrames, const CallF const std::optional &objThis) { callFrames.Add([&](JsonObjectBuilder &callFrame) { - auto scriptId = sourceManager_.GetScriptId(callFrameInfo.sourceFile); + auto [scriptId, isNew] = sourceManager_.GetScriptId(callFrameInfo.sourceFile); + + if (isNew) { + CallDebuggerScriptParsed(scriptId, callFrameInfo.sourceFile); + } callFrame.AddProperty("callFrameId", std::to_string(callFrameInfo.frameId)); callFrame.AddProperty("functionName", callFrameInfo.methodName.data()); @@ -1047,7 +1051,11 @@ void InspectorServer::AddLocations(UrlBreakpointResponse &response, const std::s size_t lineNumber, [[maybe_unused]] PtThread thread) { for (auto sourceFile : sourceFiles) { - auto scriptId = sourceManager_.GetScriptId(sourceFile); + auto [scriptId, isNew] = sourceManager_.GetScriptId(sourceFile); + + if (isNew) { + CallDebuggerScriptParsed(scriptId, sourceFile); + } response.AddLocation(Location {scriptId, lineNumber}); } } diff --git a/tooling/static/source_manager.cpp b/tooling/static/source_manager.cpp index 2e01a477..670197d5 100644 --- a/tooling/static/source_manager.cpp +++ b/tooling/static/source_manager.cpp @@ -21,19 +21,20 @@ #include "types/numeric_id.h" namespace ark::tooling::inspector { -ScriptId SourceManager::GetScriptId(std::string_view fileName) +std::pair SourceManager::GetScriptId(std::string_view fileName) { os::memory::LockHolder lock(mutex_); auto p = fileNameToId_.emplace(std::string(fileName), fileNameToId_.size()); ScriptId id(p.first->second); + bool isNewForThread = knownSources_.insert(id).second; if (p.second) { std::string_view name {p.first->first}; idToFileName_.emplace(id, name); } - return id; + return {id, isNewForThread}; } std::string_view SourceManager::GetSourceFileName(ScriptId id) const diff --git a/tooling/static/source_manager.h b/tooling/static/source_manager.h index 8b77611e..dd7a348a 100644 --- a/tooling/static/source_manager.h +++ b/tooling/static/source_manager.h @@ -37,13 +37,14 @@ public: NO_COPY_SEMANTIC(SourceManager); NO_MOVE_SEMANTIC(SourceManager); - ScriptId GetScriptId(std::string_view fileName); + std::pair GetScriptId(std::string_view fileName); [[nodiscard]] std::string_view GetSourceFileName(ScriptId id) const; private: mutable os::memory::Mutex mutex_; std::unordered_map fileNameToId_ GUARDED_BY(mutex_); std::unordered_map idToFileName_ GUARDED_BY(mutex_); + std::unordered_set knownSources_ GUARDED_BY(mutex_); }; } // namespace ark::tooling::inspector diff --git a/tooling/static/tests/source_manager.cpp b/tooling/static/tests/source_manager.cpp index 0230cfa5..47aae4b5 100644 --- a/tooling/static/tests/source_manager.cpp +++ b/tooling/static/tests/source_manager.cpp @@ -63,29 +63,27 @@ TEST_F(SourceManagerTest, General) } auto test_id0 = sm_.GetScriptId("test.pa"); - ASSERT_EQ(test_id0, ScriptId(0)); + ASSERT_EQ(test_id0.first, ScriptId(0)); + ASSERT_EQ(test_id0.second, true); - ASSERT_EQ(sm_.GetSourceFileName(test_id0), "test.pa"); + ASSERT_EQ(sm_.GetSourceFileName(test_id0.first), "test.pa"); ASSERT_EQ(sm_.GetSourceFileName(ScriptId(1)), ""); test_id0 = sm_.GetScriptId("test.pa"); - ASSERT_EQ(test_id0, ScriptId(0)); + ASSERT_EQ(test_id0.first, ScriptId(0)); + ASSERT_EQ(test_id0.second, false); auto test_id1 = sm_.GetScriptId("test1.pa"); - ASSERT_EQ(test_id1, ScriptId(1)); + ASSERT_EQ(test_id1.first, ScriptId(1)); + ASSERT_EQ(test_id1.second, true); auto test_id2 = sm_.GetScriptId("test2.pa"); auto test_id3 = sm_.GetScriptId("test3.pa"); - ASSERT_EQ(sm_.GetSourceFileName(test_id2), "test2.pa"); - ASSERT_EQ(sm_.GetSourceFileName(test_id3), "test3.pa"); + ASSERT_EQ(sm_.GetSourceFileName(test_id2.first), "test2.pa"); + ASSERT_EQ(sm_.GetSourceFileName(test_id3.first), "test3.pa"); ASSERT_EQ(sm_.GetSourceFileName(ScriptId(5U)), ""); - ASSERT_EQ(sm_.GetSourceFileName(test_id2), "test2.pa"); - - test_id0 = sm_.GetScriptId("test.pa"); - ASSERT_EQ(test_id0, ScriptId(0)); - sync_flag1 = false; mthread1.join(); -- Gitee