1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
---|---|
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef DEBUGMANAGER_H |
6 | #define DEBUGMANAGER_H |
7 | |
8 | #include "debuggerglobals.h" |
9 | #include "interface/stackframemodel.h" |
10 | #include "interface/localtreemodel.h" |
11 | #include "interface/variable.h" |
12 | #include "interface/breakpointmodel.h" |
13 | #include "dap/dapdebugger.h" |
14 | #include "runner/runner.h" |
15 | #include "base/abstractdebugger.h" |
16 | |
17 | #include <QTreeView> |
18 | #include <QSharedPointer> |
19 | #include <QObject> |
20 | |
21 | class AppOutputPane; |
22 | class StackFrameView; |
23 | class MenuManager; |
24 | namespace dpfservice { |
25 | class WindowService; |
26 | class DebuggerService; |
27 | } |
28 | class DebugManager : public QObject |
29 | { |
30 | Q_OBJECT |
31 | public: |
32 | explicit DebugManager(QObject *parent = nullptr); |
33 | bool initialize(dpfservice::WindowService *windowService, |
34 | dpfservice::DebuggerService *debuggerService); |
35 | QWidget *getStackPane() const; |
36 | QWidget *getLocalsPane() const; |
37 | QWidget *getBreakpointPane() const; |
38 | void registerDebugger(const QString &kit, AbstractDebugger *debugger); |
39 | |
40 | signals: |
41 | void debugStarted(); |
42 | |
43 | public slots: |
44 | /** |
45 | * UI triggered. |
46 | */ |
47 | void run(); |
48 | void detachDebug(); |
49 | |
50 | void interruptDebug(); |
51 | void continueDebug(); |
52 | void abortDebug(); |
53 | void restartDebug(); |
54 | |
55 | void stepOver(); |
56 | void stepIn(); |
57 | void stepOut(); |
58 | |
59 | void handleRunStateChanged(AbstractDebugger::RunState state); |
60 | void handleEvents(const dpf::Event &event); |
61 | |
62 | private: |
63 | bool runCoredump(const QString &target, const QString &core, const QString &kit); |
64 | |
65 | QMap<QString, AbstractDebugger *> debuggers; |
66 | AbstractDebugger *currentDebugger = nullptr; |
67 | Runner *runner = nullptr; |
68 | QProcess backend; |
69 | QString activeProjectKitName; |
70 | |
71 | QSharedPointer<MenuManager> menuManager; |
72 | }; |
73 | |
74 | #endif // DEBUGMANAGER_H |
75 |