diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index edee6bce5c5..fb331968fb2 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -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): - d.putSubItem('ipString', ipString) + if mayNeedParse: + d.putSubItem('ipString', ipString) + d.putSubItem('isParsed', isParsed) d.putSubItem('scopeId', scopeId) - d.putSubItem('isParsed', isParsed) d.putSubItem('a', a4) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 198e27de931..4b4397ca21a 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -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")