1e509ee18Sopenharmony_ci/*
2e509ee18Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
3e509ee18Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4e509ee18Sopenharmony_ci * you may not use this file except in compliance with the License.
5e509ee18Sopenharmony_ci * You may obtain a copy of the License at
6e509ee18Sopenharmony_ci *
7e509ee18Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8e509ee18Sopenharmony_ci *
9e509ee18Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10e509ee18Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11e509ee18Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12e509ee18Sopenharmony_ci * See the License for the specific language governing permissions and
13e509ee18Sopenharmony_ci * limitations under the License.
14e509ee18Sopenharmony_ci */
15e509ee18Sopenharmony_ci
16e509ee18Sopenharmony_ci#ifndef ECMASCRIPT_TOOLING_CLIENT_DOMAIN_DEBUGGER_CLIENT_H
17e509ee18Sopenharmony_ci#define ECMASCRIPT_TOOLING_CLIENT_DOMAIN_DEBUGGER_CLIENT_H
18e509ee18Sopenharmony_ci
19e509ee18Sopenharmony_ci#include <iostream>
20e509ee18Sopenharmony_ci#include <vector>
21e509ee18Sopenharmony_ci
22e509ee18Sopenharmony_ci#include "tooling/base/pt_json.h"
23e509ee18Sopenharmony_ci
24e509ee18Sopenharmony_ciusing PtJson = panda::ecmascript::tooling::PtJson;
25e509ee18Sopenharmony_ciusing Result = panda::ecmascript::tooling::Result;
26e509ee18Sopenharmony_cinamespace OHOS::ArkCompiler::Toolchain {
27e509ee18Sopenharmony_cistruct BreakPointInfo {
28e509ee18Sopenharmony_ci    int lineNumber;
29e509ee18Sopenharmony_ci    int columnNumber;
30e509ee18Sopenharmony_ci    std::string url;
31e509ee18Sopenharmony_ci};
32e509ee18Sopenharmony_ciclass DebuggerClient final {
33e509ee18Sopenharmony_cipublic:
34e509ee18Sopenharmony_ci    DebuggerClient(int32_t sessionId) : sessionId_(sessionId) {}
35e509ee18Sopenharmony_ci    ~DebuggerClient() = default;
36e509ee18Sopenharmony_ci
37e509ee18Sopenharmony_ci    bool DispatcherCmd(const std::string &cmd);
38e509ee18Sopenharmony_ci    int BreakCommand();
39e509ee18Sopenharmony_ci    int BacktrackCommand();
40e509ee18Sopenharmony_ci    int DeleteCommand();
41e509ee18Sopenharmony_ci    int DisableCommand();
42e509ee18Sopenharmony_ci    int DisplayCommand();
43e509ee18Sopenharmony_ci    int EnableCommand();
44e509ee18Sopenharmony_ci    int FinishCommand();
45e509ee18Sopenharmony_ci    int FrameCommand();
46e509ee18Sopenharmony_ci    int IgnoreCommand();
47e509ee18Sopenharmony_ci    int InfobreakpointsCommand();
48e509ee18Sopenharmony_ci    int InfosourceCommand();
49e509ee18Sopenharmony_ci    int JumpCommand();
50e509ee18Sopenharmony_ci    int NextCommand();
51e509ee18Sopenharmony_ci    int ListCommand();
52e509ee18Sopenharmony_ci    int PtypeCommand();
53e509ee18Sopenharmony_ci    int RunCommand();
54e509ee18Sopenharmony_ci    int SetvarCommand();
55e509ee18Sopenharmony_ci    int StepCommand();
56e509ee18Sopenharmony_ci    int UndisplayCommand();
57e509ee18Sopenharmony_ci    int WatchCommand();
58e509ee18Sopenharmony_ci    int ResumeCommand();
59e509ee18Sopenharmony_ci    int StepIntoCommand();
60e509ee18Sopenharmony_ci    int StepOutCommand();
61e509ee18Sopenharmony_ci    int StepOverCommand();
62e509ee18Sopenharmony_ci
63e509ee18Sopenharmony_ci    void AddBreakPointInfo(const std::string& url, const int& lineNumber, const int& columnNumber = 0);
64e509ee18Sopenharmony_ci    void RecvReply(std::unique_ptr<PtJson> json);
65e509ee18Sopenharmony_ci    void PausedReply(const std::unique_ptr<PtJson> json);
66e509ee18Sopenharmony_ci    void handleResponse(std::unique_ptr<PtJson> json);
67e509ee18Sopenharmony_ci
68e509ee18Sopenharmony_ciprivate:
69e509ee18Sopenharmony_ci    std::vector<BreakPointInfo> breakPointInfoList_ {};
70e509ee18Sopenharmony_ci    int32_t sessionId_;
71e509ee18Sopenharmony_ci};
72e509ee18Sopenharmony_ci} // OHOS::ArkCompiler::Toolchain
73e509ee18Sopenharmony_ci#endif