CDB: Convert 64bit pointers correctly.

Adapt to the output format "0x0000000`0046535C".
Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
Friedemann Kleint
2009-11-23 11:01:49 +01:00
parent 2c403df660
commit 7def179a98

View File

@@ -401,18 +401,33 @@ QString CdbSymbolGroupContext::symbolINameAt(unsigned long index) const
return m_inameIndexMap.key(index); return m_inameIndexMap.key(index);
} }
// check for "0x000", "0x000 class X" // Return hexadecimal pointer value from a CDB pointer value
// which look like "0x000032a" or "0x00000000`0250124a" on 64-bit systems.
static bool inline getPointerValue(QString stringValue, quint64 *value)
{
*value = 0;
if (!stringValue.startsWith(QLatin1String("0x")))
return false;
stringValue.remove(0, 2);
// Remove 64bit separator
if (stringValue.size() > 8 && stringValue.at(8) == QLatin1Char('`'))
stringValue.remove(8, 1);
bool ok;
*value = stringValue.toULongLong(&ok, 16);
return ok;
}
// check for "0x000", "0x000 class X" or its 64-bit equivalents.
static inline bool isNullPointer(const WatchData &wd) static inline bool isNullPointer(const WatchData &wd)
{ {
if (!isPointerType(wd.type)) if (!isPointerType(wd.type))
return false; return false;
static const QRegExp hexNullPattern(QLatin1String("0x0+")); QString stringValue = wd.value;
Q_ASSERT(hexNullPattern.isValid()); const int blankPos = stringValue.indexOf(QLatin1Char(' '));
const int blankPos = wd.value.indexOf(QLatin1Char(' ')); if (blankPos != -1)
if (blankPos == -1) stringValue.truncate(blankPos);
return hexNullPattern.exactMatch(wd.value); quint64 value;
const QString addr = wd.value.mid(0, blankPos); return getPointerValue(stringValue, &value) && value == 0u;
return hexNullPattern.exactMatch(addr);
} }
// Fix a symbol group value. It is set to the class type for // Fix a symbol group value. It is set to the class type for
@@ -713,16 +728,11 @@ static inline bool getIntValue(CIDebugSymbolGroup *sg, int index, int *value)
} }
// Get pointer value of symbol group ("0xAAB") // Get pointer value of symbol group ("0xAAB")
// Note that this is on "00000000`0250124a" on 64bit systems.
static inline bool getPointerValue(CIDebugSymbolGroup *sg, int index, quint64 *value) static inline bool getPointerValue(CIDebugSymbolGroup *sg, int index, quint64 *value)
{ {
*value = 0; const QString stringValue = getSymbolString(sg, &IDebugSymbolGroup2::GetSymbolValueTextWide, index);
QString valueS = getSymbolString(sg, &IDebugSymbolGroup2::GetSymbolValueTextWide, index); return getPointerValue(stringValue, value);
if (!valueS.startsWith(QLatin1String("0x")))
return false;
valueS.remove(0, 2);
bool ok;
*value = valueS.toULongLong(&ok, 16);
return ok;
} }
int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd) int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd)