File indexing completed on 2024-04-28 08:27:09

0001 /*
0002  * XDebug Debugger Support
0003  *
0004  * Copyright 2007 Hamish Rodda <rodda@kde.org>
0005  * Copyright 2008 Vladimir Prus <ghost@cs.msu.su>
0006  * Copyright 2009 Niko Sams <niko.sams@gmail.com>
0007  *
0008  * This program is free software; you can redistribute it and/or modify
0009  * it under the terms of the GNU General Public License as
0010  * published by the Free Software Foundation; either version 2 of the
0011  * License, or (at your option) any later version.
0012  *
0013  * This program is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016  * GNU General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU General Public
0019  * License along with this program; if not, write to the
0020  * Free Software Foundation, Inc.,
0021  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0022  */
0023 
0024 #ifndef XDEBUG_VARIABLECONTROLLER_H
0025 #define XDEBUG_VARIABLECONTROLLER_H
0026 
0027 #include <debugger/interfaces/ivariablecontroller.h>
0028 
0029 class QDomDocument;
0030 namespace KDevelop {
0031 class Locals;
0032 }
0033 
0034 namespace XDebug {
0035 class Variable;
0036 class DebugSession;
0037 
0038 class VariableController
0039     : public KDevelop::IVariableController
0040 {
0041     Q_OBJECT
0042 
0043 public:
0044     VariableController(DebugSession* parent);
0045 
0046     KDevelop::Variable* createVariable(KDevelop::TreeModel* model, KDevelop::TreeItem* parent,
0047                                        const QString& expression,
0048                                        const QString& display = "") override;
0049     KTextEditor::Range expressionRangeUnderCursor(KTextEditor::Document* doc, const KTextEditor::Cursor& cursor) override;
0050 
0051     void addWatch(KDevelop::Variable* variable) override;
0052     void addWatchpoint(KDevelop::Variable* variable) override;
0053     void update() override;
0054 /*
0055    private slots:
0056     void programStopped(const GDBMI::ResultRecord &r);
0057  */
0058 
0059 private:
0060     DebugSession* debugSession() const;
0061 
0062     void updateLocals();
0063     void handleLocals(KDevelop::Locals* locals, const QDomDocument& xml);
0064     void handleContextNames(const QDomDocument& xml);
0065 
0066 /*
0067     void handleVarUpdate(const GDBMI::ResultRecord& r);
0068     void addWatch(const GDBMI::ResultRecord& r);
0069     void addWatchpoint(const GDBMI::ResultRecord& r);
0070  */
0071     void handleEvent(KDevelop::IDebugSession::event_t event) override;
0072 };
0073 }
0074 
0075 #endif // GDBDEBUGGER_VARIABLECONTROLLER_H