1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ECMASCRIPT_TOOLING_DEBUGGER_SERVICE_H 17 #define ECMASCRIPT_TOOLING_DEBUGGER_SERVICE_H 18 19 #include <functional> 20 #include <string> 21 22 #ifndef PANDA_TARGET_WINDOWS 23 #define TOOLCHAIN_EXPORT __attribute__((visibility ("default"))) 24 #else 25 #define TOOLCHAIN_EXPORT __declspec(dllexport) 26 #endif 27 28 namespace panda::ecmascript { 29 class EcmaVM; 30 } // namespace panda::ecmascript 31 32 namespace panda::ecmascript::tooling { 33 #ifdef __cplusplus 34 #if __cplusplus 35 extern "C" { 36 #endif 37 #endif /* End of #ifdef __cplusplus */ 38 39 TOOLCHAIN_EXPORT void InitializeDebugger(::panda::ecmascript::EcmaVM *vm, 40 const std::function<void(const void *, const std::string &)> &onResponse); 41 42 TOOLCHAIN_EXPORT void UninitializeDebugger(::panda::ecmascript::EcmaVM *vm); 43 44 TOOLCHAIN_EXPORT void OnMessage(const ::panda::ecmascript::EcmaVM *vm, std::string &&message); 45 46 TOOLCHAIN_EXPORT void WaitForDebugger(const ::panda::ecmascript::EcmaVM *vm); 47 48 TOOLCHAIN_EXPORT void ProcessMessage(const ::panda::ecmascript::EcmaVM *vm); 49 50 TOOLCHAIN_EXPORT int32_t GetDispatchStatus(const ::panda::ecmascript::EcmaVM *vm); 51 52 #ifdef __cplusplus 53 #if __cplusplus 54 } 55 #endif 56 #endif /* End of #ifdef __cplusplus */ 57 } // panda::ecmascript::tooling 58 59 #endif