Commit dd7f1c90 authored by Peifeng Yu's avatar Peifeng Yu
Browse files

KDevMI: correctly handle error in MIVariableController

parent b3fd416d
...@@ -118,16 +118,17 @@ public: ...@@ -118,16 +118,17 @@ public:
{ {
if (!KDevelop::ICore::self()->debugController()) return; //happens on shutdown if (!KDevelop::ICore::self()->debugController()) return; //happens on shutdown
// FIXME: handle error. if (r.hasField("stack-args") && r["stack-args"].size() > 0) {
const Value& locals = r["stack-args"][0]["args"]; const Value& locals = r["stack-args"][0]["args"];
for (int i = 0; i < locals.size(); i++) { for (int i = 0; i < locals.size(); i++) {
m_localsName << locals[i].literal(); m_localsName << locals[i].literal();
} }
QList<Variable*> variables = KDevelop::ICore::self()->debugController()->variableCollection() QList<Variable*> variables = KDevelop::ICore::self()->debugController()->variableCollection()
->locals()->updateLocals(m_localsName); ->locals()->updateLocals(m_localsName);
foreach (Variable *v, variables) { foreach (Variable *v, variables) {
v->attachMaybe(); v->attachMaybe();
}
} }
} }
...@@ -144,20 +145,20 @@ public: ...@@ -144,20 +145,20 @@ public:
void handle(const ResultRecord &r) override void handle(const ResultRecord &r) override
{ {
// FIXME: handle error. if (r.hasField("locals")) {
const Value& locals = r["locals"];
const Value& locals = r["locals"];
QStringList localsName;
QStringList localsName; for (int i = 0; i < locals.size(); i++) {
for (int i = 0; i < locals.size(); i++) { const Value& var = locals[i];
const Value& var = locals[i]; localsName << var["name"].literal();
localsName << var["name"].literal(); }
int frame = m_session->frameStackModel()->currentFrame();
m_session->addCommand(StackListArguments,
//dont'show value, low-frame, high-frame
QString("0 %1 %2").arg(frame).arg(frame),
new StackListArgumentsHandler(localsName));
} }
int frame = m_session->frameStackModel()->currentFrame();
m_session->addCommand(StackListArguments,
//dont'show value, low-frame, high-frame
QString("0 %1 %2").arg(frame).arg(frame),
new StackListArgumentsHandler(localsName));
} }
private: private:
...@@ -223,8 +224,9 @@ void MIVariableController::addWatchpoint(KDevelop::Variable* variable) ...@@ -223,8 +224,9 @@ void MIVariableController::addWatchpoint(KDevelop::Variable* variable)
void MIVariableController::addWatch(const ResultRecord& r) void MIVariableController::addWatch(const ResultRecord& r)
{ {
// FIXME: handle error. if (r.reason == "done"
if (r.reason == "done" && !r["path_expr"].literal().isEmpty()) { && r.hasField("path_expr")
&& !r["path_expr"].literal().isEmpty()) {
variableCollection()->watches()->add(r["path_expr"].literal()); variableCollection()->watches()->add(r["path_expr"].literal());
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment