diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000000000000000000000000000000000000..cea4d3f4e0eea515bf71ca8cef4037d5fd8282ba --- /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 0000000000000000000000000000000000000000..308b9088bc5d28f603a1e7b604c8791c6fc8c75c --- /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 0000000000000000000000000000000000000000..bb879da5a0774e5e3a4e5e90dba7a0770370c0f7 --- /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 120bf836356f9d178a1b0aa963ada608bfbe1d5f..1c732cc6f44713262c3e955ecfd5af4726e5dadf 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,10 @@ 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:libarkinspector_plus", + "./tooling/dynamic/client:libark_client", + "./tooling/dynamic/client/ark_cli:arkdb", + "./tooling/dynamic/client/ark_multi:ark_multi", ] } @@ -264,7 +265,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 +280,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/inspector/BUILD.gn b/inspector/BUILD.gn index 607bd80a4bbab55649a3bab7053410ad5b742ba4..220a77dd6f01538c473710481e8185cf6faff980 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", ] @@ -99,7 +100,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 a51f4973e234a487ac781fa17218efe6fddb4254..1d975852ca13f71bf78cc6c86c9b4364af9ec607 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/init_static.cpp b/inspector/init_static.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a57b535109c3734e6d5ee3ea16ced205e6a7c0c6 --- /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/inspector/init_static.h b/inspector/init_static.h new file mode 100644 index 0000000000000000000000000000000000000000..0d8e6ee5d3e1668d6e5765ed2bd7825b4067ca50 --- /dev/null +++ b/inspector/init_static.h @@ -0,0 +1,39 @@ +/** + * 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_STATIC_H +#define ECMASCRIPT_TOOLING_INIT_STATIC_H + +#include +#include +#include "common/log_wrapper.h" + +namespace OHOS::ArkCompiler::Toolchain { +bool InitializeArkFunctionsForStatic(); + +void HandleMessage(std::string &&message); + +int StopDebuggerForStatic(); + +bool StartDebuggerForStatic(std::shared_ptr endpoint, bool breakOnStart); + +void WaitForDebuggerForStatic(); + +int StartDebuggerInitForStatic(uint32_t port, bool breakOnStart); + +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 755ac39200168f27e23d189f921dd5a03230c79e..0ef5bba2eade8136b374237f714599cd4f6761a8 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) @@ -28,7 +29,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) @@ -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 9dc21e8cd7ad5d949ee64a8761cc93c2b8d0ede3..430dda768769095e5a7e48c2a89b1a15b10bd46c 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 744bdb5eda45322857d581b80e8fd97cfd245627..ffb7b9885581e74018a4181e7e1a5fd4f73e1e25 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 47df2dc6740d808990f008d23c9734fe5d1554e9..f0f18d24e82e468634d11ff5ee95f893bbbfdd17 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/test/fuzztest/agent/heapprofiler/heapprofileraddinspectedheapobject_fuzzer/BUILD.gn b/test/fuzztest/agent/heapprofiler/heapprofileraddinspectedheapobject_fuzzer/BUILD.gn index 3e4c043a252c0d3bcc618b2aeacea24e18435f7c..18f245535b4e5e91faec33492f748581cf6cf6a4 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 30d5a75defa2a5b865baa7f6a145357ce49527ab..99a516987b2fdaf95225020dd42990a1c02c438f 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 5315851e5e07e405d27f691d3f811a8d40500719..eabb5dd84834270be0f1f289e1f4584081fb9e6d 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 32dfc129ebc68a2b8376ebeea2c04e85b1325984..ed9666746eddcc2e503c89ad6ca58d8a1fee68e0 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 0710ee66c4f79ed5ba8e8a4611d1848989ef4697..94bc5821055018e217eb505c40a967e26b56f424 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 da6fbf1a260e6514765317ccec8183db7702d87e..0d80bd9eba7f28daa6336da73ef48843598426a2 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 856a33e4ea58e7e8fd56255888782d27ba2fd19d..b940731615d7b735b7f504da757a4407d6b92096 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 b59b335abb63d810d5cf888e19db11cefb2ae784..5c7c86916988ccf1d490a644da74a5ff13de8be3 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 6691e97114281466b0c5aeb73a9ae9ea1cd67b16..91ca56e774c61d6911c1a0804dd17d1ed3222816 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 09d67d66109b2df9256ac39dc4cf6d5388b59994..5b30b35e651442eef20f08af43e1488856067303 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 5e75338463b73dd0479e01e3229050d8942a4d12..bc3505d667afa142dad359879f13ce41fafad8a6 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 32886181288ff3c7022f2d1b461c23f3891a7096..84288d2b3e60b5a755c1110dc5d5beadbe2d03f7 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 9c3c062d87c7cb06a88808d177b98718527a99d0..4ae7f623d96020d4ce154632c73c64fed303a818 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 b4bc0a18a5562f0ea07548d6176f3748c2c8beea..4669120947239874d98a3c15aa5449c7ae5823df 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 d57422f39b7ebc7e5bcf14edf062533a6b5fc403..6910147fd17af31fda86f6a7dd7b409b6345aac4 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 6e08b171a46f6902d44c5c97e0c92d0b7dad7d61..520473adb171be85b6c8cb9525b0b8cefab4b984 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 ba8d4a35b3a42ddfb7b8c6c98a570ae9d1197b0b..eb9f30709104750740a3d4b637b2633f0ba388bd 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 2a8155f41c00f14eee36ce71f38fe752d00329f1..62be4592fe610b37f03f15fca36f9c37c2b6c73f 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 2d460555e5945840b0e134ce285ae841af9f7a39..ebe99a24bd96635992b2c5b17197fa50311f7bde 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 266919c1382627cd3370566dda465fb9f6eedfa1..7a78f7d00b229d0d14c2584fdc70935b8ef3c0ef 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 581da693bfb04ddb69eaa51ecca1d97e358cae1a..9b45b066b372ae63ec85f243a771a04d3e0d5327 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 f7fc9ff56a072f3e5001258439ed2e0cf12c824a..9800789ddec97fcc95b69dbc7eb98399fd7bcfe1 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 870dbc8dc93ef7e1341f184a8096e46038a07cb2..c185b9a8521bcef13c99a3462b1ed2d1119593e1 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 5d73c2c2bd5b0537b3cb52647cb2cb127280703d..5b05770c3cce02411988f034f580b1a9c20b0aaf 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 ab388efe66e0800d2b988d8b9f5082bafa6608f9..6759fb72f47aa197c175bf303d8e30c7e51dac6d 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 d2013f5c86f494307463b46f3562dad20d9348bd..e7c51991d44865bf8775f5b0b961be4d8e3a5069 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 09f9ffe7b2a0b8e20b5089e814fd36fd92910fa9..2f9570ec1486d90d5927aa7f07f284b9defaaa23 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 9a29531c020ef6aa16d2b4762a09b3254c4f33f6..35d598f90870e77edcf0e719df005456bd1ea84a 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 b8035b366be46228742d1d7927d792ad39ca655c..92b40fa86b8c6e5dafba4c5370cbe6359fbc56e8 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 21c878b3f8af4e45f8bf3cc252149b5717c96f27..4eb5f7310d88ac321aab2449a8bb307ad8a495bd 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 0fdb8000d2b169474133389c643e865326404553..04e6206aa35376d265e48ca0c4e6833bb070af68 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 f9fe087d8949b734eda7966d82acbcd0c9838817..1a692b1c774b4070ebdcd3a7c01ab65c1455092c 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 8717b2552700c2bf4e7f06051ed47c3eea1626a2..f7531a8e7162e8fc5b0c3f397971c56f4d99ed0c 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 3732cc86fd5f033f4f9044981e9955bddb2ad7ce..9c52e4788c7df7ea32271d454d23e69766c7316a 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 29ff1ad2ecc110428ac8fadd2b4ce6f63e7ed12e..202e7e76a417eae6db6842976e169b2f61839f18 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 b25dbc074ad7b503af2ef58e4757b9dc6aea9c63..db8dcefa77967da2ed80afe005f37ee22247f624 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 7a23a8eafa60857a04fc69fbdf0e5b4bcc22f2e3..a2bddf05e9cf8f2001981c4d0f104cab5bd4d0d9 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 33d4453597175c84305d98a0e164bf68031a976a..d55b01c8d24c2a0edf7bda911580d85ea5815f80 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 8e151f123d07b263f13105f1f7e906c94d5d3e6e..3d176fd6f11b66cb067381bb7df28423117ada5a 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 91245d8145a9af0fed7d87e348b5c43fc0109d46..ffebe0a0c027920949d09973cb6264018ed871c7 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 cf0e0dc5e4059c486db427ca121cb258c8b30bd0..2ffcb78633416b2444cd420ef8b9d725dcfc3ba5 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 b10ce3ee966e2412f14d42cccde7f90f9f61c8d4..bb40b9ab3e52ea9e6cf2eac3e8bd37fe8903e55a 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 5b79766893c3b5bfaec699de67f65bbc791e1d3f..e928fc345b44b676549211a8ba88e9377e99f3e9 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 8e0defb9214139dcda435908f9d1c51c82bea24e..89a39193b7a2fc50266ce49337eb76d0b5e78c48 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 1bbe450d3abe8e552a7ba90b65be2e6d88c732b5..5eb489bdef38182045db8b45370918e1e63fb6c6 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 3499d097638c88b1150497222658ef63a40b7cc3..e058a3f7acff26777ce9752b82db0a13aecb64c9 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 75dfe5855f21f3c19d2b0b76f677712ab560aed3..c387adfd4d80da1f3d36e9a5d82047c0fa742c59 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 98a80d50a27d54cf98838ca2a9b58026576c2921..65729541314dda8ff9cba0bca37ac88a0a0cc5ab 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 edaba65631cb89afbd9b44e3e8bbc8fe233a5040..b0218c8e5fd80166af008a9d6fe68f4b24c93493 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 f594360974d85306a295a7821e6907cb88050fe2..8664cafc5b2f1e5076b7ea15414d01d1c5d2b431 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 6b3a6ba0401b50765193f2ae91b6cb21d4b02d2b..b94a67930e679ef9aa5585bfc93752e4440e9f3a 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 3cff0a9faf57342385ddabed104b3344687004ea..3cef28890534c0b8952eebbbd7114c7682fe79aa 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 8a8107c1b1f99ae518cb5a1d2507231dfb07b098..3081646a372fdadc91bd67e7e40066f3ff6ab516 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 b596dfa8a22c059cb37d616ffa5f080a65dfd8df..ec235aedbb33b58c7e13685902b2ef78ff97e4e5 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 56c131953966014cd0bf5392f0f175155eedc97b..aa6d9f59a96c28eef0d8655f37397e4eb0c32b77 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 865283e5738b1a91d60a7d8824b3a30a053e9902..6237fbfcacaa22551fec1211f5be3d8d123e1ecb 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 348d980ed6b7c368304f987ecdced1244923b139..f133a42c13c87aa4ed2be4e9f98296f13064eebc 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 0e254368c9048562a751a017d74fdc906aab32dd..6d635812bc305dafcb3cd752bfa8aadecdaf8c2b 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 fbcb9d4e1a2e6280df843ccd7a727c3a348b82a6..581540264dd4061f53d3c38931b5680696789cd8 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 110369715f4960f23673e7e0d67cd3ec44709c31..ecdd72cb8922314c2367304098a25c1e7a64f89c 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 e89e08317fe304825dd3f1b4de6b5b059d941347..f92713a42ddd72859fa6cc68f5beac848d4c338a 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 677da0ffb7a6452b688a327c84130a6b71e3ab13..8718d7bda74091f33df5ea42dd450c428e52db58 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 31b8b07d935986f869537a96dc239b65e2a88514..1d8df7a06f9b26f0212d6a8372bc03b28c8964b1 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 501c6c772bae26b12ee116f7f6cbefcbfdf754d7..7f59ca0365deca8d07206fc2af7155750a300be7 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 32d302960458a90f02cea047bd8f9dd79a8e3567..a89aa6937621b05891379ebf14d6e24eafb722df 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 32e73477fe55a5d059c10e0a05c6640fbd632c56..b3c209adc429deb66babaeec8718b21227011714 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 f356251317383e13234015925e653643bad4b513..10602bd527ab4c0414629154c95c280db46d1df1 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 d6ac8eb3c096521ecc94b7328e753e50d8bb0dc0..463f315c55b37cef37bac410de2c7743b56c0035 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 1cbd95057f3d68054932b44f73609162e80e5a44..7e633ca640e2d256c32b09ec21583c4d8927a984 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 540dec7e7c86f2d827971bef97b008f54ddc9984..5aa349f8b1dfb8f6d01726eebd5467856adfd24c 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 a9cd5bd147ca2216b63c98e10edc440c67141711..c3e7bdd047e65097776988d84b57fbeede427223 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 f83b6e4942afa771ca2d8d1cf18f5c59dc644ff3..bfdb69696721bd7a2d571bd73e84e3f0ab6dbe6e 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 6ae3ab80044e788fb2ff1f8eef49c3dcab00382a..d0fbca687273e89841cfc4c3fdf439243569c09d 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 45f1466ff33b283e1a2b0a1a25aa1ee9e1b85e51..f8cd89634765313b946471a2ac711ccd0e184829 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 63d33cc7863d351520bb39eefb47bd27ed8dbfeb..3ba7cd1607b8a281629297d275de42975472788a 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 f206905690ecba2359e2045a5ffc7e9ac7a345ea..09787232961883ff5ab09ee23129891adcfa0a73 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 d7c5dc6987de8ed0f651e606d7274df6e33c2a3d..cc8a2ce0ecf715aff6cefbe0b34e69d1c0a22e8b 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 8672956dff8bb3d60ea2fc961433d65998120f78..6f5030879026cc4289c088fecc7b97fda4a140b3 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 5aab538534b3a76113b58f8127ce834787fa1b36..850aa608929050247efeecc0b4b22d3d0b4081e6 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 37305f26668a5cfbc4093f1ee0fa94aba11e7827..2ecc6c964ce809eb3a8c2d073621baf8eba280cc 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 82bab1cd11622fba7652b14086c41762bd55abee..e0c64a0ab82172dcc45244572515e7f4f114d09b 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 c549d1e6ba15d1cd92131611a56f44fd5b0eb237..a1ed4cd39963263a45ec4199ac3a7b16eaa9276d 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 96d67bdc10825b73e0bd4a6829b9348de7bc2423..90ad22a93876a79b5402b860edb657e38617791a 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 0453641574d541bd747934f709f1edf173d89879..961fdc8a199c1041b50481bc87076be52f1d57b3 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 7cdfc194c6bffdadd914624401dea196cdcabc3a..fc980ed98ba9237156948150a9282532c16d3407 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 b83cb1a6577657305823672549a785d8f0b46dcc..bb4eabfdab289451021cfa78e0dd541897ab2427 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 684a8b664a8549e479dbcf932dec8019ee9e75d0..cd6b4c37f5795c7a57e8f3690385c4074b858204 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 af643b64641207d3755669a2172300e4f61c692e..d1360d4d75e6a54d1c515bf81e585f12a266935c 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 296da95957f5bf893665ce38dcd1a1b395b40dfb..fd6c5100dd3e6d645854dfd130f116614242a2e0 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 14ed840baef0c646403f43332442d129420f8cd4..df505ac959f72a9fe49f6a6de2320f95be9d6c45 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 1d899ad4d798914ea47963578e099b7e56be1e60..9e99a56457cb4062139fe6220a9090ba11b5cd49 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 2ffb9b0f9bf3794ca4d9ffc9d83dcafee2b586ef..9cef7cebecad36a320efe6984418ac1009c2d485 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 9945e632d884b13b14ba0b4e1b3669ee89e2b64c..52f6c13c27e84311754a99cfe0c0b0c64a691add 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 579f4ce11e3c7aea152222f78aaf41021379db84..6e405852b42068754d365851784873fe53f3207a 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 76456f6ab0e13ae07f36c3da734e69947546c7b1..cb1becd3a8754d750522b8ef7ad491cc0707dfae 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 7c7d8476c077947e347aac12a2bdd6ca0ed88f41..2632e92bf977cfd91d55434b037748a18e62918c 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 72a781b7868c9b442b0c195781e3efb8561f61cf..58494b767e9d983ee5ff6d015d13f82df7afc617 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 6da3b1f640629f371660ed8699f53077f7f19dbc..18a4d526166d56af3efe54213f66ed6c5dff5bbe 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 d650a918b392d237b92e0a2bbfb87f37ed9ad568..c4baed1adbd277d4ed8908d37b8f9a0743d7cef0 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 72d365a762963d293ed5e67f21e96ca2b393ec0b..d30fed657ce132c00385bf40e4c00335c1d3bb8c 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 51e930e55e39bc9ecc7d31dd0b85fbd5b53ff14a..fddecb754e5839fa6a900caef6b01436d74da9fe 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 abb9e430816f199ce8b14e42cc70579a7f3856a3..c4395d7cadf4da3526c8d9beaa91bd22cb04e966 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 956f0005e541554f7e9a6a11e02b69e5b1763236..1a9fee79e22eecb9b3bd445d009c70b3693ee6dc 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 048cfa5d13289fd98d2cb22b3bfcef5ec1feb279..30f528cbc89c887ec83c97ef187e6ed51175a431 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 c77bbd53ceb5f6e2a6e4eed83fc3d060d58c33e3..8fda95bc20f9b6039c80f29b099fc690652b1f64 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 5447437426846b6c1c78ea0b128035ecac52081c..cd5a4faf31f7ba8c774660d058152cb380f6056c 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 e6c510550197715085ce0e54d77e684aa2934ad0..206602c0bb9407b9ba5d92e9db03665334d002c2 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 a64d26723af78c0812ab35d699613fadff23660f..84f51bb6e7e666998e6ea462867e579713b924e0 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 7e27654e2ea1baef6be37ac75ef997799855d6db..fe7683cf57da57d8824da9f3e539ae933b06193b 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 56eee19c9713b071a71727a7b3837fa84c6b514a..31f3de758126ea768d4f37f52b39caa2a5d4877b 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 1732fa117d1440d3ed00a23b540ceae723950fd6..b678267f418b1776df0525ffd7baafac68ffad69 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 218ab7819b36727d0f7c0ed9abf78e0425999300..7ca4304a28f265c056ca993fb9feabda9f8682db 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 dd3ffb2496ae8492491148e712e98661e6c29e9a..ba1cdc71287734140378af543924e9d763a128fe 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 3c7f629122a34498c8a494a8a59889bdc2a386fe..a4e90435730416210251454f6ce9fd454e53716c 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 4cd252a9da662c071db2612ed1be5252e42ebc93..b05e1379668dfe18a84beb063b17e60a09a35611 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 9fbea5c10345eea1d4fd22c8c8a10c93f2463d7d..3714b03a56615aee273be94e04034947ec8982c9 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 ca7b1ea86c3080c813a8e14464c325897fdab61d..525389614d03cb5acd228f444490ce145c285164 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 9fafdb77c2cecf1028562ee523820bb7af8bd52d..200fbd85aee55aa1fa9dfe6475b3c547307f0125 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 34b5c4f6a7daaa51996ff28c61ddce65566917c4..f3b7f3ace3182203cdaac416115dbb2a0a9e2b5d 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 07b6edf8220bd7c7f1db31e7901fe6681828e59d..b0438acfcb1ef12ca9356fa5bb6405ef8717e5a7 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 a8e568fc179ca667bf7b2de789e1733b6459f1e8..9b87c842286ae2390f893ea088e18952e83b85e8 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 c1dab62052add76b18532395b3960df272959518..43b45c5dcd1da3e0589f060cd214123aadc5ef3b 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 a7449f7a70351103d8bf333fe50d61221cb844d0..2f77fa0dcb5f0460ae4ebac61d59703461002ca2 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 ad1e8f3cc8e4c1ae8a24aa39c371603d5471c8b7..b5d83f0990ff39437f5a93656c1f9de1fa3689f8 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 315db3fce29a89958f3c3dce65b794990cfe3583..251968d030f50237152f7127708b9ffff3c7dba0 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 7bb26fcba0a9b95bc5b138ffef1b8dceac887923..7f8b18ae893f0c5f8d93296b03531ddb9f47876b 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 c78a8bd58997c1a1814396b39321b77eeefa8481..bd170f26be28481b8a5a35c6b76f7b1faee59454 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 ef756c4dcf1d2d6d43dec0ee611ed8cbce37397e..1d0dcbbda4a78340908814d8926c1399112b1bbc 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 287b9cbb0499071d7ca0175d0ef523e6b7ae0702..428c0d5baa33b3173d8205331985585a8338d5f8 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 241d7db3fff864ad84e33c30c8362ee61a0600c1..bfb449dc687f4c50eb595b190beb0d9d21d4d65d 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 9b37098bd072b5ee3dfc8257dd3da7e1030082d6..7e43efed045ef019639ec3a1215f8281138959d5 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 89046fab124a3f1f19e631f788d9250ec5ed4f17..44894613ad86b717832bec4c07df9c8441c79165 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 1754296169b89e92bf35bb741d921d8e2c6f4219..d9dbc4502e624422761bc50e4abdea4706ec0750 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 42940a0f8a2ef4e45ffd89d398a4f445a952b90f..042cc80e305c74d48b20c266b18d7b90b9ed71b8 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 a89e9c2dae7b63a2588ed0ec58b61225f717b43f..43c8c08b7ac08671a616ec1f2d5a696d29fd1b60 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 1b367cae9e7d3f72a7878c5423a996b1c9f45739..3efbe6b799d352ae871c5625df685ba704f9a3bd 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 25d6bafdb530cf7b2e2bf9da46035e45055e61d8..0493eb231183923354edb9d4486d12bd9f661e39 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 f3ebb61c2719bd0f567e5db349721dc30c916b66..ec2bb4636f700a0736eb973045286345d71aa7b7 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 865999217b640fbda26c2895b2b4dc48ab97ae5a..1dd66de8065f34b61f85d6742601c1f2527c54e2 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 5d78065c18c327e6493dd1112e3dab44bec7125d..24769ea8a1ffe470f10f34cec4e1e8f7892f1cd7 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 5e5d04d4e9b8514943bb2b0eeced97ab24bd02e5..5848ac5d564b78dfa1d522cf8b3ff8cd9d5f027f 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 71594b7353eff10a61a0489e7ec595bcf7867dd1..dd59e470fd129ac33d274dbe83c6f6cebb8553a8 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 b713da6a0150325c126519c8dc28d5fb48c9264d..9d5f27c600e6551a7890631d684349eecd6c5ece 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 d0a0b24c3c07f2c33915871ee09d22903768a04c..2bc2b3d886c3a7a7c77aadc50eb9569ff162bfe0 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 a3d2e19c656593c78beb409a7f2e1c7072527887..75fafb63385155718600c54753f6a82ee85528af 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 7da5dac854f16529c284ea4df64db37df747f368..86560f3e4f6ff5148aa86ba8669a00b80dd6e62f 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 c8e1f6602abf1bbc8f06ccbe6c51e9d502ccb281..b33788284094d68969c712a6cf401b3519903f78 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 95c28c4e8f113e1d7c5a66a6af4d5ee6064c3d96..40420189bb1ac17c1ffcada208b1b60b353211bd 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 5defa7f822a4282786902c6acd3dbbf4fc9c6862..f0a759cb6f1563c9df587060fd4c23219ef4f257 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 1c11f543a02d225453bbd312ae766ee82ab67137..83bd7a532d1b5ea54fdd2f70b60be2456101bc3e 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 278189eea412115d28201221a882105643a0d7d4..2ec65355c414bf5541a0f5341ca382857df4c4f4 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 7175b72f86b6d5d34ae190d5decc920e8d5f65fb..e2b4378581cb3842c7adfa337dbcfcd49ca6897a 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 78ba2224d79e63080312ccc77f18e2748d1fcaa4..7151c3f48071d20266d75619a05fcad29a99798e 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 b613f04c62faf86b7b60b53a4a2e8da19ef12141..10dbb54cae85bce7e939ce2739f3eb89a49a9834 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 4ad99271f36421e8ba28729ed181b7bd03806fe5..c37c693349464c5854e61dac8c2ece81633d55e1 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 f8021301b1f70a15813f84c7baab1ffa34df2d2c..8d757c8d538f36953e5cb84648475329f22c840f 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 12e81ae5b64f9c410b35368200cbc4473573386d..105b87102fc52c494dde3c01552b6cef17c21a1c 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 f1a6c91a7b4e50a81e20e1c32a86815eda5a40aa..d98bdbab65ff097afb1d8af6fc61186e359da346 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 3d66d0821a2bd773a4df224b510aba952de0a3fc..d3e505a5e2aa1a078e1325a828c557be8fa09986 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 d5b6111668182b8659d07e6b5b96c2462ff2619a..fdd5ea3731a828fd8f6408a69fb1a602b6d890e6 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 9662e82343f5c5c0597d48fcc6050247eacf8987..68334f08d2a6c96b78aa2dae72ecc2b08d74f693 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 73cbd20bea7f3496fb2765b21d865c9e7708e58c..0c46de8bb6d571ebd59b6f832cec6de23e8b1fb2 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 e9540031a1f33c1d19601ecf2c96a4628792be9d..d554f61f099f3f939ac315f2ceec9905f15bd6d9 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 4943fb7425a194f342ac5015d29b8091a1c160cf..c8c9d1b114ff0d1393dbce7937aa782df6655980 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 79d5d46403c037f8bad988288eef61a426beb6e3..71b4d36dd58d76c1df47cd3cb2526c0f2acba426 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 ae118211e20982da3f21cb2fe7fa54c08f5cd488..4671dace7d08a4a63c7b8ae15399077c839364a1 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 3ac620a772f0c5ce415f617c1b47a8c8160c22bd..8c4650296d11526ece60a89804e51f2912d1416a 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 e52962f27dec2f14e0fae2f04430b94f3ab79455..cef42cfc9c2ed5e5ebf89e3b666eaccc66d55ccd 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 c5f7d02d3b72ca3008e373e7e4fb2105ccc85a82..99cd844645be347407ea6a2991f47255b5fb2627 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 586d75442e26c497ed1aa4098c09b8c17ff1ac94..f8c7d18ba437908f877fe3d232628d8da500b3eb 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 761a78d2a61558674a2a4994606eb1115075df7d..05a55562c7c5fa8f44081e794fb7dfcef5b41f9f 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 3384d912f843796d0d2ca4eed02709643c75e26a..426b9ced0d4c7b25c94215a3a07bebc482cb8cf8 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 f560041e399c9f45255e71e9818acf1740b89d7a..dc5d93b797969cac4521945c5fd6ba1eead27d95 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 40c34ddce0d220300289f126cb7b8ea7e51c545d..83c1a086f24fa369fcf6e4435a3ee51826a86be1 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 d34ce6e569ef2c0ab76ac4ac99f3101de813c5ab..691cc84e64254212f1466d77013b914914937c2b 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 51dd9403b75af6baf081d8926e286c24ce83cc77..f934154353b03ace57aa2a4bf671229113ea1051 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 acc9b5df3a5b9c51ea194436aaffd568ace2189b..a6b94f716a867acc89a693205009df46b75bbf49 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 6713f3708fac0048a154e32639555e20dd7b6f6c..d1ac77955f8b197d0acb40cb8e70067e8d584146 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 04321ac6c0f66b33dcf25b49e8a4584834053fe6..5a67820b0245a7d1e99b8dd9580e095b7a31c476 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 f3dc906765a93c12d5a448a21a1f6f878c1af243..2170c83168142ea97512634267c8cd4da9b42ba1 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 10303309893161efde24c4f6912a44d687e01030..98f1c2217c4959100fadf64cb8a5c843ece19609 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 7618fd32614a1d062e115fb6a20d67ecf083c47b..31360070be050cd6a001896e6282f05332a5a487 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 bf0fcbdbc9ab2e06c7b2097fe45ce642f732a4f6..18bbf0b7b009bf1ebd2dc2dd1adbcb6b8e220da7 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 f9ec501774a5ccacbc1ab0980347c1f96d8d22c1..bbf55d8891edd8312c8d4711d2bf288c4a78bb04 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 95f67506b704f488f87828434d383ac608f620a6..3a0075125b5826be43709623c2f992bf49c1c92e 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 404a77f0a9156ff56e16747b4751bbd5b173f124..c1a642133f8f1bc1dafe5f2449e641371a796dee 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 bdb58e7bdff00f60f6a2986b5ccd2a7901a3deb2..616cf50763ece5a4bec3015562c4421e65d235cb 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 ea1de604d50f661bb385d7f1d583b72ae79fdf4d..51a77f796c8857f5617b7593f0bc1bd4f6dff784 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 e2243648a17f47cfb992c399338d5cc27ec3df4e..7406438f2c041bd033013efd1f7771993b96f906 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 958ffd8bb3285e707b8a5608ba500f4631fa58db..8a972645234e488c2eed366f6b348c8f0a81a760 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 d64368c0ccc2074a43e8b719c96734f27604fea7..95bec9d294762cac08a2eddb84bfe48d8aa529ce 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 b2ed54636b7e5655d89db278afa70d9465ea7f8b..ef50d094d4ddfc865c3be6a0bcbc675243330601 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 b78bc4788fa5f6ce115b26fdbaefd0b5bee3302d..9b21f6ba72c2909defc1b7d9fd213f0ab5c4c2e7 100755 --- a/test/resource/tooling/ohos_test.xml +++ b/test/resource/tooling/ohos_test.xml @@ -15,114 +15,118 @@ - - - - diff --git a/toolchain_config.gni b/toolchain_config.gni index 578cad4c53d092b13fe0371678b5c7a514e2ce0c..51120f4d526b918417708c36d506116a53b209a1 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 5f80264701aa3d6a38dd62c85962453fd038fbb9..503db01b597df1030612050fe0393a8108c9bf12 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,48 @@ 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 if (is_mac) { + output_extension = "dylib" } 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("libarkinspector_plus") { + deps = [ + "./static/:libarkinspector_plus_static", + ] - defines = [ "OHOS_UNIT_TEST" ] - deps = [] + install_enable = true external_deps = [ - "ets_runtime:libark_jsruntime", - "icu:shared_icuuc", - "libuv:uv", - sdk_libc_secshared_dep, + "runtime_core:arktsdisassembler", + "runtime_core:libarktsbase", + "runtime_core:libarkruntime", ] - 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) { + + if (is_mingw || is_win) { + output_extension = "dll" + } else if (is_mac) { + output_extension = "dylib" + } else { output_extension = "so" } - subsystem_name = "test" + + output_name = "arkinspector" + part_name = "toolchain" + subsystem_name = "arkcompiler" } + diff --git a/tooling/dynamic/BUILD.gn b/tooling/dynamic/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..66345008024e4e71882dff925365122132c3954f --- /dev/null +++ b/tooling/dynamic/BUILD.gn @@ -0,0 +1,165 @@ +# 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 = [ "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 += [ "ets_runtime:libark_jsruntime" ] + 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 + deps += [ "../hybrid_step:arkhybridstep" ] + + 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) { + external_deps += [ "ets_runtime:libark_jsruntime" ] + } 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", + ] + 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 += [ "../hybrid_step:arkhybridstep" ] + deps += hiviewdfx_deps + if (enable_hilog) { + external_deps += [ "hilog:libhilog" ] + } + + if (!is_mingw && !is_mac) { + output_extension = "so" + } + subsystem_name = "test" +} 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 bd3ecbf87675770c1d05c601f37bfddfa45d8821..b6f10efeb65137e2d48dca6efd1ec0e1e52f3850 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 b0a4272ccef789106ec8657ef5dd1210d29f30ca..7c33d0e51c6e99e2b7fd6d6ac5c857e8a2f86882 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 767bc6f53e261c03d346f4e07a3af6be806a9b9e..04f1acd298088722e017f9e8c7da9caa97912d61 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 e953bacad28bae03b40f782266f66f035448db36..4361e4135b296c5e6334beed6e915a69e98337b3 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 521244167869d2a271d9575b0a763110c472831a..28040df38fa58e2fa34063cae3665887fd639f89 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 0b050c0f6baa51baa2e8234e78bbdfccfd406064..65f730fdc7d3de8a3da99142c603aabd5356311b 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 806618e7a8485befb7cc9f2e8bbb06032cd72faf..43c77bd44c9933317e17c03024bda05b4c3bd018 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 94% rename from tooling/backend/js_pt_hooks.cpp rename to tooling/dynamic/backend/js_pt_hooks.cpp index c84e885f7670974e600a7bd08271a2f8ee7c3040..c72be824dd0a17b89e57e574488e13af5b8732b1 100644 --- a/tooling/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/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 f875c697fae94e772869e84c1bd0efa35bb2309f..204e9d8c63b7cb41b13816ceaae7ec109be97412 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 e50920de5eab404c45fe810cb4bbfc3fd3d7aee5..f8f954a86a13a97ddcd8091033b4d5beb50aff61 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 3d7d377133c35751afdd89a39e0e20a569aaaf9f..48ce8b22195aba77599f9c0e3ee455970aec8ef8 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 d39d052eca9bfa96ed0fb8a5a751c7328d6c8b02..1ecaba86f007992d3022eb173a91e855c579d766 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 71fee1a1645bb655db33f442f6bf82564b3dc91a..a1ce3f475d00fe2216237a372256c58bc8b3cd64 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 78c2acfdaebd7e1c3c034c72eb4a1243d0361068..a53b2a20d920da2d88603ae028a3789c100b53e6 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 880addf9f3acb1c0ef4627229ac7fde453d8faf6..0ca2d375fb2e0aecf82b9d6470cbffdfa332c37e 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 b53355b12feb71ba5701b5a4316f74301194d248..63c1090c09a1e2cdf7af0c0d8dfb4f99ff4d09a5 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 d9dfa1ef3d2a621e9384539a410ec680faae27da..d6555809a647045a259bf24317e77f76b82b4bf5 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 79db193fea9d7599eb191f6d2820045eea57a9bb..5d2debdebcdccb9603e0ab932fe4e7ceba3e7280 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 2d797e2bbb2e588375afe63231ea00996d40991c..d4d565f0ba95f47bca65114490f6d1bc870414dc 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 096c7a9d35fdadeba1a6a0a232e9e78685cdb412..7e06aa47ae7ef7d879716a326450c0fc881c493f 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 39efb84e92709773f4fa61cc52c8fc494a0da194..682de66fe3a28da1a0a5e1b16b2b0a29707fb890 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 89% rename from tooling/client/BUILD.gn rename to tooling/dynamic/client/BUILD.gn index 21c40e9b9c7775e85470f6e40529f5e74992e0da..3aff4fe5aee995522fb2b5005ae6c8d835fa5bde 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,9 @@ ohos_source_set("libark_client_set") { "libuv:uv", ] - configs = [ "../..:ark_toolchain_common_config" ] + external_deps += [ "ets_runtime:libark_jsruntime" ] + + configs = [ "../../..:ark_toolchain_common_config" ] cflags_cc = [ "-Wno-vla-extension" ] @@ -68,7 +68,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 +86,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 73f753d57a9d85b394064f3717f1b0d67c5640db..eceefabf75bf957a12ccdaf25a1d743e2558fe8d 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 030bab0e00e487afb8c86640ff03b65de2718454..f1113f48baa86a32433572dc03802e5742afb202 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 439049c3a9fecc2bc8f4cc7eff72198a0712c91d..c0600b1f471507ecbd01458c1b128043c45ee465 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 79bb02b49bf6e7b26367bda81853a353e08d18ee..96861ec79513ab1aa23258bd5366754e8d385ea1 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 4d3fd7d468cc6ed91dda632fa9432020a54ce7f1..91fce473f26211efb4ed38a3e9c7109b1aedd0be 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 2320a928befb8d3c90679dc6b32484e1cde39670..1ebe7bdc2c2311de8bd81cb6bad302ad324e4df3 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 d8f8e3c43eaf15b17c2a209664b0170e0d170567..6e76fe5b761e7db8de27c5b1c9cbf40b7d6b252d 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 b6a5fd661b1786a52d59b3de4718d4afc9784cb5..c51f0e2f66c09f9ea2fb805444098297d57daafc 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 234c1ecc438c4b68b90fa57c0b4e5460233c1e33..f54ff44b146ba1722376dd95a4df7e1629393117 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 fcdc3f83aebe45e85355552efd6458f8bcdcb00b..f9e6d18ce238e016622a3291f2c7b2b1a0eaa7df 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 0293330c22fe264b0b1b0ff4c5203929df60c229..fa90ade530806cf8278afbc442ff837a7bdc6df3 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 12e127054e6d259d4274fd438e2b9f611da2d4ae..521304b25bde3dbaf42547ab4b26b8ca9f54787d 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 cc09b5bb6a6e01613d97cca9c9abc57a244dc489..d773a649518fb55e9398655086cc169632945862 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 6a76873031713c9448819850f7a79409026218bf..9a021ae2160563daea3838a763e7ade094e93c08 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 f6df7c61417d9c1f1caaf544db82110639c5575a..c704934c208e002045dc57c3e25a934b3b1d4d14 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 76958898c6292a2a8f5e54187a373ddf5e333e89..85e8474540bc469bddf88f6570761aeb74755dc1 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 a5d8467f6e4dde46453cf00c9d2e2282b3f1170c..927c1f449155ac210ea7620869f7c277d7452a3b 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 893a2fe341e4b4f5643957caed42be233c4a3ec3..ac58bc6b4f3ff4e86eeac06cdd1108729fc1f048 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 fd621b43921182662d232c1cd75af41abdfc7935..61b045dbd0bb97a6b241c31ccadfeadeef74f819 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 1421cf7f0c453da5a439d41e3936a29c0c36e921..b938ccf62c5fbae09082b333a37e29bc1725a6a9 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 7a5fb7cb47294ef37594f29bb92b0ffc7bce8b6e..51ba11e4db81a91a9488b15eec6d2ec16fcb7afe 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 99c65e322a9a3bcf953e6d4163da0b55e9c26956..7817237cb1fa8a5a07b8c2f262e63ee62942296f 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 2812ecf04ef766bbd3c8866bd5cbcce61abb05da..d6b4f2d98e7c4cc32433a91e59eb20f8ae4ce714 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 7bd72b7efd94cb828e6791c3436f6b96da8a9755..8d16af414157b99bfeff6dcecf0e0e7566dd90a9 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 49191e70824dbb29acf9f255ca8d269f1e7add9e..caf457f1e0deb8720606f418a6d8f36fe61f00b3 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 be0aea47d95951d133f47d397f9dfa91d2b7cc4c..753d5cc78336cd5306c206da79ef0291bbf1f3c7 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 db690148590fdc899365f7bc69dad984a35c2b00..8940d331dd1ea0955817d7318f1859d92e31c320 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 a915b66f12ba07ae92190949add14f853483a33a..b875553d0c2371287d22395b4da46c669227d5d9 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 3884ca155b72f36e7cfe26eddbd4b42f7881b4cc..4efd285350e6b03afaf9c9472dc19860ece3e8f4 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 80810248d4958c9c82cccab4352d2dd5ea393216..e6b88abd962ea353605df26d87bcd7b0008491fc 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 b23667b76008f371064e09cf83be942aa7a4cb19..0b0e7f460b5904bfdd1694ef1e4296762857e67c 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 88543ceff0df7824272a34dafcbadb0cc1dbdeda..b2db05cfb87e5b9cc233210e921479bebb7b9510 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 adb52366345345e48d4bd8cb64bec12a1b4f405d..d4e4b543f14d2eab3234cbd9074754c9255b5701 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 95% rename from tooling/test/BUILD.gn rename to tooling/dynamic/test/BUILD.gn index ae5d327ac0d7f14d57366bcda398d3c46bafb439..667272e92cf94b2512193d8a6ff779bc1f93bd77 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 = [ @@ -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" ] } @@ -117,7 +120,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 +307,7 @@ host_unittest_action("DebuggerClientTest") { deps = [ ":debugger_client_resource", "..:libark_ecma_debugger_test", - "../client:libark_client", + "../client:libark_client_set", ] # hiviewdfx libraries @@ -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", @@ -351,7 +355,7 @@ host_unittest_action("DebuggerCIntClientTest") { deps = [ ":debugger_client_resource", "..:libark_ecma_debugger_test", - "../client:libark_client", + "../client:libark_client_set", ] # hiviewdfx libraries @@ -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", @@ -380,7 +385,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 fbb937740f0f99d5e1656c3e39e721f5c9456d44..0fba99eafb659f947ecbff37bde8b0c36bf1891e 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 3d045c2bf8dc05789f08c7e3a7aea35744421c96..c39e7f05473b12c379c06f12f12b910492fb4df2 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 5fe22bbe445839c9bdbe32eaa7f0062a5826bbbc..7b3fdaf034897134a907e7e3055474f5b71c9ed4 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 c56746ccf92baba9208fe7fb835c65b4b70b3a56..9c225bb9e34330c60ad5e22bc0648e00e075ad44 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 3e7452fafc96c57d76592230eb2d94eea0df0658..71940889b2da582ceca79d03fc80822339fd93ab 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 b460076187a99902b65ae241f790fdb7fb42efbb..d68fd1e94148cc1d0103c6d039dad3aa93d9de52 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 6a9fbdaf1d7bd142a58fda63ddbb513502b2db2e..8464391c9b3f128fcb38eefe710b2575aa5a6421 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 6710e86a217fd607f7e389601fb006334936ed57..8d2ec89e9a2b7e96307e2d049168d5769f341cf3 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 08a344fef3fbb6013ae54aaeb557fa81f4b7a156..248a30f17b47db7b6b5cde484f1fbb0dd32296f8 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 af06a80e31600cb11b1a1c2f66b0ca967efff662..d432df4ab69581290098e61f310b5747ad1b0d73 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 abe1dfd4bd03f13509eb08e081dfe9f114a6e577..ede1ba878ef8bfd7ccca7b2f4f04d7d2aa0da6f3 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 38562947cf89d8ee6815a4bfe80159b8995c63d2..0251ff2bd448d7be86416cc208b284edb8bec23b 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 ea33eba41b658bb482edbcce6c07d8d5f2dff235..2d5d21f3e9d66c5c2f309fdec6d2abdfaccfaef6 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 f425a638c9b1a6850cebe5945db9213138796b97..57dad11f177a0722e416abbe2b23afb4b7e1d494 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 5d261d313d71682e72261218b5ae09f9e393b997..34ea1dac791c172f0a7e7577dd59ed5ad2624b31 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 d18c2e6e80840cdd1ce137c6310438400ec0d047..dad1bacc3cd008c157ffad525343b6aca8b0c0dd 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 c128aedbbc156087f8e2340d1be270dc23132446..ac9fda1398989f185bd88e531562a0c6416a7dca 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 414158da6a191a4428b8d6e08a93369dad5d10aa..6b991262f7ce9cc22c434d903e60562938a7a784 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 017ef1e6e3421c6d9baebb1e63fe7cdf76982bde..4d26ac0e6c8d3fb3179cd733fa9d2e895d57bf1f 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 6f8455958ea9b945da1439f74e8be49df32fcb11..10fd698a39a4951163fe33b5a0a5d9cdb47ebce6 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 4fffbaad9a84fca46f0af9eba37a3282b0f26c4e..f7d9d908a6e69faea62406d01e6a47034b40e1e9 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 f73f632de854ae2316c860cb3fd499c057c596f1..2bb890c70665777e1b905d4719c62493298a3908 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 d03802ec68328f2e786a1a9fb7ad3ae9fbb86a4c..7b576ce41569c9d0d787feb67397d16eacc9d1c4 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 7b6c3d8bb34704426057ff50b6eb2a238c742bdf..3a123409b79004cd25475db7043cf0d24301bdb3 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 4006309a1648dd0699ba751aa356c961b8a1a3da..0876ce61654b0a458c21f4469f5ecb6a993fd245 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 757ec0bee2806bf141ae004af28b95a0a07dcabe..6d27800282ff116259af9b602032478b26f4f950 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 1b033ec1942addf7947c12f001524b5dc9dfaa71..e6b2989f547a058595a2eb70c0d882b5abf5e17a 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 6a384b7988469b354c1101f83b66ac90846b2be0..54363bf5258bd7f2e4d6d8817e6274f0b50e3283 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 bb3f4c0e22fd5e23c29a50f77ea26cfaf2488022..f632af664d863b98c2235225c2d76c5567d5ff04 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 03f87e8d0ebcd3e1c7d1d5c28f535add4d52c32e..bc5b4f2cd041ee373c37da80422ba34df04de6b0 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 45c269e5bb0cf21516b2d4f95c3977ef42852053..d89b2beab1c5fc343fc5a21ff820fb04533a59fa 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 2fbcfa88b1713c4b93052ccc6da27cda09632bd5..524ab31d73b87bdcfc6144e0abca70f0c8abc24c 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 219a6705f73a13d5a24555e6adb9897e0b6f79ee..fbf66dccfda6d2707c2300a4824b924bac4146e5 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 7ba2706b9fabc14304b8b84ecbcda1a0f9ddf840..fc167040203990068fb14395933af6121f5a1e1b 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 4d71bb84baae904a58765731b495bdffe885c986..ec1c971cda78a93681fb927fe246dee4aff93cc5 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 ab05794cfca272e95afbe988ebe2853d1d3baa84..44182c1dffa142cda2c35f67cbfcd3753a2534df 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 2cddcdbbf73ea61682995b84ebadd6222ffbb975..7daace2fbbc1aa492e9025dc404ebff9e5c9102c 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 d2cfd3c130586b1a9832c68cfb4327f205ca7abc..3f5c7341f4c737384077c68e0e61512a7876bb30 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 126ddf822dd3f9227653230424c0c9cf08918381..9eaaa7d107eceec3c1fae82916060c001d092076 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 cf492e1d4629a7ab83c89a6ae5bf3005692c08f0..3cb44a17d5de16b8a843417f7a4f314740460e7a 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 ac64be7e32e004d651bf64d472d7e8f8888d8204..e314f2ec54789ce49c0ec0907677ef74c83c0060 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 6dc4e2a643cd512f3e61ffdd13817566ab509d27..9bfd1adbd9e4ab7a46fe75ec583e21cc4a2dbb5c 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 abfbc0a29546e3434b25e6e3b5d30dbd5a9daf63..f9adf9364c5a4b42eed7cc27d7ba8f25d4d97685 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 09331699eedc1350f3b2d3a903ec41ec04c383a8..a9c3d2fb47c4d62843a21e6050fb371478154e4a 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 3d37e3eb49fc8cb6905f5707042b4c75915bec55..a37f6c5477cef448cc63fc4db32f491f69aa77a4 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 0ef339af6c28ed9a8b4e0df9891a5a3f8f0b9692..054e041b039984f99071c776505b45ced90d41f5 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 208a6688865beaf373341b69ede66c542e1ee1f1..79ddb988d75380c0fb5ab32565e8af9dba6f37c1 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 221df17866d44437c692007398f1a1118512a396..85ac94155f5f96c36075f5b77a08ed018ad1c344 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 7930f49c7c11e36d4ee26dd421a1d7a2b721a38c..c5e13b9c00b8c390bf3f28607e6bd3d0d3f5b270 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 698d3e5a017ba9ad0a3b039a0be5694db08a3088..e0748d4014c34934314702d152b2b1ec564e05fa 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 542c9c58f609a41f059f5eed4424199a91fb2208..4a3baa2f91c2fd2151c5aabff7e167c381647964 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 4f7187be84667a14fcf9437c1419ef59b9f1a24a..943850f0bd518b51554efdffdd611b3de257abed 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 52424f86c78388a764339c4be3ea5f569f56d477..5fe34472d2e083590b6d2c46f136dcb329f616c4 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 eca5003edc8bc9bb6d87c6a30308af055345a336..12546ee62203bb37ffce4df7fe281c3e17bb85f1 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 0b8e8fba4e57663069a1bfcc834a589fdba4b41b..285093c357d0c3c08bea1109acbfbb62870b721f 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 5616afe9804358b2b1a9995d0e034a4f32e2af3e..5b9d515d8cd137501500f481fa73c50c8be4fa6f 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 e02cf9bc00d1c5b7919d1d1535276b27ff44a771..1cc7117dd5a5b598d15429fcc1df0114f590648d 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 373ba198e2f26852abca814ee4c0eda58229bc58..6141800c246e3bff2e68f74f4059985aec8890e8 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 ca3eaf1d8e4b0e40ea60c2151c2741632427d855..ab8dbbf10b93f37c23bbdae414f90b118c971140 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 cc813a51e71a494d61296ec0c3aa7f126fdac215..f8b5dea79b2bad825d0f5969cc857cf25d32d22e 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 a0a687920174a0c0892921280b94da368a608125..3faccecc430229f1b3d3b2fa750e2e301d8f6987 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 0aff1fb232584403baf5cf2768046a506ac0ff9a..690b8d57337864619dac13d4b0a0d7dcf870c4d5 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 d3cebe6a376ee5fc7480d2538420441ca5f680ba..c040f792b129b6c6c948271c3e1fd36653b6eb46 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 be4f1cf6222ed60e53d233dacb10d3f98a29db35..9d78242eb345a5803d81ed165f64ad97d3e8e124 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 a0f1caf4321e9b9de21a60fa74180f7503e4d828..a79555628d538b752a9eb94141a8ab0b6cb440dd 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 f487f89695cc3d2602ae29bc3fc065c27296d351..db36cdeb05d472a7d10049dc65262d6b9781de31 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 665435cb6a57b8b8468669a13164e322b4e5e8c6..0a8d078782b4815010ee40701b9d7c3578d0b730 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 6056cde3adde65c3803bc209fe6101ea7bfba783..c11f48f1c3e6fe07a70e58ddd38237f31648196b 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 9953a9cd6008b8968641b3f40e3c80d9c8fd6537..945ee5b63b296eef24ce8fddf656392a768a8460 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 49b771513f8637d825f203c5f97507b21e7279fa..47401010efccdcf259934a7409fa18cad75d091b 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 98c73583ede4717dbc47121fadb447373db1b8ca..3f983d8b90388dc70a6e11d6a0c0b860729b08c0 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 c21d7e2f702007179cf721fa923a71b8eec05ecc..f99cbf085e410e8f8df51de00d2d164024889a69 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 f5bf600663958c6b80bb2925d426f7b85316fcf7..36cce6aeeac08d9e2beea413dabbc2ff0bce7588 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 ace2cd334b8fe059d94629675fcedc561ce13e5c..dfb30211aacc0dbef3a0abe97d75f83eb9d8e103 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 78731100e2bce4237e0b59c01c8603780909a729..2b77b003fb16b8621821813e566b6197cba52716 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 a5eaf15e9c99d5a343b2d0f82975cd6c7aca61bb..95f04b906091272418d70c917ac893b6442ab70f 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 2b21a2738e94d7ce1b8285fc272e5ad55655e8b5..c2a0ba77128c74e920e79cc5d341f950d294579a 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 ff453b6cfd5441d95dabe4b802a2307259a46aaf..ea3a2919b481beaaad1c7eff13c4eeb7ca93a7c6 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 56d7e0dc1871e366e3562d8f62df4454330e2bf3..1d6b771673ff1e483c6a5d0f35f00b52c4255f18 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 0fd734e922362ef44e457344fc9ac6fdc86a7cae..dce705c8a8cf56bccd57ba3847b8c2b7b2fe6a29 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 0ca66a218862e82e45f1a2ad6f2b094423c344a6..015484098a68e99fad82addcce9813c1cbc6589e 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 a5fa7d159a82568c30058054c1a1200c23b00a98..d48da68914f6b74b481b44b58ddde42b0f6ccf9a 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 61013e4c7d1722adde902a2f517664ca9aa7e0f4..c8a62bdff4b1bf98fb397494c4e7196a444d4bbc 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 e92a1b95077f8b97257ac3177debb92dccd7d635..655c4105a8105db76f685aeb5c02b307eab5b871 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 c49c511702617aa9a1e8f706f90a24170308e8e3..88802c4278c323a61d32a9df609d7a77bc71ff66 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/hybrid_step/BUILD.gn b/tooling/hybrid_step/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f615c351dec792deacf91cccd4820b7357f55970 --- /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 0000000000000000000000000000000000000000..1f492d187c4075ff4aed13f7bde2c8c02db056fd --- /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 0000000000000000000000000000000000000000..e6e19651878f655096807b04e27e322654b2edda --- /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 new file mode 100644 index 0000000000000000000000000000000000000000..72e6ef342265b79a55b4b59b8c4d4346584116df --- /dev/null +++ b/tooling/static/BUILD.gn @@ -0,0 +1,95 @@ +# 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 = [ + "init.cpp", + "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", + "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", + ] + include_dirs = [ "./" ] + include_dirs += [ "../" ] + include_dirs += [ "../../" ] + defines = [] + if (enable_hilog) { + defines += [ "ENABLE_HILOG" ] + } + # required for arkcompiler_toolchain compilation + if (is_ohos) { + defines += [ "OHOS_PLATFORM" ] + } +} + +ohos_static_library("libarkinspector_plus_static") { + sources = libarkinspector_sources + + 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" + } + 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 0000000000000000000000000000000000000000..0773e218a42d611637503020b667cb5cf36b6c56 --- /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 0000000000000000000000000000000000000000..fb0054567966cf602e1a9c61c9246658e4ce1b13 --- /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 0000000000000000000000000000000000000000..6afe109c842cb565449012680eca7ab2155690fe --- /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 0000000000000000000000000000000000000000..d7f0af572a365fd3fa98374f8414e9d5ece6b6e8 --- /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 0000000000000000000000000000000000000000..04df5ddcba2e9681ecd117b511ef277740666a2e --- /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 0000000000000000000000000000000000000000..5277d2d3e21475053d69b39bbcdaa8c7a11c57f0 --- /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 0000000000000000000000000000000000000000..1da6009321453597c54ca9f2233f8d40add94681 --- /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 0000000000000000000000000000000000000000..8b895ba510a3ad664bd9ce5e4d84e70b33942288 --- /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 0000000000000000000000000000000000000000..b5ecbf414b2d8576bad35dac4ebe10c9a8f21068 --- /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 0000000000000000000000000000000000000000..1454419fee8b3885fc8ddb6f75870f5feedc6d64 --- /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(INFO, 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 0000000000000000000000000000000000000000..ffe1ddda3aa53f74c46e0551ccba9af15745a1a4 --- /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(INFO, 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 0000000000000000000000000000000000000000..c55b4da3134127dab232ac7136e671f7583ae0bd --- /dev/null +++ b/tooling/static/connection/event_loop.cpp @@ -0,0 +1,32 @@ +/** + * 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 "connection/event_loop.h" + +#include "macros.h" + +namespace ark::tooling::inspector { +bool EventLoop::Kill() +{ + return running_.exchange(false); +} + +void EventLoop::Run(const std::string& msg) +{ + ASSERT_PRINT(!running_, "Event loop is already running"); + + ParseMessage(msg); +} +} // 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 0000000000000000000000000000000000000000..73e2f518fdcf0a01a949eb4b72e75386222c6881 --- /dev/null +++ b/tooling/static/connection/event_loop.h @@ -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. + */ + +#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(const std::string& msg); + + // Run at most one event loop handler, may block. + virtual bool ParseMessage(const std::string& msg) = 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 0000000000000000000000000000000000000000..5d9e8065987e9c95b01e45a3de35482b4940356c --- /dev/null +++ b/tooling/static/connection/ohos_ws/ohos_ws_server.cpp @@ -0,0 +1,85 @@ +/** + * 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" + +#include "inspector.h" +namespace ark::tooling::inspector { +[[maybe_unused]] static constexpr std::string_view G_ARK_TS_INSPECTOR_NAME = "ArkEtsDebugger"; + +bool OhosWsServer::ParseMessage(const std::string& msg) +{ + if (endpoint_ == nullptr) { + return false; + } + if (!endpoint_->IsConnected() && !AcceptNewWsConnection()) { + LOG(WARNING, DEBUGGER) << "Inspector server is unable to establish a new connection, exiting"; + return false; + } + + HandleMessage(msg); + return true; +} + +bool OhosWsServer::Start([[maybe_unused]] uint32_t port) +{ + return true; +} + +void OhosWsServer::InitEndPoint(std::shared_ptr endPoint) +{ + if (endPoint == nullptr) { + LOG(ERROR, DEBUGGER) << "OhosWsServer::InitEndPoint endPoint is nullptr"; + return; + } + + endpoint_ = std::static_pointer_cast(endPoint); +} + +bool OhosWsServer::Stop() +{ + // Stop event loop before closing endpoint server. + Kill(); + 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 0000000000000000000000000000000000000000..151b828e821cce20dfc971db4a503803d49a12f6 --- /dev/null +++ b/tooling/static/connection/ohos_ws/ohos_ws_server.h @@ -0,0 +1,42 @@ +/** + * 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 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}; + + 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 0000000000000000000000000000000000000000..fc58b308d726f6b9fd9a95bca66279dbe59ad383 --- /dev/null +++ b/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.cpp @@ -0,0 +1,33 @@ +/** + * 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_endpoint.h" + +namespace ark::tooling::inspector { +OhosWsServerEndpoint::OhosWsServerEndpoint() noexcept +{ + 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_(); }); + } +} +} // 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 0000000000000000000000000000000000000000..e248ec43364d97dbd6de753141bf22973ad502cf --- /dev/null +++ b/tooling/static/connection/ohos_ws/ohos_ws_server_endpoint.h @@ -0,0 +1,53 @@ +/** + * 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_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" +#include "../../common/macros.h" +#include "inspector.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: + 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_ != nullptr) { + 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 0000000000000000000000000000000000000000..46ef13fdf07f34ae5315526a15b7b96b859d50cf --- /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 0000000000000000000000000000000000000000..bedbc97628f0f79c686da0f833449acd61355b79 --- /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 0000000000000000000000000000000000000000..96ebe5d6d5ff92d2ff927051ad716847751d24be --- /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 0000000000000000000000000000000000000000..91e2cee99fecca1ac621614b798422471a8f470b --- /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 0000000000000000000000000000000000000000..3d7721e0ff51bd21a21143c02d89079931cd0ef7 --- /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 0000000000000000000000000000000000000000..da39a327a547771e20862b4e1225a537dc117549 --- /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 0000000000000000000000000000000000000000..f0a7185fb51c894467e087113870de5acf2565ff --- /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 0000000000000000000000000000000000000000..36ec95d0a9764a312c9a4b0f6d1cd52a2e027288 --- /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 0000000000000000000000000000000000000000..e49c80ba6ced9ccad7ce654da43184232abaf06e --- /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 0000000000000000000000000000000000000000..aa412f0ec5aabc8742143b9d91c18a172a7bee71 --- /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 0000000000000000000000000000000000000000..68add1eebb35f73a1602e9b637a13a6aebabec59 --- /dev/null +++ b/tooling/static/debugger/debug_info_cache.cpp @@ -0,0 +1,433 @@ +/** + * 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, bool isUserPandafile) +{ + os::memory::LockHolder lock(debugInfosMutex_); + 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; + debugInfo.SetUserFile(isUserPandafile); + + // 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 || !debugInfo->IsUserFile()) { + 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()); +} + +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 new file mode 100644 index 0000000000000000000000000000000000000000..f018042832a390e05b62ed650ebedc92c761b5ad --- /dev/null +++ b/tooling/static/debugger/debug_info_cache.h @@ -0,0 +1,114 @@ +/** + * 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, 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); + 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 char *GetUserSourceFile(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 0000000000000000000000000000000000000000..c50574493477a1a1c4e14e023cf29e4b399ca7b8 --- /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 0000000000000000000000000000000000000000..e3395d20c6bf9023b0854bc249c835e161e8acb6 --- /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 0000000000000000000000000000000000000000..93b2d41e6127179909380f8f39417959bb067255 --- /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 0000000000000000000000000000000000000000..1a6bc281ccb38833cba66897430c843787a6f334 --- /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 0000000000000000000000000000000000000000..94554d9c7f79fb045ae64e36990aad416a1204a8 --- /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 0000000000000000000000000000000000000000..b87f77107609f1b199a7156ab1693aae9cec488f --- /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/error.cpp b/tooling/static/error.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7ed13adacc30101371f839a41f73bbb4f4cc5167 --- /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 0000000000000000000000000000000000000000..75aa0e29f9c0e453c77ca146c5ab1ef1220b5dc1 --- /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 0000000000000000000000000000000000000000..0b10e6797dc4f36bfd31e6f791d0afde3516fbe0 --- /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 0000000000000000000000000000000000000000..1e73572974900de6f3b2884adccf24d9f017445a --- /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 0000000000000000000000000000000000000000..33b367531a01b91546a2295e021a803a8e815c31 --- /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 0000000000000000000000000000000000000000..9c3366968bff00df77e1c492e41c29af0620f825 --- /dev/null +++ b/tooling/static/init.cpp @@ -0,0 +1,117 @@ +/** + * 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 + +#ifdef PANDA_TOOLING_ASIO +#include "connection/asio/asio_server.h" +#else +#include "connection/ohos_ws/ohos_ws_server.h" +#endif // PANDA_TOOLING_ASIO + +#include "init.h" +#include "inspector.h" + +#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) +std::optional g_inspector; + +// NOLINTNEXTLINE(fuchsia-statically-constructed-objects) +static ark::Runtime::DebugSessionHandle g_debugSession; + +// NOLINTNEXTLINE(fuchsia-statically-constructed-objects) +static InspectorWebSocketServer g_server; + +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); + return 0; +} + +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; + } + + if (!g_server.Stop()) { + return; + } + g_inspector.reset(); + g_debugSession.reset(); +} + +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; +} + +void WaitForDebugger() +{ + if (!g_inspector) { + LOG(ERROR, DEBUGGER) << "Debugger has not been started"; + return; + } + + 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 0000000000000000000000000000000000000000..1ff9e153d85a002baf42ed6082ddab4e7a4ead25 --- /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 new file mode 100644 index 0000000000000000000000000000000000000000..641f5fd87d6897c700e2ff88c5e7edbb3acc7fe4 --- /dev/null +++ b/tooling/static/inspector.cpp @@ -0,0 +1,815 @@ +/** + * 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 "include/runtime.h" +#include "utils/logger.h" + +#include "error.h" +#include "evaluation/base64.h" +#include "tooling/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(); + 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(const std::string& msg) +{ + inspectorServer_.Run(msg); +} + +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); + auto stack = StackWalker::Create(thread.GetManagedThread()); + if (stack.IsCFrame()) { + return; + } + if (debuggableThread == nullptr) { + return; + } + 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, isNew] = 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, true); + } + + 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_.GetUserSourceFile(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(); +} + +//For Hybrid it was not used, instead it use 1.0 waitForDebugger +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() || interval < 0)) { + return; + } + samplingInterval_ = static_cast(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(); +} + +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 0000000000000000000000000000000000000000..e81e29a6a2019e395a6eb3f29e86bbc6e4bd8a64 --- /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(const std::string& msg); + 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 0000000000000000000000000000000000000000..8639e37cd28baa40bd6c84a14ecdfafb2b6245e3 --- /dev/null +++ b/tooling/static/inspector_server.cpp @@ -0,0 +1,1080 @@ +/** + * 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(const std::string& msg) +{ + server_.Run(msg); +} + +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, 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()); + 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, isNew] = sourceManager_.GetScriptId(sourceFile); + + if (isNew) { + CallDebuggerScriptParsed(scriptId, 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 0000000000000000000000000000000000000000..f6236e6adb4fee3b9b4d805fb76e72ec1a8696ce --- /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 "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(const std::string& msg); + + 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 0000000000000000000000000000000000000000..0d2105bdab8fbb16e2234308fe59eeab4fa5398f --- /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 0000000000000000000000000000000000000000..e024c97dff71d36c376f6d63962d8656fbd3d870 --- /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 0000000000000000000000000000000000000000..4cf3ba93a4232803751412d7f45e5e5234557201 --- /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 0000000000000000000000000000000000000000..168be28fbfe9e87d07c0786be1fa3fdbc92e626f --- /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 0000000000000000000000000000000000000000..8c724dbc92d7a31d24cc7526e9c4f6d940e56a80 --- /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 0000000000000000000000000000000000000000..670197d5b8991f865bf04ef84406f2e6b66dbc12 --- /dev/null +++ b/tooling/static/source_manager.cpp @@ -0,0 +1,54 @@ +/** + * 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 { +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, isNewForThread}; +} + +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 0000000000000000000000000000000000000000..dd7a348aab35c2c63e0204e125ab96e93c3ca4d9 --- /dev/null +++ b/tooling/static/source_manager.h @@ -0,0 +1,51 @@ +/** + * 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); + + 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 + +#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 0000000000000000000000000000000000000000..baa35773f164e8d774a2e4904f6300f09c42eafe --- /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 0000000000000000000000000000000000000000..4608bedef2b9f4a493b894527b0de73b3d23b104 --- /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 0000000000000000000000000000000000000000..57906985c6e538e265e6fb1aa7b7bd685ee29dce --- /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, true); + + 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 0000000000000000000000000000000000000000..9eeefa86112a973b994ea2b89bca241c0659070e --- /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 0000000000000000000000000000000000000000..6e8a68f2ebc382dbce2d2508779659d6c4ea082e --- /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 0000000000000000000000000000000000000000..e6fb9bcf8464caf7891bc9e6382e1e9069251b17 --- /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 0000000000000000000000000000000000000000..84b89f63496a5edecf96ab128eff73f42351c160 --- /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 0000000000000000000000000000000000000000..278f8aba5b7003eabf715bc2825bf543dffb015d --- /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 0000000000000000000000000000000000000000..47aae4b510b27768c0a0af687b76d7782879ed5d --- /dev/null +++ b/tooling/static/tests/source_manager.cpp @@ -0,0 +1,94 @@ +/** + * 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.first, ScriptId(0)); + ASSERT_EQ(test_id0.second, true); + + 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.first, ScriptId(0)); + ASSERT_EQ(test_id0.second, false); + + auto test_id1 = sm_.GetScriptId("test1.pa"); + 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.first), "test2.pa"); + ASSERT_EQ(sm_.GetSourceFileName(test_id3.first), "test3.pa"); + + ASSERT_EQ(sm_.GetSourceFileName(ScriptId(5U)), ""); + + 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 0000000000000000000000000000000000000000..74160a6513004edb0568316380ed5a8fbbab4efb --- /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 0000000000000000000000000000000000000000..025e7926fcee092010d13882d5a309787b99c436 --- /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 0000000000000000000000000000000000000000..a9c5c7e41ab85918a9c22a2f7cadcf74bdc5e295 --- /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 0000000000000000000000000000000000000000..3a4090c4db02a3584ad2b0781834a8733bca3e5a --- /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 0000000000000000000000000000000000000000..d1242a2cbd8cbbd34882e1593d4a9a0925790386 --- /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 0000000000000000000000000000000000000000..4fb58ddf1eff02ca88340be9878a614490258612 --- /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 0000000000000000000000000000000000000000..7a846714132a823dd4b1f5081e6509d13ade810f --- /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 0000000000000000000000000000000000000000..1e2c6efcbbc51b2ac6811d3a6253b86258f0e643 --- /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 0000000000000000000000000000000000000000..0f40ea45763caa383f9caa2edc45ba3c159852f5 --- /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 "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 0000000000000000000000000000000000000000..ab41461579ce52f6cb30e4586edfe55cbeead2fd --- /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 0000000000000000000000000000000000000000..24edac0136389e87cba6be595b7983fc6616b986 --- /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 "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 0000000000000000000000000000000000000000..3f6fbde9a907298da615f8c68197112f7d7f78c2 --- /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 0000000000000000000000000000000000000000..44083977076c7ee1cc995b5f3c629c118d4f811a --- /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 "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 0000000000000000000000000000000000000000..53f5c5f5f2ac13c30e111adbb0d02f05b83acaf3 --- /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 0000000000000000000000000000000000000000..8561d65dbf0eb0a5ddd670c24c8846a082f14307 --- /dev/null +++ b/tooling/static/types/object_preview.cpp @@ -0,0 +1,98 @@ +/** + * 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 "types/object_preview.h" +#include "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 0000000000000000000000000000000000000000..97b6042d231c5795b1e97d8e7f58ca360dddb7ec --- /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 0000000000000000000000000000000000000000..e21f960ee53cd9ebe87367aaf7d7d3c75cadaa40 --- /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 0000000000000000000000000000000000000000..582716f47a7d21b5f51b7243619377d2c79cb4af --- /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 "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 0000000000000000000000000000000000000000..c41395bc1fb75849dbd90816c17347e75761138b --- /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 0000000000000000000000000000000000000000..f03de7aca23f5974ab06a67378cea0aef539700b --- /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 0000000000000000000000000000000000000000..2be39438269c4181acd912312e7c4a496a7f907c --- /dev/null +++ b/tooling/static/types/property_descriptor.h @@ -0,0 +1,138 @@ +/** + * 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_PROPERTY_DESCRIPTOR_H +#define PANDA_TOOLING_INSPECTOR_TYPES_PROPERTY_DESCRIPTOR_H + +#include "macros.h" + +#include "types/remote_object.h" +#include "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 0000000000000000000000000000000000000000..2d32aae53f8b9bf9be865f0b1012003511e6a4f9 --- /dev/null +++ b/tooling/static/types/property_preview.h @@ -0,0 +1,55 @@ +/** + * 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_TYPES_PROPERTY_PREVIEW_H +#define PANDA_TOOLING_INSPECTOR_TYPES_PROPERTY_PREVIEW_H + +#include "types/remote_object_type.h" +#include "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 0000000000000000000000000000000000000000..508e4dc9673e6e061c7fd82d9f507f0c3f4a1675 --- /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 0000000000000000000000000000000000000000..135834449a35137c0da3f72212f54ed9de77faa0 --- /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 0000000000000000000000000000000000000000..9cc9790465d791359bcb78c522d8c86303caf9e9 --- /dev/null +++ b/tooling/static/types/remote_object_type.h @@ -0,0 +1,87 @@ +/** + * 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_TYPES_REMOTE_OBJECT_TYPE_H +#define PANDA_TOOLING_INSPECTOR_TYPES_REMOTE_OBJECT_TYPE_H + +#include "utils/json_builder.h" +#include "types/numeric_id.h" +#include "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 0000000000000000000000000000000000000000..200baf93911217efe03999c39954c81adff54dc9 --- /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 0000000000000000000000000000000000000000..6800d258c02b32a77d71d3ad8b06a8afe030a763 --- /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 0000000000000000000000000000000000000000..32c4486ed6baaf2eb6cb939b8c59e6895657c354 --- /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 "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 0000000000000000000000000000000000000000..1f147984808496ef4b7129e67c156ce08fb5124a --- /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 0000000000000000000000000000000000000000..35074ecfb3307e47f2849a3bc9705046b21dc6f3 --- /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 0000000000000000000000000000000000000000..56e423cff7c0954fc156c6b2acb258447b0237f1 --- /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 0000000000000000000000000000000000000000..9985a820b1f6fe19ccafc9e1147a0352095a9ebd --- /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 "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 08f500330f6bc7e196b01fc27b91810212b90717..6a6f4fc865aba0e08bd7d61ea21004902a3dca6d 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 diff --git a/websocket/websocket_base.cpp b/websocket/websocket_base.cpp index 0e607f2091c08fefd2f131fdaad38954a7e28234..9025005e8180a90c0c7855cbfd56517329774af8 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;