File indexing completed on 2024-04-28 04:37:15
0001 /* 0002 SPDX-FileCopyrightText: 1999-2001 John Birch <jbb@kdevelop.org> 0003 SPDX-FileCopyrightText: 2001 Bernd Gehrmann <bernd@kdevelop.org> 0004 SPDX-FileCopyrightText: 2007 Hamish Rodda <rodda@kde.org> 0005 SPDX-FileCopyrightText: 2009 Niko Sams <niko.sams@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef KDEVPLATFORM_DEBUGCONTROLLER_H 0011 #define KDEVPLATFORM_DEBUGCONTROLLER_H 0012 0013 #include <QPointer> 0014 0015 #include <KXMLGUIClient> 0016 0017 #include "../interfaces/idebugcontroller.h" 0018 #include "../debugger/interfaces/idebugsession.h" 0019 0020 class QAction; 0021 0022 namespace Sublime { 0023 class Area; 0024 } 0025 0026 namespace KTextEditor { 0027 class Document; 0028 } 0029 0030 namespace KDevelop { 0031 class Context; 0032 class ContextMenuExtension; 0033 class IDocument; 0034 0035 class DebugController : public IDebugController, public KXMLGUIClient 0036 { 0037 Q_OBJECT 0038 public: 0039 explicit DebugController(QObject *parent = nullptr); 0040 ~DebugController() override; 0041 void initialize(); 0042 void cleanup(); 0043 0044 /// Must be called by debugger plugin that needs debugger actions and tool views. 0045 void initializeUi() override; 0046 0047 void addSession(IDebugSession* session) override; 0048 IDebugSession* currentSession() override; 0049 0050 ContextMenuExtension contextMenuExtension(Context* context, QWidget* parent); 0051 0052 BreakpointModel* breakpointModel() override; 0053 VariableCollection* variableCollection() override; 0054 0055 private Q_SLOTS: 0056 //void restartDebugger(); 0057 void stopDebugger(); 0058 void interruptDebugger(); 0059 void run(); 0060 void runToCursor(); 0061 void jumpToCursor(); 0062 void stepOver(); 0063 void stepIntoInstruction(); 0064 void stepInto(); 0065 void stepOverInstruction(); 0066 void stepOut(); 0067 void toggleBreakpoint(); 0068 void showCurrentLine(); 0069 0070 void debuggerStateChanged(KDevelop::IDebugSession::DebuggerState state); 0071 void showStepInSource(const QUrl &file, int line); 0072 void clearExecutionPoint(); 0073 0074 void textDocumentCreated(KDevelop::IDocument* document); 0075 void areaChanged(Sublime::Area* newArea); 0076 0077 Q_SIGNALS: 0078 void raiseFramestackViews(); 0079 void killAllDebuggersNow(); 0080 0081 private: 0082 void setupActions(); 0083 void updateDebuggerState(KDevelop::IDebugSession::DebuggerState state, KDevelop::IDebugSession* session); 0084 void setContinueStartsDebug(bool startsDebug); 0085 0086 static const QPixmap* executionPointPixmap(); 0087 0088 QAction* m_continueDebugger = nullptr; 0089 //QAction* m_restartDebugger; 0090 QAction* m_stopDebugger = nullptr; 0091 QAction* m_interruptDebugger = nullptr; 0092 QAction* m_runToCursor = nullptr; 0093 QAction* m_jumpToCursor = nullptr; 0094 QAction* m_stepOver = nullptr; 0095 QAction* m_stepIntoInstruction = nullptr; 0096 QAction* m_stepInto = nullptr; 0097 QAction* m_stepOverInstruction = nullptr; 0098 QAction* m_stepOut = nullptr; 0099 QAction* m_toggleBreakpoint = nullptr; 0100 QAction* m_showCurrentLine = nullptr; 0101 0102 QPointer<IDebugSession> m_currentSession; 0103 BreakpointModel *m_breakpointModel; 0104 VariableCollection *m_variableCollection; 0105 0106 QPointer<KTextEditor::Document> m_lastExecMarkDocument; 0107 /** 0108 * A line number to which the execution mark was last added. 0109 * The execution mark may no longer be at this line number if the document is modified after the adding. 0110 * This line number is meaningless if @a m_lastExecMarkDocument is null. 0111 */ 0112 int m_lastExecMarkLine = -1; 0113 0114 bool m_uiInitialized = false; 0115 }; 0116 0117 } 0118 0119 #endif