Changeset View
Changeset View
Standalone View
Standalone View
debuggers/gdb/debuggerplugin.h
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * GDB Debugger Support | 2 | * GDB Debugger Support | ||
3 | * Copyright 2016 Aetf <aetf@unlimitedcodeworks.xyz> | ||||
3 | * | 4 | * | ||
4 | * Copyright 1999-2001 John Birch <jbb@kdevelop.org> | 5 | * This program is free software; you can redistribute it and/or | ||
5 | * Copyright 2001 by Bernd Gehrmann <bernd@kdevelop.org> | 6 | * modify it under the terms of the GNU General Public License as | ||
6 | * Copyright 2007 Hamish Rodda <rodda@kde.org> | 7 | * published by the Free Software Foundation; either version 2 of | ||
7 | * | 8 | * the License or (at your option) version 3 or any later version | ||
8 | * This program is free software; you can redistribute it and/or modify | 9 | * accepted by the membership of KDE e.V. (or its successor approved | ||
9 | * it under the terms of the GNU General Public License as | 10 | * by the membership of KDE e.V.), which shall act as a proxy | ||
10 | * published by the Free Software Foundation; either version 2 of the | 11 | * defined in Section 14 of version 3 of the license. | ||
11 | * License, or (at your option) any later version. | | |||
12 | * | 12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. | ||
17 | * | 17 | * | ||
18 | * You should have received a copy of the GNU General Public | 18 | * You should have received a copy of the GNU General Public License | ||
19 | * License along with this program; if not, write to the | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | * Free Software Foundation, Inc., | 20 | * | ||
21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | | |||
22 | */ | 21 | */ | ||
23 | 22 | | |||
24 | #ifndef _DEBUGGERPART_H_ | 23 | #ifndef _DEBUGGERPART_H_ | ||
25 | #define _DEBUGGERPART_H_ | 24 | #define _DEBUGGERPART_H_ | ||
26 | 25 | | |||
27 | #include <QByteArray> | 26 | #include <QByteArray> | ||
28 | #include <QLabel> | 27 | #include <QLabel> | ||
29 | #include <QtCore/QVariant> | 28 | #include <QtCore/QVariant> | ||
30 | 29 | | |||
31 | #include <KConfigGroup> | 30 | #include <KConfigGroup> | ||
32 | #include <KTextEditor/Cursor> | 31 | #include <KTextEditor/Cursor> | ||
33 | #include <QUrl> | 32 | #include <QUrl> | ||
34 | 33 | | |||
35 | #include <interfaces/iplugin.h> | 34 | #include <interfaces/iplugin.h> | ||
36 | #include <interfaces/istatus.h> | 35 | #include <interfaces/istatus.h> | ||
37 | 36 | | |||
37 | #include "midebuggerplugin.h" | ||||
38 | #include "debugsession.h" | ||||
39 | | ||||
38 | class QLabel; | 40 | class QLabel; | ||
39 | class QMenu; | 41 | class QMenu; | ||
40 | class QDBusInterface; | 42 | class QDBusInterface; | ||
41 | class QSignalMapper; | 43 | class QSignalMapper; | ||
42 | class ProcessWidget; | 44 | class ProcessWidget; | ||
43 | 45 | | |||
44 | class KToolBar; | 46 | class KToolBar; | ||
45 | class QAction; | 47 | class QAction; | ||
46 | 48 | | |||
47 | namespace KDevelop { | 49 | namespace KDevelop { | ||
48 | class Context; | 50 | class Context; | ||
49 | class ProcessLineMaker; | 51 | class ProcessLineMaker; | ||
50 | } | 52 | } | ||
51 | 53 | | |||
52 | namespace KDevMI { | 54 | namespace KDevMI { | ||
53 | namespace GDB | 55 | namespace GDB | ||
54 | { | 56 | { | ||
55 | class DisassembleWidget; | 57 | class DisassembleWidget; | ||
56 | class Breakpoint; | | |||
57 | class GDBOutputWidget; | 58 | class GDBOutputWidget; | ||
58 | class MemoryViewerWidget; | 59 | class MemoryViewerWidget; | ||
59 | class DebugSession; | | |||
60 | template<typename T> class DebuggerToolFactory; | | |||
61 | 60 | | |||
62 | class CppDebuggerPlugin : public KDevelop::IPlugin, public KDevelop::IStatus | 61 | class CppDebuggerPlugin : public MIDebuggerPlugin | ||
63 | { | 62 | { | ||
64 | Q_OBJECT | 63 | Q_OBJECT | ||
65 | Q_INTERFACES(KDevelop::IStatus) | | |||
66 | 64 | | |||
67 | public: | 65 | public: | ||
68 | friend class DebugSession; | 66 | friend class DebugSession; | ||
69 | 67 | | |||
70 | CppDebuggerPlugin( QObject *parent, const QVariantList & = QVariantList() ); | 68 | CppDebuggerPlugin(QObject *parent, const QVariantList & = QVariantList()); | ||
71 | ~CppDebuggerPlugin() override; | 69 | ~CppDebuggerPlugin() override; | ||
72 | 70 | | |||
71 | DebugSession *createSession() const override; | ||||
73 | void unload() override; | 72 | void unload() override; | ||
74 | 73 | | |||
75 | KDevelop::ContextMenuExtension contextMenuExtension( KDevelop::Context* ) override; | | |||
76 | | ||||
77 | DebugSession *createSession(); | | |||
78 | | ||||
79 | public: | | |||
80 | //BEGIN IStatus | | |||
81 | QString statusName() const override; | | |||
82 | | ||||
83 | Q_SIGNALS: | | |||
84 | void clearMessage(KDevelop::IStatus*) override; | | |||
85 | void showMessage(KDevelop::IStatus*, const QString & message, int timeout = 0) override; | | |||
86 | void hideProgress(KDevelop::IStatus*) override; | | |||
87 | void showProgress(KDevelop::IStatus*, int minimum, int maximum, int value) override; | | |||
88 | void showErrorMessage(const QString&, int) override; | | |||
89 | //END IStatus | | |||
90 | | ||||
91 | void addWatchVariable(const QString& variable); | | |||
92 | void evaluateExpression(const QString& variable); | | |||
93 | | ||||
94 | void raiseGdbConsoleViews(); | | |||
95 | | ||||
96 | void reset(); | | |||
97 | | ||||
98 | private Q_SLOTS: | | |||
99 | void setupDBus(); | | |||
100 | void slotDebugExternalProcess(QObject* interface); | | |||
101 | void contextEvaluate(); | | |||
102 | void contextWatch(); | | |||
103 | | ||||
104 | void slotExamineCore(); | | |||
105 | #ifdef KDEV_ENABLE_GDB_ATTACH_DIALOG | | |||
106 | void slotAttachProcess(); | | |||
107 | #endif | | |||
108 | | ||||
109 | void slotDBusServiceRegistered(const QString& service); | | |||
110 | void slotDBusServiceUnregistered(const QString& service); | | |||
111 | | ||||
112 | void slotCloseDrKonqi(); | | |||
113 | | ||||
114 | void slotFinished(); | | |||
115 | | ||||
116 | void controllerMessage(const QString&, int); | | |||
117 | | ||||
118 | Q_SIGNALS: | | |||
119 | //TODO: port to launch framework | | |||
120 | //void startDebugger(const KDevelop::IRun & run, KJob* job); | | |||
121 | void stopDebugger(); | | |||
122 | void attachTo(int pid); | | |||
123 | void coreFile(const QString& core); | | |||
124 | void runUntil(const QUrl &url, int line); | | |||
125 | void jumpTo(const QUrl &url, int line); | | |||
126 | | ||||
127 | protected: | | |||
128 | void initializeGuiState() override; | | |||
129 | | ||||
130 | private: | 74 | private: | ||
131 | KConfigGroup config() const; | 75 | void setupToolviews(); | ||
132 | 76 | | |||
133 | void attachProcess(int pid); | 77 | private: | ||
134 | void setupActions(); | 78 | DebuggerToolFactory<DisassembleWidget, CppDebuggerPlugin>* disassemblefactory; | ||
135 | 79 | DebuggerToolFactory<GDBOutputWidget, CppDebuggerPlugin>* gdbfactory; | |||
136 | QHash<QString, QDBusInterface*> m_drkonqis; | 80 | DebuggerToolFactory<MemoryViewerWidget, CppDebuggerPlugin>* memoryviewerfactory; | ||
137 | QSignalMapper* m_drkonqiMap; | | |||
138 | QString m_drkonqi; | | |||
139 | | ||||
140 | QString m_contextIdent; | | |||
141 | | ||||
142 | KConfigGroup m_config; | | |||
143 | | ||||
144 | DebuggerToolFactory< DisassembleWidget >* disassemblefactory; | | |||
145 | DebuggerToolFactory< GDBOutputWidget >* gdbfactory; | | |||
146 | DebuggerToolFactory< MemoryViewerWidget >* memoryviewerfactory; | | |||
147 | }; | 81 | }; | ||
148 | 82 | | |||
149 | } // end of namespace GDB | 83 | } // end of namespace GDB | ||
150 | } // end of namespace KDevMI | 84 | } // end of namespace KDevMI | ||
151 | 85 | | |||
152 | #endif | 86 | #endif |