Changeset View
Changeset View
Standalone View
Standalone View
debuggers/common/mivariablecontroller.cpp
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Line(s) | 77 | { | |||
---|---|---|---|---|---|
82 | 82 | | |||
83 | if (autoUpdate() & UpdateLocals) { | 83 | if (autoUpdate() & UpdateLocals) { | ||
84 | updateLocals(); | 84 | updateLocals(); | ||
85 | } | 85 | } | ||
86 | 86 | | |||
87 | if ((autoUpdate() & UpdateLocals) || | 87 | if ((autoUpdate() & UpdateLocals) || | ||
88 | ((autoUpdate() & UpdateWatches) && variableCollection()->watches()->childCount() > 0)) | 88 | ((autoUpdate() & UpdateWatches) && variableCollection()->watches()->childCount() > 0)) | ||
89 | { | 89 | { | ||
90 | debugSession()->addCommand( | 90 | debugSession()->addCommand(VarUpdate, "--all-values *", this, | ||
91 | new MICommand(VarUpdate, "--all-values *", this, | 91 | &MIVariableController::handleVarUpdate); | ||
92 | &MIVariableController::handleVarUpdate)); | | |||
93 | } | 92 | } | ||
94 | } | 93 | } | ||
95 | 94 | | |||
96 | void MIVariableController::handleVarUpdate(const ResultRecord& r) | 95 | void MIVariableController::handleVarUpdate(const ResultRecord& r) | ||
97 | { | 96 | { | ||
98 | const Value& changed = r["changelist"]; | 97 | const Value& changed = r["changelist"]; | ||
99 | for (int i = 0; i < changed.size(); ++i) | 98 | for (int i = 0; i < changed.size(); ++i) | ||
100 | { | 99 | { | ||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 146 | { | |||
150 | const Value& locals = r["locals"]; | 149 | const Value& locals = r["locals"]; | ||
151 | 150 | | |||
152 | QStringList localsName; | 151 | QStringList localsName; | ||
153 | for (int i = 0; i < locals.size(); i++) { | 152 | for (int i = 0; i < locals.size(); i++) { | ||
154 | const Value& var = locals[i]; | 153 | const Value& var = locals[i]; | ||
155 | localsName << var["name"].literal(); | 154 | localsName << var["name"].literal(); | ||
156 | } | 155 | } | ||
157 | int frame = m_session->frameStackModel()->currentFrame(); | 156 | int frame = m_session->frameStackModel()->currentFrame(); | ||
158 | m_session->addCommand( //dont'show value, low-frame, high-frame | 157 | m_session->addCommand(StackListArguments, | ||
159 | new MICommand(StackListArguments, QString("0 %1 %2").arg(frame).arg(frame), | 158 | //dont'show value, low-frame, high-frame | ||
160 | new StackListArgumentsHandler(localsName))); | 159 | QString("0 %1 %2").arg(frame).arg(frame), | ||
160 | new StackListArgumentsHandler(localsName)); | ||||
161 | } | 161 | } | ||
162 | 162 | | |||
163 | private: | 163 | private: | ||
164 | MIDebugSession *m_session; | 164 | MIDebugSession *m_session; | ||
165 | }; | 165 | }; | ||
166 | 166 | | |||
167 | void MIVariableController::updateLocals() | 167 | void MIVariableController::updateLocals() | ||
168 | { | 168 | { | ||
169 | debugSession()->addCommand( | 169 | debugSession()->addCommand(StackListLocals, "--simple-values", | ||
170 | new MICommand(StackListLocals, "--simple-values", | 170 | new StackListLocalsHandler(debugSession())); | ||
171 | new StackListLocalsHandler(debugSession()))); | | |||
172 | } | 171 | } | ||
173 | 172 | | |||
174 | Range MIVariableController::expressionRangeUnderCursor(Document* doc, const Cursor& cursor) | 173 | Range MIVariableController::expressionRangeUnderCursor(Document* doc, const Cursor& cursor) | ||
175 | { | 174 | { | ||
176 | QString line = doc->line(cursor.line()); | 175 | QString line = doc->line(cursor.line()); | ||
177 | int index = cursor.column(); | 176 | int index = cursor.column(); | ||
178 | QChar c = line[index]; | 177 | QChar c = line[index]; | ||
179 | if (!c.isLetterOrNumber() && c != '_') | 178 | if (!c.isLetterOrNumber() && c != '_') | ||
Show All 17 Lines | |||||
197 | void MIVariableController::addWatch(KDevelop::Variable* variable) | 196 | void MIVariableController::addWatch(KDevelop::Variable* variable) | ||
198 | { | 197 | { | ||
199 | // FIXME: should add async 'get full expression' method | 198 | // FIXME: should add async 'get full expression' method | ||
200 | // to MIVariable, not poke at varobj. In that case, | 199 | // to MIVariable, not poke at varobj. In that case, | ||
201 | // we will be able to make addWatch a generic method, not | 200 | // we will be able to make addWatch a generic method, not | ||
202 | // gdb-specific one. | 201 | // gdb-specific one. | ||
203 | if (MIVariable *gv = dynamic_cast<MIVariable*>(variable)) | 202 | if (MIVariable *gv = dynamic_cast<MIVariable*>(variable)) | ||
204 | { | 203 | { | ||
205 | debugSession()->addCommand( | 204 | debugSession()->addCommand(VarInfoPathExpression, | ||
206 | new MICommand(VarInfoPathExpression, | | |||
207 | gv->varobj(), | 205 | gv->varobj(), | ||
208 | this, | 206 | this, &MIVariableController::addWatch); | ||
209 | &MIVariableController::addWatch)); | | |||
210 | } | 207 | } | ||
211 | } | 208 | } | ||
212 | 209 | | |||
213 | void MIVariableController::addWatchpoint(KDevelop::Variable* variable) | 210 | void MIVariableController::addWatchpoint(KDevelop::Variable* variable) | ||
214 | { | 211 | { | ||
215 | // FIXME: should add async 'get full expression' method | 212 | // FIXME: should add async 'get full expression' method | ||
216 | // to MIVariable, not poke at varobj. In that case, | 213 | // to MIVariable, not poke at varobj. In that case, | ||
217 | // we will be able to make addWatchpoint a generic method, not | 214 | // we will be able to make addWatchpoint a generic method, not | ||
218 | // gdb-specific one. | 215 | // gdb-specific one. | ||
219 | if (MIVariable *gv = dynamic_cast<MIVariable*>(variable)) | 216 | if (MIVariable *gv = dynamic_cast<MIVariable*>(variable)) | ||
220 | { | 217 | { | ||
221 | debugSession()->addCommand( | 218 | debugSession()->addCommand(VarInfoPathExpression, | ||
222 | new MICommand(VarInfoPathExpression, | | |||
223 | gv->varobj(), | 219 | gv->varobj(), | ||
224 | this, | 220 | this, &MIVariableController::addWatchpoint); | ||
225 | &MIVariableController::addWatchpoint)); | | |||
226 | } | 221 | } | ||
227 | } | 222 | } | ||
228 | 223 | | |||
229 | void MIVariableController::addWatch(const ResultRecord& r) | 224 | void MIVariableController::addWatch(const ResultRecord& r) | ||
230 | { | 225 | { | ||
231 | // FIXME: handle error. | 226 | // FIXME: handle error. | ||
232 | if (r.reason == "done" && !r["path_expr"].literal().isEmpty()) { | 227 | if (r.reason == "done" && !r["path_expr"].literal().isEmpty()) { | ||
233 | variableCollection()->watches()->add(r["path_expr"].literal()); | 228 | variableCollection()->watches()->add(r["path_expr"].literal()); | ||
Show All 27 Lines |