Exemple #1
0
// Return size from an STL vector (last/first iterators).
static inline int msvcStdVectorSize(const SymbolGroupValue &v)
{
    const ULONG64 firstPtr = v.readPointerValueFromAncestor("_Myfirst");
    const ULONG64 lastPtr = v.readPointerValueFromAncestor("_Mylast");
    if (!firstPtr || lastPtr < firstPtr)
        return -1;
    const std::vector<std::string> innerTypes = v.innerTypes();
    if (innerTypes.empty())
        return -1;
    const std::string innerType = fixInnerType(SymbolGroupValue::stripPointerType(innerTypes[0]), v);
    const size_t size = SymbolGroupValue::sizeOf(innerType.c_str());
    if (size == 0)
        return -1;
    if (lastPtr == firstPtr)
        return 0;
    // Subtract the pointers: We need to do the pointer arithmetics ourselves
    // as we get char *pointers.
    return static_cast<int>((lastPtr - firstPtr) / size);
}
Exemple #2
0
// Return size from an STL vector (last/first iterators).
static inline int msvcStdVectorSize(const SymbolGroupValue &v)
{
    // MSVC2012 has 2 base classes, MSVC2010 1, MSVC2008 none
    if (const SymbolGroupValue myFirstPtrV = SymbolGroupValue::findMember(v, "_Myfirst")) {
        if (const SymbolGroupValue myLastPtrV = myFirstPtrV.parent()["_Mylast"]) {
            const ULONG64 firstPtr = myFirstPtrV.pointerValue();
            const ULONG64 lastPtr = myLastPtrV.pointerValue();
            if (!firstPtr || lastPtr < firstPtr)
                return -1;
            if (lastPtr == firstPtr)
                return 0;
            // Subtract the pointers: We need to do the pointer arithmetics ourselves
            // as we get char *pointers.
            const std::string innerType = fixInnerType(SymbolGroupValue::stripPointerType(myFirstPtrV.type()), v);
            const size_t size = SymbolGroupValue::sizeOf(innerType.c_str());
            if (size == 0)
                return -1;
            return static_cast<int>((lastPtr - firstPtr) / size);
        }
    }
    return -1;
}