diff --git a/src/libs/qtcreatorcdbext/containers.cpp b/src/libs/qtcreatorcdbext/containers.cpp index f4446ea39d3..e61fbd68e61 100644 --- a/src/libs/qtcreatorcdbext/containers.cpp +++ b/src/libs/qtcreatorcdbext/containers.cpp @@ -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,27 +350,40 @@ static inline 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 static inline AbstractSymbolGroupNodePtrVector stdVectorChildList(SymbolGroupNode *n, unsigned count, const SymbolGroupValueContext &ctx) { - 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) - return AbstractSymbolGroupNodePtrVector(); - // std::vector: _Myfirst is a pointer of T*. Get address - // 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); + return arrayChildListHelper(n, count, ctx, "_Myfirst"); +} + +// std::valarray +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. @@ -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: diff --git a/src/libs/qtcreatorcdbext/knowntype.h b/src/libs/qtcreatorcdbext/knowntype.h index 6ce6c94e732..7e432fb8e57 100644 --- a/src/libs/qtcreatorcdbext/knowntype.h +++ b/src/libs/qtcreatorcdbext/knowntype.h @@ -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 diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp index 5820647dca8..49e4631d9ec 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp @@ -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; } } diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 34f7ae9f03f..c82d401bf22 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -4378,20 +4378,34 @@ void tst_Dumpers::dumper_data() + Check("b0", "<0 items>", "std::valarray") + Check("b1", "<5 items>", "std::valarray") - + 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") - + 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") - + 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 \n"