File indexing completed on 2024-04-28 04:38:36
0001 /* 0002 SPDX-FileCopyrightText: 2007 Hamish Rodda <rodda@kde.org> 0003 SPDX-FileCopyrightText: 2008 Vladimir Prus <ghost@cs.msu.su> 0004 SPDX-FileCopyrightText: 2009 Niko Sams <niko.sams@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef MIVARIABLECONTROLLER_H 0010 #define MIVARIABLECONTROLLER_H 0011 0012 #include "dbgglobal.h" 0013 0014 #include <debugger/interfaces/ivariablecontroller.h> 0015 0016 namespace KDevMI { 0017 0018 namespace MI { 0019 struct AsyncRecord; 0020 struct ResultRecord; 0021 struct Value; 0022 } 0023 0024 class MIDebugSession; 0025 class MIVariableController : public KDevelop::IVariableController 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 explicit MIVariableController( MIDebugSession* parent); 0031 0032 KDevelop::Variable* createVariable(KDevelop::TreeModel* model, KDevelop::TreeItem* parent, 0033 const QString& expression, 0034 const QString& display = {}) override; 0035 0036 KTextEditor::Range expressionRangeUnderCursor(KTextEditor::Document* doc, 0037 const KTextEditor::Cursor& cursor) override; 0038 0039 void addWatch(KDevelop::Variable* variable) override; 0040 void addWatchpoint(KDevelop::Variable* variable) override; 0041 void update() override; 0042 0043 protected: 0044 void updateLocals(); 0045 0046 private Q_SLOTS: 0047 void programStopped(const MI::AsyncRecord &r); 0048 void stateChanged(KDevelop::IDebugSession::DebuggerState); 0049 0050 private: 0051 MIDebugSession* debugSession() const; 0052 0053 0054 void handleVarUpdate(const MI::ResultRecord& r); 0055 void addWatch(const MI::ResultRecord& r); 0056 void addWatchpoint(const MI::ResultRecord& r); 0057 0058 void handleEvent(KDevelop::IDebugSession::event_t event) override; 0059 }; 0060 0061 } // end of namespace KDevMI 0062 0063 #endif // MIVARIABLECONTROLLER_H