Debugger: Adapt QHostAddress dumper after Qt Core change a6cdfacf

Change-Id: I750d37f7ab23a638c2e0c5f0fd808ba22a0b49d0
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2017-02-01 11:44:40 +01:00
parent 228e53aab1
commit 19e6ee7862
2 changed files with 19 additions and 12 deletions

View File

@@ -737,8 +737,13 @@ def qdump__QHostAddress(d, value):
qtVersion = d.qtVersion()
tiVersion = d.qtTypeInfoVersion()
#warn('QT: %x, TI: %s' % (qtVersion, tiVersion))
mayNeedParse = True
if tiVersion is not None:
if tiVersion >= 5:
if tiVersion >= 16:
# After a6cdfacf
p, scopeId, a6, a4, protocol = d.split('p{QString}16s{quint32}B', dd)
mayNeedParse = False
elif tiVersion >= 5:
# Branch 5.8.0 at f70b4a13 TI: 15
# Branch 5.7.0 at b6cf0418 TI: 5
(ipString, scopeId, a6, a4, protocol, isParsed) \
@@ -760,8 +765,9 @@ def qdump__QHostAddress(d, value):
(a4, a6, protocol, pad, ipString, isParsed, pad, scopeId) \
= d.split('{quint32}16sB@{QString}{bool}@{QString}', dd)
(ipStringData, ipStringSize, ipStringAlloc) = d.stringData(ipString)
if isParsed.integer() and ipStringSize > 0:
if mayNeedParse:
ipStringData, ipStringSize, ipStringAlloc = d.stringData(ipString)
if mayNeedParse and isParsed.integer() and ipStringSize > 0:
d.putStringValue(ipString)
else:
# value.d.d->protocol:
@@ -786,9 +792,10 @@ def qdump__QHostAddress(d, value):
d.putNumChild(4)
if d.isExpanded():
with Children(d):
if mayNeedParse:
d.putSubItem('ipString', ipString)
d.putSubItem('scopeId', scopeId)
d.putSubItem('isParsed', isParsed)
d.putSubItem('scopeId', scopeId)
d.putSubItem('a', a4)

View File

@@ -2047,7 +2047,7 @@ void tst_Dumpers::dumper_data()
+ NetworkProfile()
+ Check("ha1", "129.0.0.130", "@QHostAddress")
+ Check("ha2", "\"127.0.0.1\"", "@QHostAddress")
+ Check("ha2", ValuePattern(".*127.0.0.1.*"), "@QHostAddress")
+ Check("addr", "1:203:506:0:809:a0b:0:0", "@QIPv6Address")
+ Check("addr.3", "[3]", "3", "unsigned char");
@@ -3695,26 +3695,26 @@ void tst_Dumpers::dumper_data()
+ NetworkProfile()
+ Check("ha", "\"127.0.0.1\"", "@QHostAddress")
+ Check("ha", ValuePattern(".*127.0.0.1.*"), "@QHostAddress")
+ Check("ha.a", "2130706433", TypeDef("unsigned int", "@quint32"))
+ Check("ha.ipString", "\"127.0.0.1\"", "@QString")
+ Check("ha.isParsed", "1", "bool")
+ Check("ha.ipString", ValuePattern(".*127.0.0.1.*"), "@QString")
% QtVersion(0, 0x50800)
//+ Check("ha.protocol", "@QAbstractSocket::IPv4Protocol (0)",
// "@QAbstractSocket::NetworkLayerProtocol") % GdbEngine
//+ Check("ha.protocol", "IPv4Protocol",
// "@QAbstractSocket::NetworkLayerProtocol") % LldbEngine
+ Check("ha.scopeId", "\"\"", "@QString")
+ Check("ha1", "\"127.0.0.1\"", "@QHostAddress")
+ Check("ha1", ValuePattern(".*127.0.0.1.*"), "@QHostAddress")
+ Check("ha1.a", "2130706433", TypeDef("unsigned int", "@quint32"))
+ Check("ha1.ipString", "\"127.0.0.1\"", "@QString")
+ Check("ha1.isParsed", "1", "bool")
% QtVersion(0, 0x50800)
//+ Check("ha1.protocol", "@QAbstractSocket::IPv4Protocol (0)",
// "@QAbstractSocket::NetworkLayerProtocol") % GdbEngine
//+ Check("ha1.protocol", "IPv4Protocol",
// "@QAbstractSocket::NetworkLayerProtocol") % LldbEngine
+ Check("ha1.scopeId", "\"\"", "@QString")
+ Check("var", "", "@QVariant (@QHostAddress)")
+ Check("var.data", "\"127.0.0.1\"", "@QHostAddress");
+ Check("var.data", ValuePattern(".*127.0.0.1.*"), "@QHostAddress");
QTest::newRow("QVariantList")