Commit 9ceb9cd7 authored by David Schulz's avatar David Schulz

CdbExt: Add valarray dumper.

Change-Id: I9d05fc9217d014b011223d0739ed2267ae7ca479
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 68313155
......@@ -192,6 +192,7 @@ int containerSize(KnownType kt, const SymbolGroupValue &v)
case KT_StdSet:
case KT_StdMap:
case KT_StdMultiMap:
case KT_StdValArray:
case KT_StdList:
if (const SymbolGroupValue size = SymbolGroupValue::findMember(v, "_Mysize"))
return size.intValue();
......@@ -349,29 +350,42 @@ static inline AbstractSymbolGroupNodePtrVector
return AbstractSymbolGroupNodePtrVector();
}
// std::vector<T>
static inline AbstractSymbolGroupNodePtrVector
stdVectorChildList(SymbolGroupNode *n, unsigned count, const SymbolGroupValueContext &ctx)
arrayChildListHelper(SymbolGroupNode *n, unsigned count, const SymbolGroupValueContext &ctx,
std::string arrayMember)
{
if (!count)
return AbstractSymbolGroupNodePtrVector();
// MSVC2012 has 2 base classes, MSVC2010 1, MSVC2008 none
const SymbolGroupValue vec = SymbolGroupValue(n, ctx);
SymbolGroupValue myFirst = SymbolGroupValue::findMember(vec, "_Myfirst");
if (!myFirst)
const SymbolGroupValue val = SymbolGroupValue(n, ctx);
SymbolGroupValue arrayPtr = SymbolGroupValue::findMember(val, arrayMember.c_str());
if (!arrayPtr)
return AbstractSymbolGroupNodePtrVector();
// std::vector<T>: _Myfirst is a pointer of T*. Get address
// element to obtain address.
const ULONG64 address = myFirst.pointerValue();
// arrayMember is a pointer of T*. Get address element to obtain address.
const ULONG64 address = arrayPtr.pointerValue();
if (!address)
return AbstractSymbolGroupNodePtrVector();
const std::string firstType = myFirst.type();
const std::string innerType = fixInnerType(SymbolGroupValue::stripPointerType(firstType), vec);
const std::string firstType = arrayPtr.type();
const std::string innerType = fixInnerType(SymbolGroupValue::stripPointerType(firstType), val);
if (SymbolGroupValue::verbose)
DebugPrint() << n->name() << " inner type: '" << innerType << "' from '" << firstType << '\'';
return arrayChildList(n->symbolGroup(), address, n->module(), innerType, count);
}
// std::vector<T>
static inline AbstractSymbolGroupNodePtrVector
stdVectorChildList(SymbolGroupNode *n, unsigned count, const SymbolGroupValueContext &ctx)
{
return arrayChildListHelper(n, count, ctx, "_Myfirst");
}
// std::valarray<T>
static inline AbstractSymbolGroupNodePtrVector stdValArrayChildList(
SymbolGroupNode *n, unsigned count, const SymbolGroupValueContext &ctx)
{
return arrayChildListHelper(n, count, ctx, "_Myptr");
}
// Helper for std::deque<>: From the array of deque blocks, read out the values.
template<class AddressType>
AbstractSymbolGroupNodePtrVector
......@@ -1142,6 +1156,8 @@ AbstractSymbolGroupNodePtrVector containerChildren(SymbolGroupNode *node, int ty
return stdListChildList(node, size , ctx);
case KT_StdArray:
return stdArrayChildList(node, size , ctx);
case KT_StdValArray:
return stdValArrayChildList(node, size , ctx);
case KT_StdDeque:
return stdDequeChildList(SymbolGroupValue(node, ctx), size);
case KT_StdStack:
......
......@@ -176,7 +176,8 @@ enum KnownType
KT_StdSet = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 5,
KT_StdMap = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 6,
KT_StdMultiMap = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 7,
KT_StdArray = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 8
KT_StdArray = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 8,
KT_StdValArray = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 9
};
#endif // KNOWNTYPE_H
......@@ -1112,6 +1112,8 @@ static KnownType knownClassTypeHelper(const std::string &type,
case 8:
if (!type.compare(hPos, 8, "multimap"))
return KT_StdMultiMap;
if (!type.compare(hPos, 8, "valarray"))
return KT_StdValArray;
break;
}
}
......
......@@ -4378,20 +4378,34 @@ void tst_Dumpers::dumper_data()
+ Check("b0", "<0 items>", "std::valarray<bool>")
+ Check("b1", "<5 items>", "std::valarray<bool>")
+ Check("b1.0", "[0]", "1", "bool")
+ Check("b1.1", "[1]", "0", "bool")
+ Check("b1.2", "[2]", "0", "bool")
+ Check("b1.3", "[3]", "1", "bool")
+ Check("b1.4", "[4]", "0", "bool")
+ Check("b1.0", "[0]", "1", "bool") % NoCdbEngine
+ Check("b1.1", "[1]", "0", "bool") % NoCdbEngine
+ Check("b1.2", "[2]", "0", "bool") % NoCdbEngine
+ Check("b1.3", "[3]", "1", "bool") % NoCdbEngine
+ Check("b1.4", "[4]", "0", "bool") % NoCdbEngine
+ Check("b1.0", "[0]", "true", "bool") % CdbEngine
+ Check("b1.1", "[1]", "false", "bool") % CdbEngine
+ Check("b1.2", "[2]", "false", "bool") % CdbEngine
+ Check("b1.3", "[3]", "true", "bool") % CdbEngine
+ Check("b1.4", "[4]", "false", "bool") % CdbEngine
+ Check("b2", "<65 items>", "std::valarray<bool>")
+ Check("b2.0", "[0]", "1", "bool")
+ Check("b2.64", "[64]", "1", "bool")
+ Check("b2.0", "[0]", "1", "bool") % NoCdbEngine
+ Check("b2.64", "[64]", "1", "bool") % NoCdbEngine
+ Check("b2.0", "[0]", "true", "bool") % CdbEngine
+ Check("b2.64", "[64]", "true", "bool") % CdbEngine
+ Check("b3", "<300 items>", "std::valarray<bool>")
+ Check("b3.0", "[0]", "0", "bool")
+ Check("b3.299", "[299]", "0", "bool");
+ Check("b3.0", "[0]", "0", "bool") % NoCdbEngine
+ Check("b3.299", "[299]", "0", "bool") % NoCdbEngine
+ Check("b3.0", "[0]", "false", "bool") % CdbEngine
+ Check("b3.99", "[99]", "false", "bool") % CdbEngine;
QTest::newRow("StdVector")
<< Data("#include <vector>\n"
......
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