Changeset View
Changeset View
Standalone View
Standalone View
debuggers/common/mivariable.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * MI based debugger specific Variable | ||||
3 | * | ||||
4 | * Copyright 2009 Vladimir Prus <ghost@cs.msu.su> | ||||
5 | * | ||||
6 | * This program is free software; you can redistribute it and/or modify | ||||
7 | * it under the terms of the GNU General Public License as | ||||
8 | * published by the Free Software Foundation; either version 2 of the | ||||
9 | * License, or (at your option) any later version. | ||||
10 | * | ||||
11 | * This program is distributed in the hope that it will be useful, | ||||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
14 | * GNU General Public License for more details. | ||||
15 | * | ||||
16 | * You should have received a copy of the GNU General Public | ||||
17 | * License along with this program; if not, write to the | ||||
18 | * Free Software Foundation, Inc., | ||||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
20 | */ | ||||
21 | | ||||
22 | #ifndef MIVARIABLE_H | ||||
23 | #define MIVARIABLE_H | ||||
24 | | ||||
25 | #include "mi/mi.h" | ||||
26 | | ||||
27 | #include <debugger/variable/variablecollection.h> | ||||
28 | | ||||
29 | #include <QMap> | ||||
30 | | ||||
31 | | ||||
32 | class CreateVarobjHandler; | ||||
33 | class FetchMoreChildrenHandler; | ||||
34 | namespace KDevMI { | ||||
35 | | ||||
36 | class MIVariable : public KDevelop::Variable | ||||
37 | { | ||||
38 | public: | ||||
39 | MIVariable(KDevelop::TreeModel* model, KDevelop::TreeItem* parent, | ||||
40 | const QString& expression, const QString& display = ""); | ||||
41 | | ||||
42 | ~MIVariable(); | ||||
43 | | ||||
44 | /* FIXME: should eventually remove, so that existance of | ||||
45 | varobjs is fully encapsulalated inside GdbVariable. */ | ||||
46 | const QString& varobj() const; | ||||
47 | void handleUpdate(const MI::Value& var); | ||||
48 | | ||||
49 | static MIVariable *findByVarobjName(const QString& varobjName); | ||||
50 | | ||||
51 | /* Called when debugger dies. Clears the association between varobj names | ||||
52 | and Variable instances. */ | ||||
53 | static void markAllDead(); | ||||
54 | | ||||
55 | bool canSetFormat() const override { return true; } | ||||
56 | | ||||
57 | private: // Variable overrides | ||||
58 | void attachMaybe(QObject *callback, const char *callbackMethod) override; | ||||
59 | void fetchMoreChildren() override; | ||||
60 | void formatChanged() override; | ||||
61 | | ||||
62 | private: // Internal | ||||
63 | friend class ::CreateVarobjHandler; | ||||
64 | friend class ::FetchMoreChildrenHandler; | ||||
65 | QString enquotedExpression() const; | ||||
66 | void setVarobj(const QString& v); | ||||
67 | QString varobj_; | ||||
68 | | ||||
69 | // How many children should be fetched in one | ||||
70 | // increment. | ||||
71 | static const int fetchStep = 5; | ||||
72 | | ||||
73 | /* Map from GDB varobj name to GdbVariable. | ||||
74 | FIXME: eventually, should be per-session map. */ | ||||
75 | static QMap<QString, MIVariable*> allVariables_; | ||||
76 | }; | ||||
77 | } // end of KDevMI | ||||
78 | | ||||
79 | #endif |