• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2025 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 PANDA_DEBUGGER_ARKAPI_H
17 #define PANDA_DEBUGGER_ARKAPI_H
18 
19 #include <string>
20 #include <functional>
21 
22 #include <dlfcn.h>
23 #include "libpandabase/macros.h"
24 
25 using DebuggerPostTask = std::function<void(std::function<void()> &&)>;
26 
27 namespace ark {
28 class PANDA_PUBLIC_API ArkDebugNativeAPI final {
29 public:
30     using DebuggerPostTask = std::function<void(std::function<void()> &&)>;
31     static bool StartDebuggerForSocketPair(int tid, int socketfd = -1);
32     static bool NotifyDebugMode(int tid, int32_t instanceId, bool debugApp, void *vm,
33                                 DebuggerPostTask &debuggerPostTask);
34     static bool StopDebugger(void *vm);
35     static bool IsDebugModeEnabled();
36 
37     ArkDebugNativeAPI() = delete;
38     ~ArkDebugNativeAPI() = delete;
39 
40     NO_COPY_SEMANTIC(ArkDebugNativeAPI);
41     NO_MOVE_SEMANTIC(ArkDebugNativeAPI);
42 
43 private:
44     static void *gHybridDebuggerHandle_;
45 };
46 
47 }  // namespace ark
48 
49 #endif  // PANDA_DEBUGGER_ARKAPI_H