forked from qt-creator/qt-creator
Debugger[New CDB]: Fix QMap.
Determine field offset of map node using GetFieldOffset. Qualify with full module.
This commit is contained in:
@@ -549,7 +549,8 @@ static inline SymbolGroupValueVector
|
|||||||
return SymbolGroupValueVector();
|
return SymbolGroupValueVector();
|
||||||
// MSVC2010: "class _Tree : public _Tree_val: public _Tree_nod".
|
// MSVC2010: "class _Tree : public _Tree_val: public _Tree_nod".
|
||||||
// MSVC2008: Direct class
|
// MSVC2008: Direct class
|
||||||
const bool isMSVC2010 = tree[unsigned(0)][unsigned(0)]["_Mysize"].intValue() == count;
|
const int size = tree[unsigned(0)][unsigned(0)]["_Mysize"].intValue();
|
||||||
|
const bool isMSVC2010 = size >= 0 && size <= count; // Count may be limited
|
||||||
if (isMSVC2010In)
|
if (isMSVC2010In)
|
||||||
*isMSVC2010In = isMSVC2010;
|
*isMSVC2010In = isMSVC2010;
|
||||||
const SymbolGroupValue treeNode = isMSVC2010 ? tree[unsigned(0)][unsigned(0)] : tree;
|
const SymbolGroupValue treeNode = isMSVC2010 ? tree[unsigned(0)][unsigned(0)] : tree;
|
||||||
@@ -904,17 +905,15 @@ static inline AbstractSymbolGroupNodePtrVector
|
|||||||
const std::string mapNodeType = qHashNodeType(v, "Node");
|
const std::string mapNodeType = qHashNodeType(v, "Node");
|
||||||
const std::string mapPayloadNodeType = qHashNodeType(v, "PayloadNode");
|
const std::string mapPayloadNodeType = qHashNodeType(v, "PayloadNode");
|
||||||
// Calculate the offset needed (see QMap::concrete() used by the iterator).
|
// Calculate the offset needed (see QMap::concrete() used by the iterator).
|
||||||
const unsigned mapNodeSize = SymbolGroupValue::sizeOf(mapPayloadNodeType.c_str());
|
|
||||||
const unsigned payloadNodeSize = SymbolGroupValue::sizeOf(mapPayloadNodeType.c_str());
|
const unsigned payloadNodeSize = SymbolGroupValue::sizeOf(mapPayloadNodeType.c_str());
|
||||||
const unsigned pointerSize = SymbolGroupValue::pointerSize();
|
|
||||||
if (debugMap) {
|
if (debugMap) {
|
||||||
DebugPrint() << v.type() << "," << mapNodeType << ':'
|
DebugPrint() << v.type() << "," << mapNodeType << ':'
|
||||||
<< mapNodeSize << ',' << mapPayloadNodeType << ':' << payloadNodeSize
|
<< mapPayloadNodeType << ':' << payloadNodeSize
|
||||||
<< ", pointerSize=" << pointerSize;
|
<< ", pointerSize=" << SymbolGroupValue::pointerSize();
|
||||||
}
|
}
|
||||||
if (!payloadNodeSize || !mapNodeSize)
|
if (!payloadNodeSize)
|
||||||
return AbstractSymbolGroupNodePtrVector();
|
return AbstractSymbolGroupNodePtrVector();
|
||||||
const ULONG64 payLoad = payloadNodeSize - pointerSize;
|
const ULONG64 payLoad = payloadNodeSize - SymbolGroupValue::pointerSize();
|
||||||
// Get the value offset. Manually determine the alignment to be able
|
// Get the value offset. Manually determine the alignment to be able
|
||||||
// to retrieve key/value without having to deal with QMapNode<> (see below).
|
// to retrieve key/value without having to deal with QMapNode<> (see below).
|
||||||
// Subtract the 2 trailing pointers of the node.
|
// Subtract the 2 trailing pointers of the node.
|
||||||
@@ -922,7 +921,7 @@ static inline AbstractSymbolGroupNodePtrVector
|
|||||||
if (innerTypes.size() != 2u)
|
if (innerTypes.size() != 2u)
|
||||||
return AbstractSymbolGroupNodePtrVector();
|
return AbstractSymbolGroupNodePtrVector();
|
||||||
const unsigned valueSize = SymbolGroupValue::sizeOf(innerTypes.at(1).c_str());
|
const unsigned valueSize = SymbolGroupValue::sizeOf(innerTypes.at(1).c_str());
|
||||||
const unsigned valueOffset = mapNodeSize - valueSize - pointerSize;
|
const unsigned valueOffset = SymbolGroupValue::fieldOffset(mapNodeType.c_str(), "value");
|
||||||
if (debugMap)
|
if (debugMap)
|
||||||
DebugPrint() << "Payload=" << payLoad << ",valueOffset=" << valueOffset << ','
|
DebugPrint() << "Payload=" << payLoad << ",valueOffset=" << valueOffset << ','
|
||||||
<< innerTypes.front() << ',' << innerTypes.back() << ':' << valueSize;
|
<< innerTypes.front() << ',' << innerTypes.back() << ':' << valueSize;
|
||||||
|
|||||||
@@ -267,6 +267,14 @@ unsigned SymbolGroupValue::intSize()
|
|||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned SymbolGroupValue::fieldOffset(const char *type, const char *field)
|
||||||
|
{
|
||||||
|
ULONG rc = 0;
|
||||||
|
if (GetFieldOffset(type, field, &rc))
|
||||||
|
return 0;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
std::string SymbolGroupValue::stripPointerType(const std::string &t)
|
std::string SymbolGroupValue::stripPointerType(const std::string &t)
|
||||||
{
|
{
|
||||||
return isPointerType(t) ? t.substr(0, t.size() - 2) : t;
|
return isPointerType(t) ? t.substr(0, t.size() - 2) : t;
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ public:
|
|||||||
|
|
||||||
// Some helpers for manipulating types.
|
// Some helpers for manipulating types.
|
||||||
static inline unsigned sizeOf(const char *type) { return GetTypeSize(type); }
|
static inline unsigned sizeOf(const char *type) { return GetTypeSize(type); }
|
||||||
|
// Offset of structure field: "!moduleQMapNode<K,T>", "value".
|
||||||
|
static unsigned fieldOffset(const char *type, const char *field);
|
||||||
static std::string stripPointerType(const std::string &);
|
static std::string stripPointerType(const std::string &);
|
||||||
static std::string addPointerType(const std::string &);
|
static std::string addPointerType(const std::string &);
|
||||||
static std::string stripArrayType(const std::string &);
|
static std::string stripArrayType(const std::string &);
|
||||||
|
|||||||
Reference in New Issue
Block a user