forked from qt-creator/qt-creator
Debugger[CDB]: Make error message more verbose.
Task-number: QTCREATORBUG-4185
This commit is contained in:
@@ -89,14 +89,37 @@ bool SymbolGroupValue::isValid() const
|
|||||||
return m_node != 0 && m_context.dataspaces != 0;
|
return m_node != 0 && m_context.dataspaces != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug helper
|
||||||
|
static void formatNodeError(const AbstractSymbolGroupNode *n, std::ostream &os)
|
||||||
|
{
|
||||||
|
const AbstractSymbolGroupNode::AbstractSymbolGroupNodePtrVector &children = n->children();
|
||||||
|
const VectorIndexType size = children.size();
|
||||||
|
if (const SymbolGroupNode *sn = n->asSymbolGroupNode()) {
|
||||||
|
os << "type: " << sn->type() << ", raw value: \"" << wStringToString(sn->symbolGroupRawValue())
|
||||||
|
<< "\", 0x" << std::hex << sn->address() << ", " << std::dec;
|
||||||
|
}
|
||||||
|
if (size) {
|
||||||
|
os << "children (" << size << "): [";
|
||||||
|
for (VectorIndexType i = 0; i < size; i++)
|
||||||
|
os << ' ' << children.at(i)->name();
|
||||||
|
os << ']';
|
||||||
|
} else {
|
||||||
|
os << "No children";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SymbolGroupValue SymbolGroupValue::operator[](unsigned index) const
|
SymbolGroupValue SymbolGroupValue::operator[](unsigned index) const
|
||||||
{
|
{
|
||||||
if (ensureExpanded())
|
if (ensureExpanded())
|
||||||
if (index < m_node->children().size())
|
if (index < m_node->children().size())
|
||||||
if (SymbolGroupNode *n = m_node->childAt(index)->asSymbolGroupNode())
|
if (SymbolGroupNode *n = m_node->childAt(index)->asSymbolGroupNode())
|
||||||
return SymbolGroupValue(n, m_context);
|
return SymbolGroupValue(n, m_context);
|
||||||
if (isValid() && SymbolGroupValue::verbose)
|
if (isValid() && SymbolGroupValue::verbose) {
|
||||||
DebugPrint() << name() << "::operator[" << index << "](const char*) failed.";
|
DebugPrint dp;
|
||||||
|
dp << name() << "::operator[](#" << index << ") failed. ";
|
||||||
|
if (m_node)
|
||||||
|
formatNodeError(m_node, dp);
|
||||||
|
}
|
||||||
return SymbolGroupValue(m_errorMessage);
|
return SymbolGroupValue(m_errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,8 +148,12 @@ SymbolGroupValue SymbolGroupValue::operator[](const char *name) const
|
|||||||
if (AbstractSymbolGroupNode *child = m_node->childByIName(name))
|
if (AbstractSymbolGroupNode *child = m_node->childByIName(name))
|
||||||
if (SymbolGroupNode *n = child->asSymbolGroupNode())
|
if (SymbolGroupNode *n = child->asSymbolGroupNode())
|
||||||
return SymbolGroupValue(n, m_context);
|
return SymbolGroupValue(n, m_context);
|
||||||
if (isValid() && SymbolGroupValue::verbose) // Do not report subsequent errors
|
if (isValid() && SymbolGroupValue::verbose) { // Do not report subsequent errors
|
||||||
DebugPrint() << this->name() << "::operator[](" << name << ") failed.";
|
DebugPrint dp;
|
||||||
|
dp << this->name() << "::operator[](\"" << name << "\") failed. ";
|
||||||
|
if (m_node)
|
||||||
|
formatNodeError(m_node, dp);
|
||||||
|
}
|
||||||
return SymbolGroupValue(m_errorMessage);
|
return SymbolGroupValue(m_errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user