From 996c67ca5bf0d10908608ab36686d33b7af2585c Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 30 Mar 2015 12:13:42 +0200 Subject: Cdbext: Add Dumper for QIPv6Address. Change-Id: Id46c1aa3eb05df85c3edb145c8ef7a302d0fd710 Reviewed-by: Christian Stenger --- src/libs/qtcreatorcdbext/knowntype.h | 1 + src/libs/qtcreatorcdbext/symbolgroupvalue.cpp | 29 +++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src/libs/qtcreatorcdbext') diff --git a/src/libs/qtcreatorcdbext/knowntype.h b/src/libs/qtcreatorcdbext/knowntype.h index da3c09af58..8ac8c19d75 100644 --- a/src/libs/qtcreatorcdbext/knowntype.h +++ b/src/libs/qtcreatorcdbext/knowntype.h @@ -145,6 +145,7 @@ enum KnownType KT_QHostAddress = KT_Qt_Type + KT_HasSimpleDumper + 92, KT_QProcess = KT_Qt_Type + KT_HasSimpleDumper + 93, KT_QTimeZone = KT_Qt_Type + KT_HasSimpleDumper + 94, + KT_QIPv6Address = KT_Qt_Type + KT_HasSimpleDumper + 95, // Types: Qt primitive types KT_QFixed = KT_Qt_Type + KT_Qt_PrimitiveType + 90, KT_QTextItem = KT_Qt_Type + KT_Qt_PrimitiveType + 91, diff --git a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp index edb052c412..3474963327 100644 --- a/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp +++ b/src/libs/qtcreatorcdbext/symbolgroupvalue.cpp @@ -1324,6 +1324,8 @@ static KnownType knownClassTypeHelper(const std::string &type, return KT_QKeySequence; if (!type.compare(qPos, 12, "QHostAddress")) return KT_QHostAddress; + if (!type.compare(qPos, 12, "QIPv6Address")) + return KT_QIPv6Address; if (!type.compare(qPos, 12, "QScriptValue")) return KT_QScriptValue; break; @@ -1928,9 +1930,27 @@ static inline bool dumpQFile(const SymbolGroupValue &v, std::wostream &str) return dumpQStringFromQPrivateClass(v, QPDM_qVirtual, qFileBasePrivateSize, str); } +static inline bool dumpQIPv6Address(const SymbolGroupValue &v, std::wostream &str, int *encoding) +{ + unsigned char *p = SymbolGroupValue::readMemory( v.context().dataspaces, v["c"].address(), 16); + if (!p || !encoding) + return false; + + const wchar_t oldFill = str.fill('0'); + str << std::hex; + for (unsigned char *it = p; it < p + 16; ++it) { + if ((p - it) % 2 == 0 && it != p) + str << ':'; + str << std::setw(2) << *it; + } + str << std::dec; + str.fill(oldFill); + *encoding = DumpEncodingIPv6AddressAndHexScopeId; + return true; +} /* Dump QHostAddress, for whose private class no debugging information is available. * Dump string 'ipString' past of its private class. Does not currently work? */ -static inline bool dumpQHostAddress(const SymbolGroupValue &v, std::wostream &str) +static inline bool dumpQHostAddress(const SymbolGroupValue &v, std::wostream &str, int *encoding) { // Determine offset in private struct: qIPv6AddressType (array, unaligned) + uint32 + enum. const QtInfo info = QtInfo::get(v.context()); @@ -1953,6 +1973,8 @@ static inline bool dumpQHostAddress(const SymbolGroupValue &v, std::wostream &st return true; } if (protocol == 1) { + if (dumpQIPv6Address(qHostAddressPrivateValue["a6"], str, encoding)) + return true; str << L"IPv6 protocol"; return true; } @@ -2875,7 +2897,10 @@ unsigned dumpSimpleType(SymbolGroupNode *n, const SymbolGroupValueContext &ctx, rc = dumpQUrl(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed; break; case KT_QHostAddress: - rc = dumpQHostAddress(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed; + rc = dumpQHostAddress(v, str, encoding) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed; + break; + case KT_QIPv6Address: + rc = dumpQIPv6Address(v, str, encoding) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed; break; case KT_QProcess: rc = dumpQProcess(v, str) ? SymbolGroupNode::SimpleDumperOk : SymbolGroupNode::SimpleDumperFailed; -- cgit v1.2.1