Debugger[CDB]: Add a dumper for QSharedPointer.

As the structure is quite deeply nested.
This commit is contained in:
Friedemann Kleint
2011-03-23 14:55:02 +01:00
parent 4e2937bf48
commit efed3fd7cf
2 changed files with 36 additions and 0 deletions

View File

@@ -939,6 +939,10 @@ static KnownType knownClassTypeHelper(const std::string &type,
if (!type.compare(qPos, 11, "QLinkedList"))
return KT_QLinkedList;
break;
case 14:
if (!type.compare(qPos, 14, "QSharedPointer"))
return KT_QSharedPointer;
break;
}
}
// Remaining non-template types
@@ -1688,6 +1692,29 @@ static bool dumpQVariant(const SymbolGroupValue &v, std::wostream &str, void **s
return true;
}
// Dump a qsharedpointer (just list reference counts)
static inline bool dumpQSharedPointer(const SymbolGroupValue &v, std::wostream &str, void **specialInfoIn = 0)
{
const SymbolGroupValue externalRefCountV = v[unsigned(0)];
if (!externalRefCountV)
return false;
const SymbolGroupValue dV = externalRefCountV["d"];
if (!dV)
return false;
// Get value element from base and store in special info.
const SymbolGroupValue valueV = externalRefCountV[unsigned(0)]["value"];
if (!valueV)
return false;
// Format references.
const int strongRef = dV["strongref"]["_q_value"].intValue();
const int weakRef = dV["weakref"]["_q_value"].intValue();
if (strongRef < 0 || weakRef < 0)
return false;
str << L"References: " << strongRef << '/' << weakRef;
*specialInfoIn = valueV.node();
return true;
}
// Dump builtin simple types using SymbolGroupValue expressions.
unsigned dumpSimpleType(SymbolGroupNode *n, const SymbolGroupValueContext &ctx,
std::wstring *s, int *knownTypeIn /* = 0 */,
@@ -1792,6 +1819,9 @@ unsigned dumpSimpleType(SymbolGroupNode *n, const SymbolGroupValueContext &ctx,
case KT_QWidget:
rc = dumpQWidget(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
break;
case KT_QSharedPointer:
rc = dumpQSharedPointer(v, str, specialInfoIn) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
break;
case KT_StdString:
case KT_StdWString:
rc = dumpStd_W_String(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed;
@@ -1863,6 +1893,11 @@ std::vector<AbstractSymbolGroupNode *>
SymbolGroupNode *containerNode = reinterpret_cast<SymbolGroupNode *>(specialInfo);
rc.push_back(new ReferenceSymbolGroupNode("children", "children", containerNode));
}
case KT_QSharedPointer: // Special info by simple dumper is the value
if (specialInfo) {
SymbolGroupNode *valueNode = reinterpret_cast<SymbolGroupNode *>(specialInfo);
rc.push_back(new ReferenceSymbolGroupNode("value", "value", valueNode));
}
break;
default:
break;