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