| 105 | {} |
| 106 | |
| 107 | void handle(const ResultRecord &r) override |
| 108 | { |
| 109 | if (!m_variable) return; |
| 110 | bool hasValue = false; |
| 111 | MIVariable* variable = m_variable.data(); |
| 112 | variable->deleteChildren(); |
| 113 | variable->setInScope(true); |
| 114 | |
| 115 | const auto isError = r.isReasonError(); |
| 116 | variable->setShowError(isError); |
| 117 | if (!isError) { |
| 118 | variable->setVarobj(r[QStringLiteral("name")].literal()); |
| 119 | |
| 120 | bool hasMore = false; |
| 121 | if (r.hasField(QStringLiteral("has_more")) && r[QStringLiteral("has_more")].toInt()) |
| 122 | // GDB swears there are more children. Trust it |
| 123 | hasMore = true; |
| 124 | else |
| 125 | // There are no more children in addition to what |
| 126 | // numchild reports. But, in KDevelop, the variable |
| 127 | // is not yet expanded, and those numchild are not |
| 128 | // fetched yet. So, if numchild != 0, hasMore should |
| 129 | // be true. |
| 130 | hasMore = r[QStringLiteral("numchild")].toInt() != 0; |
| 131 | |
| 132 | variable->setHasMore(hasMore); |
| 133 | |
| 134 | variable->setType(r[QStringLiteral("type")].literal()); |
| 135 | const auto rawValue = variable->setValueToValueFieldOf(r); |
| 136 | hasValue = !rawValue.isEmpty(); |
| 137 | if (variable->isExpanded() && r[QStringLiteral("numchild")].toInt()) { |
| 138 | variable->fetchMoreChildren(); |
| 139 | } |
| 140 | |
| 141 | if (variable->format() != KDevelop::Variable::Natural) { |
| 142 | //TODO doesn't work for children as they are not yet loaded |
| 143 | variable->formatChanged(); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | if (m_callback && m_callbackMethod) { |
| 148 | QMetaObject::invokeMethod(m_callback, m_callbackMethod, Q_ARG(bool, hasValue)); |
| 149 | } |
| 150 | } |
| 151 | bool handlesError() override { return true; } |
| 152 | |
| 153 | private: |
nothing calls this directly
no test coverage detected