From bed82747f40fc6ef0ebc1fde322a1056784aa181 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 3 Jul 2014 13:07:21 +0200 Subject: Debugger: Fix compact display of individual hash nodes This was not accessible if the hash itself was a typedef. Also, make sure that unusual key contents don't do any harm in the protocol by hexencoding it unconditionally. Change-Id: I83d43768ec72f797a72b2d9c44ca91b1feaf61a7 Reviewed-by: Christian Stenger --- share/qtcreator/debugger/dumper.py | 6 ++++-- share/qtcreator/debugger/qttypes.py | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index 9b9c4308b9..1912044226 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -600,9 +600,11 @@ class DumperBase: else: val = str(value.GetValue()) if self.isLldb else str(value) if index == -1: - self.put('name="%s",' % val) + key = 'key="%s",' % val else: - self.put('key="[%d] %s",' % (index, val)) + key = 'key="[%d] %s",' % (index, val) + self.put('key="%s",' % self.hexencode(key)) + self.put('keyencoded="%s",' % Hex2EncodedLatin1) def putPair(self, pair, index = -1): if self.pairData.useKeyAndValue: diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index b950db9417..b110e50cfb 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -638,6 +638,9 @@ def qdump__QHash(d, value): d.putItem(it) +def qform__QHashNode(): + return mapForms() + def qdump__QHashNode(d, value): key = value["key"] if not key: @@ -645,12 +648,17 @@ def qdump__QHashNode(d, value): # for Qt4 optimized int keytype key = value[1]["key"] val = value["value"] - d.putEmptyValue() - d.putNumChild(2) - if d.isExpanded(): - with Children(d): - d.putSubItem("key", key) - d.putSubItem("value", val) + if d.isMapCompact(key.type, val.type): + d.putMapName(key) + d.putItem(val) + d.putType(value.type) + else: + d.putEmptyValue() + d.putNumChild(2) + if d.isExpanded(): + with Children(d): + d.putSubItem("key", key) + d.putSubItem("value", val) def qHashIteratorHelper(d, value): -- cgit v1.2.1