diff options
author | hjk <hjk@theqtcompany.com> | 2015-12-11 13:28:21 +0100 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2015-12-21 07:32:14 +0000 |
commit | c2bf384ac28feee10656c1ad41303159c5d06f34 (patch) | |
tree | 6aa75a135a599b57b5379f5ccea0b4965173e9a6 /share | |
parent | 74b33929d847d98c7a9521912523156a4b8e6d14 (diff) | |
download | qt-creator-c2bf384ac28feee10656c1ad41303159c5d06f34.tar.gz |
Debugger: Split DebuggerEncoding enum
... into a string specifying a kind of encoding (utf8, latin1),
an optional bytesize (2-byte integers, 4-byte integers) and a
flag whether the displayed value should get "..." around it.
Scales better than adding an enum value for each new combination.
Change-Id: Iffcb1e2f148f12da96e165559a976bd34026c649
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'share')
-rw-r--r-- | share/qtcreator/debugger/boosttypes.py | 8 | ||||
-rw-r--r-- | share/qtcreator/debugger/creatortypes.py | 13 | ||||
-rw-r--r-- | share/qtcreator/debugger/dumper.py | 115 | ||||
-rw-r--r-- | share/qtcreator/debugger/gdbbridge.py | 55 | ||||
-rw-r--r-- | share/qtcreator/debugger/lldbbridge.py | 33 | ||||
-rw-r--r-- | share/qtcreator/debugger/misctypes.py | 2 | ||||
-rw-r--r-- | share/qtcreator/debugger/pdbbridge.py | 6 | ||||
-rw-r--r-- | share/qtcreator/debugger/qttypes.py | 70 |
8 files changed, 110 insertions, 192 deletions
diff --git a/share/qtcreator/debugger/boosttypes.py b/share/qtcreator/debugger/boosttypes.py index cf0b4587b0..023b4bde28 100644 --- a/share/qtcreator/debugger/boosttypes.py +++ b/share/qtcreator/debugger/boosttypes.py @@ -41,7 +41,7 @@ def qdump__boost__bimaps__bimap(d, value): def qdump__boost__optional(d, value): if int(value["m_initialized"]) == 0: - d.putSpecialValue(SpecialUninitializedValue) + d.putSpecialValue("uninitialized") d.putNumChild(0) else: type = d.templateArgument(value.type, 0) @@ -114,18 +114,18 @@ def qdump__boost__container__list(d, value): def qdump__boost__gregorian__date(d, value): - d.putValue(int(value["days_"]), JulianDate) + d.putValue(int(value["days_"]), "juliandate") d.putNumChild(0) def qdump__boost__posix_time__ptime(d, value): ms = int(int(value["time_"]["time_count_"]["value_"]) / 1000) - d.putValue("%s/%s" % divmod(ms, 86400000), JulianDateAndMillisecondsSinceMidnight) + d.putValue("%s/%s" % divmod(ms, 86400000), "juliandateandmillisecondssincemidnight") d.putNumChild(0) def qdump__boost__posix_time__time_duration(d, value): - d.putValue(int(int(value["ticks_"]["value_"]) / 1000), MillisecondsSinceMidnight) + d.putValue(int(int(value["ticks_"]["value_"]) / 1000), "millisecondssincemidnight") d.putNumChild(0) diff --git a/share/qtcreator/debugger/creatortypes.py b/share/qtcreator/debugger/creatortypes.py index b1f9a834e6..66c5cea4b3 100644 --- a/share/qtcreator/debugger/creatortypes.py +++ b/share/qtcreator/debugger/creatortypes.py @@ -91,7 +91,7 @@ def readLiteral(d, value): return "<unsupported>" def dumpLiteral(d, value): - d.putValue(d.hexencode(readLiteral(d, value)), Hex2EncodedLatin1) + d.putValue(d.hexencode(readLiteral(d, value)), "latin1") def qdump__Core__Id(d, value): try: @@ -104,7 +104,7 @@ def qdump__Core__Id(d, value): def qdump__Debugger__Internal__GdbMi(d, value): str = d.encodeByteArray(value["m_name"]) + "3a20" \ + d.encodeByteArray(value["m_data"]) - d.putValue(str, Hex2EncodedLatin1) + d.putValue(str, "latin1") d.putPlainChildren(value) def qdump__Debugger__Internal__DisassemblerLine(d, value): @@ -153,7 +153,7 @@ def qdump__CPlusPlus__FullySpecifiedType(d, value): if typeName == "CPlusPlus::NamedType": dumpLiteral(d, type["_name"]) elif typeName == "CPlusPlus::PointerType": - d.putValue(d.hexencode(extractPointerType(d, type)), Hex2EncodedLatin1) + d.putValue(d.hexencode(extractPointerType(d, type)), "latin1") d.putPlainChildren(value) def qdump__CPlusPlus__NamedType(d, value): @@ -162,7 +162,7 @@ def qdump__CPlusPlus__NamedType(d, value): d.putPlainChildren(value) def qdump__CPlusPlus__PointerType(d, value): - d.putValue(d.hexencode(extractPointerType(d, value)), Hex2EncodedLatin1) + d.putValue(d.hexencode(extractPointerType(d, value)), "latin1") d.putPlainChildren(value) def qdump__CPlusPlus__TemplateNameId(d, value): @@ -214,8 +214,7 @@ def qdump__CPlusPlus__Internal__PPToken(d, value): offset = int(value["utf16charOffset"]) #warn("size: %s, alloc: %s, offset: %s, length: %s, data: %s" # % (size, alloc, offset, length, data)) - d.putValue(d.readMemory(data + offset, min(100, length)), - Hex2EncodedLatin1) + d.putValue(d.readMemory(data + offset, min(100, length)), "latin1") d.putPlainChildren(value) def qdump__ProString(d, value): @@ -225,7 +224,7 @@ def qdump__ProString(d, value): data += 2 * int(value["m_offset"]) size = int(value["m_length"]) s = d.readMemory(data, 2 * size) - d.putValue(s, Hex4EncodedLittleEndian) + d.putValue(s, "utf16") except: d.putEmptyValue() d.putPlainChildren(value) diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index b2949c1b4f..e93746aaae 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -99,49 +99,6 @@ BreakpointOnQmlSignalEmit, \ BreakpointAtJavaScriptThrow, \ = range(0, 14) -# Encodings. Keep that synchronized with DebuggerEncoding in debuggerprotocol.h -Unencoded8Bit, \ -Base64Encoded8BitWithQuotes, \ -Base64Encoded16BitWithQuotes, \ -Base64Encoded32BitWithQuotes, \ -Base64Encoded16Bit, \ -Base64Encoded8Bit, \ -Hex2EncodedLatin1, \ -Hex4EncodedLittleEndian, \ -Hex8EncodedLittleEndian, \ -Hex2EncodedUtf8, \ -Hex8EncodedBigEndian, \ -Hex4EncodedBigEndian, \ -Hex4EncodedLittleEndianWithoutQuotes, \ -Hex2EncodedLocal8Bit, \ -JulianDate, \ -MillisecondsSinceMidnight, \ -JulianDateAndMillisecondsSinceMidnight, \ -Hex2EncodedInt1, \ -Hex2EncodedInt2, \ -Hex2EncodedInt4, \ -Hex2EncodedInt8, \ -Hex2EncodedUInt1, \ -Hex2EncodedUInt2, \ -Hex2EncodedUInt4, \ -Hex2EncodedUInt8, \ -Hex2EncodedFloat4, \ -Hex2EncodedFloat8, \ -IPv6AddressAndHexScopeId, \ -Hex2EncodedUtf8WithoutQuotes, \ -DateTimeInternal, \ -SpecialEmptyValue, \ -SpecialUninitializedValue, \ -SpecialInvalidValue, \ -SpecialNotAccessibleValue, \ -SpecialItemCountValue, \ -SpecialMinimumItemCountValue, \ -SpecialNotCallableValue, \ -SpecialNullReferenceValue, \ -SpecialOptimizedOutValue, \ -SpecialEmptyStructureValue, \ - = range(40) - # Display modes. Keep that synchronized with DebuggerDisplay in debuggerprotocol.h StopDisplay, \ DisplayImageData, \ @@ -302,7 +259,7 @@ class Children: if self.d.passExceptions: showException("CHILDREN", exType, exValue, exTraceBack) self.d.putNumChild(0) - self.d.putSpecialValue(SpecialNotAccessibleValue) + self.d.putSpecialValue("notaccessible") if not self.d.currentMaxNumChild is None: if self.d.currentMaxNumChild < self.d.currentNumChild: self.d.put('{name="<incomplete>",value="",type="",numchild="0"},') @@ -578,15 +535,18 @@ class DumperBase: if charSize == 1: if displayFormat == Latin1StringFormat \ or displayFormat == SeparateLatin1StringFormat: - encodingType = Hex2EncodedLatin1 + encodingType = "latin1" else: - encodingType = Hex2EncodedUtf8 + encodingType = "utf8" + childType = "char" displayType = DisplayLatin1String elif charSize == 2: - encodingType = Hex4EncodedLittleEndian + encodingType = "utf16" + childType = "short" displayType = DisplayUtf16String else: - encodingType = Hex8EncodedLittleEndian + encodingType = "ucs4" + childType = "int" displayType = DisplayUtf16String self.putValue(mem, encodingType, elided=elided) @@ -617,7 +577,7 @@ class DumperBase: def putByteArrayValue(self, value): elided, data = self.encodeByteArrayHelper(self.extractPointer(value), self.displayStringLimit) - self.putValue(data, Hex2EncodedLatin1, elided=elided) + self.putValue(data, "latin1", elided=elided) def encodeString(self, value, limit = 0): elided, data = self.encodeStringHelper(self.extractPointer(value), limit) @@ -676,13 +636,13 @@ class DumperBase: def putStringValueByAddress(self, addr): elided, data = self.encodeStringHelper(addr, self.displayStringLimit) - self.putValue(data, Hex4EncodedLittleEndian, elided=elided) + self.putValue(data, "utf16", elided=elided) def putStringValue(self, value): elided, data = self.encodeStringHelper( self.extractPointer(value), self.displayStringLimit) - self.putValue(data, Hex4EncodedLittleEndian, elided=elided) + self.putValue(data, "utf16", elided=elided) def putAddressItem(self, name, value, type = ""): with SubItem(self, name): @@ -715,7 +675,7 @@ class DumperBase: self.putItem(result) except: with SubItem(self, name): - self.putSpecialValue(SpecialNotCallableValue); + self.putSpecialValue("notcallable"); self.putNumChild(0) def call(self, value, func, *args): @@ -737,22 +697,18 @@ class DumperBase: ns = self.qtNamespace() typeName = self.stripClassTag(str(value.type)) if typeName == ns + "QString": - self.put('key="%s",' % self.encodeString(value)) - self.put('keyencoded="%s",' % Hex4EncodedLittleEndian) + self.put('keyencoded="utf16:2:0",key="%s",' % self.encodeString(value)) elif typeName == ns + "QByteArray": - self.put('key="%s",' % self.encodeByteArray(value)) - self.put('keyencoded="%s",' % Hex2EncodedLatin1) + self.put('keyencoded="latin1:1:0",key="%s",' % self.encodeByteArray(value)) elif typeName == "std::string": - self.put('key="%s",' % self.encodeStdString(value)) - self.put('keyencoded="%s",' % Hex2EncodedLatin1) + self.put('keyencoded="latin1:1:0",key="%s",' % self.encodeStdString(value)) else: val = str(value.GetValue()) if self.isLldb else str(value) if index is None: key = '%s' % val else: key = '[%s] %s' % (index, val) - self.put('key="%s",' % self.hexencode(key)) - self.put('keyencoded="%s",' % Hex2EncodedUtf8WithoutQuotes) + self.put('keyencoded="utf8:1:0",key="%s",' % self.hexencode(key)) def putPair(self, pair, index = None): if self.pairData.useKeyAndValue: @@ -763,14 +719,11 @@ class DumperBase: value = pair["second"] if self.pairData.isCompact: if self.pairData.keyIsQString: - self.put('key="%s",' % self.encodeString(key)) - self.put('keyencoded="%s",' % Hex4EncodedLittleEndian) + self.put('keyencoded="utf16",key="%s",' % self.encodeString(key)) elif self.pairData.keyIsQByteArray: - self.put('key="%s",' % self.encodeByteArray(key)) - self.put('keyencoded="%s",' % Hex2EncodedLatin1) + self.put('keyencoded="latin1",key="%s",' % self.encodeByteArray(key)) elif self.pairData.keyIsStdString: - self.put('key="%s",' % self.encodeStdString(key)) - self.put('keyencoded="%s",' % Hex2EncodedLatin1) + self.put('keyencoded="latin1",key="%s",' % self.encodeStdString(key)) else: name = str(key.GetValue()) if self.isLldb else str(key) if index == -1: @@ -833,9 +786,9 @@ class DumperBase: def putItemCount(self, count, maximum = 1000000000): # This needs to override the default value, so don't use 'put' directly. if count > maximum: - self.putSpecialValue(SpecialMinimumItemCountValue, maximum) + self.putSpecialValue("minimumitemcount", maximum) else: - self.putSpecialValue(SpecialItemCountValue, count) + self.putSpecialValue("itemcount", count) self.putNumChild(count) def resultToMi(self, value): @@ -1082,7 +1035,7 @@ class DumperBase: else: elided, shown = self.computeLimit(int(size), self.displayStringLimit) data = self.readMemory(base, shown) - self.putValue(data, Hex2EncodedLatin1, elided=elided) + self.putValue(data, "latin1", elided=elided) def putDisplay(self, editFormat, value): self.put('editformat="%s",' % editFormat) @@ -1094,51 +1047,51 @@ class DumperBase: # Use Latin1 as default for char *. self.putType(typeName) (elided, data) = self.encodeCArray(value, 1, limit) - self.putValue(data, Hex2EncodedLatin1, elided=elided) + self.putValue(data, "latin1", elided=elided) return True if displayFormat == Latin1StringFormat: self.putType(typeName) (elided, data) = self.encodeCArray(value, 1, limit) - self.putValue(data, Hex2EncodedLatin1, elided=elided) + self.putValue(data, "latin1", elided=elided) return True if displayFormat == SeparateLatin1StringFormat: self.putType(typeName) (elided, data) = self.encodeCArray(value, 1, limit) - self.putValue(data, Hex2EncodedLatin1, elided=elided) + self.putValue(data, "latin1", elided=elided) self.putDisplay(DisplayLatin1String, data) return True if displayFormat == Utf8StringFormat: self.putType(typeName) (elided, data) = self.encodeCArray(value, 1, limit) - self.putValue(data, Hex2EncodedUtf8, elided=elided) + self.putValue(data, "utf8", elided=elided) return True if displayFormat == SeparateUtf8StringFormat: self.putType(typeName) (elided, data) = self.encodeCArray(value, 1, limit) - self.putValue(data, Hex2EncodedUtf8, elided=elided) + self.putValue(data, "utf8", elided=elided) self.putDisplay(DisplayUtf8String, data) return True if displayFormat == Local8BitStringFormat: self.putType(typeName) (elided, data) = self.encodeCArray(value, 1, limit) - self.putValue(data, Hex2EncodedLocal8Bit, elided=elided) + self.putValue(data, "local8bit", elided=elided) return True if displayFormat == Utf16StringFormat: self.putType(typeName) (elided, data) = self.encodeCArray(value, 2, limit) - self.putValue(data, Hex4EncodedLittleEndian, elided=elided) + self.putValue(data, "utf16", elided=elided) return True if displayFormat == Ucs4StringFormat: self.putType(typeName) (elided, data) = self.encodeCArray(value, 4, limit) - self.putValue(data, Hex8EncodedLittleEndian, elided=elided) + self.putValue(data, "ucs4", elided=elided) return True return False @@ -1176,7 +1129,7 @@ class DumperBase: if displayFormat == RawFormat: # Explicitly requested bald pointer. self.putType(typeName) - self.putValue(self.hexencode(str(value)), Hex2EncodedUtf8WithoutQuotes) + self.putValue(self.hexencode(str(value)), "utf8:1:0") self.putNumChild(1) if self.currentIName in self.expandedINames: with Children(self): @@ -1293,7 +1246,7 @@ class DumperBase: return False raw = self.readMemory(data, 2 * size) - self.putValue(raw, Hex4EncodedLittleEndian, 1) + self.putValue(raw, "utf16", 1) return True except: @@ -1490,7 +1443,7 @@ class DumperBase: for (k, v) in zip(names, values): with SubItem(self, propertyCount): self.put('key="%s",' % self.encodeByteArray(k)) - self.put('keyencoded="%s",' % Hex2EncodedLatin1) + self.put('keyencoded="latin1",') self.putItem(v) propertyCount += 1 @@ -1536,7 +1489,7 @@ class DumperBase: else: connections = connections.dereference() connections = connections.cast(self.directBaseClass(connections.type)) - self.putSpecialValue(SpecialMinimumItemCountValue, 0) + self.putSpecialValue("minimumitemcount", 0) self.putNumChild(1) if self.isExpanded(): pp = 0 diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index f215d52c1e..150b0cb09b 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -464,7 +464,7 @@ class Dumper(DumperBase): if self.passExceptions: showException("SUBITEM", exType, exValue, exTraceBack) self.putNumChild(0) - self.putSpecialValue(SpecialNotAccessibleValue) + self.putSpecialValue("notaccessible") try: if self.currentType.value: typeName = self.stripClassTag(self.currentType.value) @@ -472,11 +472,10 @@ class Dumper(DumperBase): self.put('type="%s",' % typeName) # str(type.unqualified()) ? if self.currentValue.value is None: - self.put('value="",encoding="%d",numchild="0",' - % SpecialNotAccessibleValue) + self.put('value="",encoding="notaccessible",numchild="0",') else: if not self.currentValue.encoding is None: - self.put('valueencoded="%d",' % self.currentValue.encoding) + self.put('valueencoded="%s",' % self.currentValue.encoding) if self.currentValue.elided: self.put('valueelided="%d",' % self.currentValue.elided) self.put('value="%s",' % self.currentValue.value) @@ -898,31 +897,14 @@ class Dumper(DumperBase): def simpleEncoding(self, typeobj): code = typeobj.code if code == BoolCode or code == CharCode: - return Hex2EncodedInt1 + return "int:1" if code == IntCode: if str(typeobj).find("unsigned") >= 0: - if typeobj.sizeof == 1: - return Hex2EncodedUInt1 - if typeobj.sizeof == 2: - return Hex2EncodedUInt2 - if typeobj.sizeof == 4: - return Hex2EncodedUInt4 - if typeobj.sizeof == 8: - return Hex2EncodedUInt8 + return "uint:%d" % typeobj.sizeof else: - if typeobj.sizeof == 1: - return Hex2EncodedInt1 - if typeobj.sizeof == 2: - return Hex2EncodedInt2 - if typeobj.sizeof == 4: - return Hex2EncodedInt4 - if typeobj.sizeof == 8: - return Hex2EncodedInt8 + return "int:%d" % typeobj.sizeof if code == FloatCode: - if typeobj.sizeof == 4: - return Hex2EncodedFloat4 - if typeobj.sizeof == 8: - return Hex2EncodedFloat8 + return "float:%d" % typeobj.sizeof return None def isReferenceType(self, typeobj): @@ -938,7 +920,7 @@ class Dumper(DumperBase): if value is None: # Happens for non-available watchers in gdb versions that # need to use gdb.execute instead of gdb.parse_and_eval - self.putSpecialValue(SpecialNotAvailableValue) + self.putSpecialValue("notaccessible") self.putType("<unknown>") self.putNumChild(0) return @@ -947,7 +929,7 @@ class Dumper(DumperBase): typeName = str(typeobj) if value.is_optimized_out: - self.putSpecialValue(SpecialOptimizedOutValue) + self.putSpecialValue("optimizedout") self.putType(typeName) self.putNumChild(0) return @@ -968,7 +950,7 @@ class Dumper(DumperBase): try: # Try to recognize null references explicitly. if toInteger(value.address) == 0: - self.putSpecialValue(SpecialNullReferenceValue) + self.putSpecialValue("nullreference") self.putType(typeName) self.putNumChild(0) return @@ -996,7 +978,7 @@ class Dumper(DumperBase): self.putBetterType("%s &" % self.currentType.value) return except RuntimeError: - self.putSpecialValue(SpecialOptimizedOutValue) + self.putSpecialValue("optimizedout") self.putType(typeName) self.putNumChild(0) return @@ -1077,7 +1059,7 @@ class Dumper(DumperBase): # Anonymous union. We need a dummy name to distinguish # multiple anonymous unions in the struct. self.putType(typeobj) - self.putSpecialValue(SpecialEmptyStructureValue) + self.putSpecialValue("emptystructure") self.anonNumber += 1 with Children(self, 1): self.listAnonymous(value, "#%d" % self.anonNumber, typeobj) @@ -1087,7 +1069,7 @@ class Dumper(DumperBase): # FORTRAN strings size = typeobj.sizeof data = self.readMemory(value.address, size) - self.putValue(data, Hex2EncodedLatin1, 1) + self.putValue(data, "latin1", 1) self.putType(typeobj) if typeobj.code != StructCode and typeobj.code != UnionCode: @@ -1336,8 +1318,7 @@ class Dumper(DumperBase): # s = self.readMemory(data, 2 * size) # # thread = gdb.selected_thread() - # inner = '{valueencoded="'; - # inner += str(Hex4EncodedLittleEndianWithoutQuotes)+'",id="' + # inner = '{valueencoded="uf16:2:0",id="' # inner += str(thread.num) + '",value="' # inner += s # #inner += self.encodeString(objectName) @@ -1748,7 +1729,7 @@ class CliDumper(Dumper): if self.passExceptions: showException("SUBITEM", exType, exValue, exTraceBack) self.putNumChild(0) - self.putSpecialValue(SpecialNotAccessibleValue) + self.putSpecialValue("notaccessible") try: if self.currentType.value: typeName = self.stripClassTag(self.currentType.value) @@ -1758,11 +1739,11 @@ class CliDumper(Dumper): self.put('<not accessible>') else: value = self.currentValue.value - if self.currentValue.encoding is Hex2EncodedLatin1: + if self.currentValue.encoding == "latin1": value = self.hexdecode(value) - elif self.currentValue.encoding is Hex2EncodedUtf8: + elif self.currentValue.encoding == "utf8": value = self.hexdecode(value) - elif self.currentValue.encoding is Hex4EncodedLittleEndian: + elif self.currentValue.encoding == "utf16": b = bytes.fromhex(value) value = codecs.decode(b, 'utf-16') self.put('"%s"' % value) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 9d04b9c87c..51630ab0de 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -266,15 +266,14 @@ class Dumper(DumperBase): if self.passExceptions: showException("SUBITEM", exType, exValue, exTraceBack) self.putNumChild(0) - self.putSpecialValue(SpecialNotAccessibleValue) + self.putSpecialValue("notaccessible") try: if self.currentType.value: typeName = self.currentType.value if len(typeName) > 0 and typeName != self.currentChildType: self.put('type="%s",' % typeName) # str(type.unqualified()) ? if self.currentValue.value is None: - self.put('value="",encoding="%d",numchild="0",' - % SpecialNotAccessibleValue) + self.put('value="",encoding="notaccessible",numchild="0",') else: if not self.currentValue.encoding is None: self.put('valueencoded="%s",' % self.currentValue.encoding) @@ -571,28 +570,14 @@ class Dumper(DumperBase): size = typeobj.sizeof if code == lldb.eTypeClassBuiltin: name = str(typeobj) - if name == "float": - return Hex2EncodedFloat4 - if name == "double": - return Hex2EncodedFloat8 - if name.find("unsigned") >= 0: - if size == 1: - return Hex2EncodedUInt1 - if size == 2: - return Hex2EncodedUInt2 - if size == 4: - return Hex2EncodedUInt4 - if size == 8: - return Hex2EncodedUInt8 + if name == 'float': + return 'float:4' + if name == 'double': + return 'float:8' + if name.find('unsigned') >= 0: + return 'uint:%d' % size else: - if size == 1: - return Hex2EncodedInt1 - if size == 2: - return Hex2EncodedInt2 - if size == 4: - return Hex2EncodedInt4 - if size == 8: - return Hex2EncodedInt8 + return 'int:%d' % size return None def createPointerValue(self, address, pointeeType): diff --git a/share/qtcreator/debugger/misctypes.py b/share/qtcreator/debugger/misctypes.py index 0e29a9bb32..27eecf3fb1 100644 --- a/share/qtcreator/debugger/misctypes.py +++ b/share/qtcreator/debugger/misctypes.py @@ -178,7 +178,7 @@ def qdump_Array(d, value): t = cleanDType(value.type)[7:] d.putType("%s[%d]" % (t, n)) if t == "char": - d.putValue(encodeCharArray(p, 100), Hex2EncodedLocal8Bit) + d.putValue(encodeCharArray(p, 100), "local8bit") d.putNumChild(0) else: d.putEmptyValue() diff --git a/share/qtcreator/debugger/pdbbridge.py b/share/qtcreator/debugger/pdbbridge.py index 4c68ffc7fb..83c7c4d392 100644 --- a/share/qtcreator/debugger/pdbbridge.py +++ b/share/qtcreator/debugger/pdbbridge.py @@ -1537,19 +1537,19 @@ class Dumper: v = value self.putType(tt) self.putValue(self.hexencode(v)) - self.putField("valueencoded", 6) + self.putField("valueencoded", "utf8") self.putNumChild(0) elif tt == "unicode": v = value self.putType(tt) self.putValue(self.hexencode(v)) - self.putField("valueencoded", 6) + self.putField("valueencoded", "utf8") self.putNumChild(0) elif tt == "buffer": v = str(value) self.putType(tt) self.putValue(self.hexencode(v)) - self.putField("valueencoded", 6) + self.putField("valueencoded", "latin1") self.putNumChild(0) elif tt == "xrange": b = iter(value).next() diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index 6f3685375a..5a057aa3de 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -63,15 +63,15 @@ def qdump__QByteArray(d, value): elided, p = d.encodeByteArrayHelper(d.extractPointer(value), d.displayStringLimit) displayFormat = d.currentItemFormat() if displayFormat == AutomaticFormat or displayFormat == Latin1StringFormat: - d.putValue(p, Hex2EncodedLatin1, elided=elided) + d.putValue(p, "latin1", elided=elided) elif displayFormat == SeparateLatin1StringFormat: - d.putValue(p, Hex2EncodedLatin1, elided=elided) + d.putValue(p, "latin1", elided=elided) d.putField("editformat", DisplayLatin1String) d.putField("editvalue", d.encodeByteArray(value, limit=100000)) elif displayFormat == Utf8StringFormat: - d.putValue(p, Hex2EncodedUtf8, elided=elided) + d.putValue(p, "utf8", elided=elided) elif displayFormat == SeparateUtf8StringFormat: - d.putValue(p, Hex2EncodedUtf8, elided=elided) + d.putValue(p, "utf8", elided=elided) d.putField("editformat", DisplayUtf8String) d.putField("editvalue", d.encodeByteArray(value, limit=100000)) if d.isExpanded(): @@ -80,7 +80,7 @@ def qdump__QByteArray(d, value): def qdump__QByteArrayData(d, value): data, size, alloc = d.byteArrayDataHelper(d.addressOf(value)) d.check(alloc == 0 or (0 <= size and size <= alloc and alloc <= 100000000)) - d.putValue(d.readMemory(data, size), Hex2EncodedLatin1) + d.putValue(d.readMemory(data, size), "latin1") d.putNumChild(1) if d.isExpanded(): with Children(d): @@ -195,7 +195,7 @@ def qdump__QModelIndex(d, value): def qdump__QDate(d, value): jd = int(value["jd"]) if jd: - d.putValue(jd, JulianDate) + d.putValue(jd, "juliandate") d.putNumChild(1) if d.isExpanded(): # FIXME: This improperly uses complex return values. @@ -218,7 +218,7 @@ def qdump__QDate(d, value): def qdump__QTime(d, value): mds = int(value["mds"]) if mds >= 0: - d.putValue(mds, MillisecondsSinceMidnight) + d.putValue(mds, "millisecondssincemidnight") d.putNumChild(1) if d.isExpanded(): # FIXME: This improperly uses complex return values. @@ -282,7 +282,7 @@ def qdump__QDateTime(d, value): idBase = tzp + 2 * d.ptrSize() # [QSharedData] + [vptr] elided, tz = d.encodeByteArrayHelper(d.extractPointer(idBase), limit=100) d.putValue("%s/%s/%s/%s/%s" % (msecs, spec, offset, tz, status), - DateTimeInternal) + "datetimeinternal") else: # This relies on the Qt4/Qt5 internal structure layout: # {sharedref(4), date(8), time(4+x)} @@ -302,7 +302,7 @@ def qdump__QDateTime(d, value): isValid = mds > 0 if isValid: jd = d.extractInt(dateBase) - d.putValue("%s/%s" % (jd, mds), JulianDateAndMillisecondsSinceMidnight) + d.putValue("%s/%s" % (jd, mds), "juliandateandmillisecondssincemidnight") if isValid: d.putNumChild(1) if d.isExpanded(): @@ -711,7 +711,7 @@ def qdump__QHostAddress(d, value): # value.d.d->ipString ipString = d.encodeString(ipStringAddress, limit=100) if d.extractByte(isParsedAddress) and len(ipString) > 0: - d.putValue(ipString, Hex4EncodedLittleEndian) + d.putValue(ipString, "utf16") else: # value.d.d->protocol: # QAbstractSocket::IPv4Protocol = 0 @@ -723,7 +723,7 @@ def qdump__QHostAddress(d, value): address = ':'.join("%x" % int(data[i:i+4], 16) for i in xrange(0, 32, 4)) scopeIdAddress = ipStringAddress + sizeofQString scopeId = d.encodeString(scopeIdAddress, limit=100) - d.putValue("%s%%%s" % (address, scopeId), IPv6AddressAndHexScopeId) + d.putValue("%s%%%s" % (address, scopeId), "ipv6addressandhexscopeid") elif proto == 0: # value.d.d->a a = d.extractInt(privAddress + 2 * sizeofQString) @@ -742,7 +742,7 @@ def qdump__QHostAddress(d, value): # value.d.d->ipString ipString = d.encodeString(ipStringAddress, limit=100) if d.extractByte(isParsedAddress) and len(ipString) > 0: - d.putValue(ipString, Hex4EncodedLittleEndian) + d.putValue(ipString, "utf16") else: # value.d.d->protocol: # QAbstractSocket::IPv4Protocol = 0 @@ -756,7 +756,7 @@ def qdump__QHostAddress(d, value): address = ':'.join("%x" % int(data[i:i+4], 16) for i in xrange(0, 32, 4)) scopeId = privAddress + sizeofQString + (0 if isQt5 else 24) scopeId = d.encodeString(scopeId, limit=100) - d.putValue("%s%%%s" % (address, scopeId), IPv6AddressAndHexScopeId) + d.putValue("%s%%%s" % (address, scopeId), "ipv6addressandhexscopeid") elif proto == 0: # value.d.d->a a = d.extractInt(privAddress + (2 * sizeofQString if isQt5 else 0)) @@ -1131,16 +1131,16 @@ def qdump__QMetaObject(d, value): #d.putAddressItem("_data", data) #d.putAddressItem("_sd_", stringdata) #with SubItem(d, "_sd"): - # d.putValue(d.readMemory(stringdata, size), Hex2EncodedLatin1) + # d.putValue(d.readMemory(stringdata, size), "latin1") #with SubItem(d, "_cn"): - # d.putValue(d.readMemory(stringdata + d.extractInt(data + 4), size), Hex2EncodedLatin1) + # d.putValue(d.readMemory(stringdata + d.extractInt(data + 4), size), "latin1") #for i in range(propertyCount): # with SubItem(d, "property_%s" % i): # x = data + (propertyData + 3 * i) * 4 # literal = sd + d.extractInt(x) * byteArrayDataSize # ldata, lsize, lalloc = d.byteArrayDataHelper(literal) - # d.putValue(d.readMemory(ldata, lsize), Hex2EncodedLatin1) + # d.putValue(d.readMemory(ldata, lsize), "latin1") # d.putNumChild(1) # if d.isExpanded(): @@ -1304,7 +1304,7 @@ def _qdump__QObject(d, value): with SubItem(d, i): pp = p.cast(namesType.pointer()).dereference(); d.putField("key", d.encodeByteArray(pp)) - d.putField("keyencoded", Hex2EncodedLatin1) + d.putField("keyencoded", "latin1") qq = q.cast(valuesType.pointer().pointer()) qq = qq.dereference(); d.putField("address", d.cleanAddress(qq)) @@ -1592,7 +1592,7 @@ def qdump__QRegExp(d, value): def qdump__QRegion(d, value): p = value["d"].dereference()["qt_rgn"] if d.isNull(p): - d.putSpecialValue(SpecialEmptyValue) + d.putSpecialValue("empty") d.putNumChild(0) else: # struct QRegionPrivate: @@ -1806,7 +1806,7 @@ def qdump__QStringRef(d, value): data += 2 * int(value["m_position"]) size = int(value["m_size"]) s = d.readMemory(data, 2 * size) - d.putValue(s, Hex4EncodedLittleEndian) + d.putValue(s, "utf16") d.putPlainChildren(value) @@ -1873,7 +1873,7 @@ def qdump__QUrl(d, value): d.putValue("<invalid>") return encodedOriginalAddress = privAddress + 8 * d.ptrSize() - d.putValue(d.encodeByteArrayHelper(d.extractPointer(encodedOriginalAddress), 100), Hex2EncodedLatin1) + d.putValue(d.encodeByteArrayHelper(d.extractPointer(encodedOriginalAddress), 100), "latin1") d.putNumChild(8) if d.isExpanded(): stringType = d.lookupType(d.qtNamespace() + "QString") @@ -1925,7 +1925,7 @@ def qdump__QUrl(d, value): url += "3a00" url += ''.join(["%02x00" % ord(c) for c in str(port)]) url += path - d.putValue(url, Hex4EncodedLittleEndian) + d.putValue(url, "utf16") displayFormat = d.currentItemFormat() if displayFormat == SeparateFormat: @@ -1937,13 +1937,13 @@ def qdump__QUrl(d, value): stringType = d.lookupType(d.qtNamespace() + "QString") with Children(d): d.putIntItem("port", port) - d.putGenericItem("scheme", stringType, scheme, Hex4EncodedLittleEndian) - d.putGenericItem("userName", stringType, userName, Hex4EncodedLittleEndian) - d.putGenericItem("password", stringType, password, Hex4EncodedLittleEndian) - d.putGenericItem("host", stringType, host, Hex4EncodedLittleEndian) - d.putGenericItem("path", stringType, path, Hex4EncodedLittleEndian) - d.putGenericItem("query", stringType, query, Hex4EncodedLittleEndian) - d.putGenericItem("fragment", stringType, fragment, Hex4EncodedLittleEndian) + d.putGenericItem("scheme", stringType, scheme, "utf16") + d.putGenericItem("userName", stringType, userName, "utf16") + d.putGenericItem("password", stringType, password, "utf16") + d.putGenericItem("host", stringType, host, "utf16") + d.putGenericItem("path", stringType, path, "utf16") + d.putGenericItem("query", stringType, query, "utf16") + d.putGenericItem("fragment", stringType, fragment, "utf16") d.putFields(value) @@ -2281,7 +2281,7 @@ def qdump__QXmlStreamStringRef(d, value): data += 2 * int(value["m_position"]) size = int(value["m_size"]) s = d.readMemory(data, 2 * size) - d.putValue(s, Hex4EncodedLittleEndian) + d.putValue(s, "utf16") d.putPlainChildren(value) @@ -2291,7 +2291,7 @@ def qdump__QXmlStreamAttribute(d, value): data += 2 * int(value["m_name"]["m_position"]) size = int(value["m_name"]["m_size"]) s = d.readMemory(data, 2 * size) - d.putValue(s, Hex4EncodedLittleEndian) + d.putValue(s, "utf16") d.putPlainChildren(value) @@ -2363,7 +2363,7 @@ def qdump__QV4__Value(d, value): d.putValue("%d" % vv) elif v & IsDoubleMask: d.putBetterType("%sQV4::Value (double)" % ns) - d.putValue("%x" % (v ^ 0xffff800000000000), Hex2EncodedFloat8) + d.putValue("%x" % (v ^ 0xffff800000000000), "float:8") elif d.isNull(v): d.putBetterType("%sQV4::Value (null)" % ns) d.putValue("(null)") @@ -2626,10 +2626,10 @@ def qdumpHelper__QJsonValue(d, data, base, pv): data = base + v; if latinOrIntValue: length = d.extractUShort(data) - d.putValue(d.readMemory(data + 2, length), Hex2EncodedLatin1) + d.putValue(d.readMemory(data + 2, length), "latin1") else: length = d.extractUInt(data) - d.putValue(d.readMemory(data + 4, length * 2), Hex4EncodedLittleEndian) + d.putValue(d.readMemory(data + 4, length * 2), "utf16") d.putNumChild(1) return if t == 4: @@ -2696,11 +2696,11 @@ def qdumpHelper__QJsonObject(d, data, obj): if isLatinKey: keyLength = d.extractUShort(keyStart) d.put('key="%s",' % d.readMemory(keyStart + 2, keyLength)) - d.put('keyencoded="%s",' % Hex2EncodedLatin1) + d.put('keyencoded="latin1",') else: keyLength = d.extractUInt(keyStart) d.put('key="%s",' % d.readMemory(keyStart + 4, keyLength)) - d.put('keyencoded="%s",' % Hex4EncodedLittleEndian) + d.put('keyencoded="utf16",') qdumpHelper__QJsonValue(d, data, obj, val) |