Commit efed3fd7 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger[CDB]: Add a dumper for QSharedPointer.

As the structure is quite deeply nested.
parent 4e2937bf
......@@ -76,6 +76,7 @@ enum KnownType
KT_QAtomicInt = KT_Qt_Type + KT_HasSimpleDumper + 19,
KT_QObject = KT_Qt_Type + KT_HasSimpleDumper + KT_HasComplexDumper + 20,
KT_QWidget = KT_Qt_Type + KT_HasSimpleDumper + KT_HasComplexDumper + 21,
KT_QSharedPointer = KT_Qt_Type + KT_HasSimpleDumper + KT_HasComplexDumper + 22,
// Types: Various QT movable types
KT_QPen = KT_Qt_Type + KT_Qt_MovableType + 30,
KT_QUrl = KT_Qt_Type + KT_Qt_MovableType + 31,
......
......@@ -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;
......
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