| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
|---|---|
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef DAPSESSION_H |
| 6 | #define DAPSESSION_H |
| 7 | |
| 8 | #include "serverinfo.h" |
| 9 | |
| 10 | #include "dap/session.h" |
| 11 | #include "dap/protocol.h" |
| 12 | #include "dap/network.h" |
| 13 | |
| 14 | #include <QObject> |
| 15 | |
| 16 | class DapSessionPrivate; |
| 17 | class DapSession : public QObject |
| 18 | { |
| 19 | Q_OBJECT |
| 20 | public: |
| 21 | explicit DapSession(QObject *parent = nullptr); |
| 22 | virtual ~DapSession(); |
| 23 | |
| 24 | bool start(); |
| 25 | void stop(); |
| 26 | |
| 27 | signals: |
| 28 | void sigSendToClient(const QString &uuid, int port, const QString &kit, const QMap<QString, QVariant> ¶m); |
| 29 | |
| 30 | public slots: |
| 31 | void initialize(std::shared_ptr<dap::ReaderWriter>); |
| 32 | void slotReceiveClientInfo(const QString &uuid, const QString &kit, const QString &targetPath, const QStringList &arguments); |
| 33 | |
| 34 | private: |
| 35 | void initializeDebugMgr(); |
| 36 | void registerHanlder(); |
| 37 | void registerDBusConnect(); |
| 38 | |
| 39 | void handleOutputTextEvent(const QStringList &textList); |
| 40 | void handleStreamConsole(const QString &text); |
| 41 | void handleAsyncStopped(const dap::StoppedEvent &stoppedevent); |
| 42 | void handleAsyncExited(const dap::ExitedEvent &exitedEvent); |
| 43 | void handleLibraryLoaded(const dap::ModuleEvent &moduleEvent); |
| 44 | void handleLibraryUnloaded(const dap::ModuleEvent &moduleEvent); |
| 45 | void handleThreadExited(const int threadId, const QString &groupId); |
| 46 | void handleTerminateEvent(); |
| 47 | void handleAssembleData(const QStringList &data); |
| 48 | |
| 49 | dap::SetBreakpointsResponse handleBreakpointReq(const dap::SetBreakpointsRequest &request); |
| 50 | dap::InitializeResponse handleInitializeReq(const dap::InitializeRequest &request); |
| 51 | |
| 52 | DapSessionPrivate *const d; |
| 53 | }; |
| 54 | |
| 55 | #endif // DAPSESSION_H |
| 56 |