Warning, file /utilities/kate/addons/gdbplugin/plugin_kategdb.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // 0002 // Description: Kate Plugin for GDB integration 0003 // 0004 // 0005 // SPDX-FileCopyrightText: 2010 Ian Wakeling <ian.wakeling@ntlworld.com> 0006 // SPDX-FileCopyrightText: 2010-2014 Kåre Särs <kare.sars@iki.fi> 0007 // 0008 // SPDX-License-Identifier: LGPL-2.0-only 0009 0010 #pragma once 0011 0012 #include <QPointer> 0013 0014 #include <KActionMenu> 0015 #include <KTextEditor/Application> 0016 #include <KTextEditor/MainWindow> 0017 #include <KTextEditor/Message> 0018 #include <KTextEditor/Plugin> 0019 #include <KTextEditor/SessionConfigInterface> 0020 #include <KXMLGUIClient> 0021 #include <optional> 0022 0023 #include "backend.h" 0024 #include "configview.h" 0025 #include "dap/entities.h" 0026 #include "ioview.h" 0027 #include "localsview.h" 0028 0029 class KHistoryComboBox; 0030 class QTextEdit; 0031 class QTreeWidget; 0032 0033 typedef QVariantList VariantList; 0034 0035 class KatePluginGDB : public KTextEditor::Plugin 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 explicit KatePluginGDB(QObject *parent = nullptr, const VariantList & = VariantList()); 0041 ~KatePluginGDB() override; 0042 0043 QObject *createView(KTextEditor::MainWindow *mainWindow) override; 0044 int configPages() const override; 0045 KTextEditor::ConfigPage *configPage(int number = 0, QWidget *parent = nullptr) override; 0046 void readConfig(); 0047 void writeConfig() const; 0048 0049 const QString m_settingsPath; 0050 const QUrl m_defaultConfigPath; 0051 QUrl m_configPath; 0052 QUrl configPath() const 0053 { 0054 return m_configPath.isEmpty() ? m_defaultConfigPath : m_configPath; 0055 } 0056 Q_SIGNALS: 0057 // Update for config 0058 void update() const; 0059 }; 0060 0061 class KatePluginGDBView : public QObject, public KXMLGUIClient, public KTextEditor::SessionConfigInterface 0062 { 0063 Q_OBJECT 0064 Q_INTERFACES(KTextEditor::SessionConfigInterface) 0065 0066 public: 0067 KatePluginGDBView(KatePluginGDB *plugin, KTextEditor::MainWindow *mainWin); 0068 ~KatePluginGDBView() override; 0069 0070 // reimplemented: read and write session config 0071 void readSessionConfig(const KConfigGroup &config) override; 0072 void writeSessionConfig(KConfigGroup &config) override; 0073 0074 private Q_SLOTS: 0075 void slotDebug(); 0076 void slotRestart(); 0077 void slotToggleBreakpoint(); 0078 void slotMovePC(); 0079 void slotRunToCursor(); 0080 void slotGoTo(const QUrl &fileName, int lineNum); 0081 void slotValue(); 0082 0083 void aboutToShowMenu(); 0084 void slotBreakpointSet(const QUrl &file, int line); 0085 void slotBreakpointCleared(const QUrl &file, int line); 0086 void slotSendCommand(); 0087 void enableDebugActions(bool enable); 0088 void programEnded(); 0089 void gdbEnded(); 0090 0091 void insertStackFrame(int level, const QString &info); 0092 void stackFrameChanged(int level); 0093 void stackFrameSelected(); 0094 0095 void insertThread(const dap::Thread &thread, bool active); 0096 void threadSelected(int thread); 0097 0098 void insertScopes(const QList<dap::Scope> &scopes, std::optional<int> activeId); 0099 void scopeSelected(int scope); 0100 0101 void showIO(bool show); 0102 void addOutput(const dap::Output &output); 0103 void addOutputText(QString const &text); 0104 void addErrorText(QString const &text); 0105 void clearMarks(); 0106 void handleEsc(QEvent *e); 0107 void enableBreakpointMarks(KTextEditor::Document *document); 0108 0109 protected: 0110 bool eventFilter(QObject *obj, QEvent *ev) override; 0111 0112 private: 0113 QString currentWord(); 0114 0115 void displayMessage(const QString &message, KTextEditor::Message::MessageType level); 0116 QToolButton *createDebugButton(QAction *action); 0117 0118 KTextEditor::Application *m_kateApplication; 0119 KTextEditor::MainWindow *m_mainWin; 0120 std::unique_ptr<QWidget> m_toolView; 0121 std::unique_ptr<QWidget> m_localsStackToolView; 0122 QTabWidget *m_tabWidget; 0123 QTextEdit *m_outputArea; 0124 KHistoryComboBox *m_inputArea; 0125 QWidget *m_gdbPage; 0126 QComboBox *m_scopeCombo; 0127 QComboBox *m_threadCombo; 0128 int m_activeThread; 0129 QTreeWidget *m_stackTree; 0130 QString m_lastCommand; 0131 Backend *m_debugView; 0132 ConfigView *m_configView; 0133 std::unique_ptr<IOView> m_ioView; 0134 LocalsView *m_localsView; 0135 QPointer<KActionMenu> m_menu; 0136 QAction *m_breakpoint; 0137 QUrl m_lastExecUrl; 0138 int m_lastExecLine; 0139 int m_lastExecFrame; 0140 bool m_focusOnInput; 0141 QPointer<KTextEditor::Message> m_infoMessage; 0142 0143 //Debug buttons 0144 QWidget *m_buttonWidget; 0145 QToolButton *m_continueButton; 0146 };