Commit 345221d7 authored by hjk's avatar hjk

Debugger: Add dumper for libc++'s std::unordered_map

Change-Id: I15bf32c1f77c17f42ee1da39f1353cff580fa6eb
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 16374760
......@@ -409,7 +409,7 @@ class DumperBase:
self.putNumChild(0)
def putMapName(self, value):
def putMapName(self, value, index = -1):
ns = self.qtNamespace()
if str(value.type) == ns + "QString":
self.put('key="%s",' % self.encodeString(value))
......@@ -418,10 +418,11 @@ class DumperBase:
self.put('key="%s",' % self.encodeByteArray(value))
self.put('keyencoded="%s",' % Hex2EncodedLatin1)
else:
if self.isLldb:
self.put('name="%s",' % value.GetValue())
val = str(value.GetValue()) if self.isLldb else str(value)
if index == -1:
self.put('name="%s",' % val)
else:
self.put('name="%s",' % value)
self.put('key="[%d] %s",' % (index, val))
def isMapCompact(self, keyType, valueType):
format = self.currentItemFormat()
......
......@@ -659,8 +659,28 @@ def qdump__std____1__unordered_map(d, value):
n = toInteger(value["__table_"]["__p2_"]["__first_"])
d.putItemCount(n)
if d.isExpanded():
with Children(d, 1):
d.putFields(value)
node = value["__table_"]["__p1_"]["__first_"]["__next_"]
#pos = toInteger(value["__table_"]["__p2_"]["__first_"])
#with Children(d, 1):
# d.putFields(value)
keyType = d.templateArgument(value.type, 0)
valueType = d.templateArgument(value.type, 1)
isCompact = d.isMapCompact(keyType, valueType)
with Children(d, n, maxNumChild=1000, childType=valueType):
for i in xrange(n):
pair = node["__value_"]
#d.putSubItem(i, pair)
with SubItem(d, i):
if isCompact:
d.putMapName(pair["first"], i)
d.putItem(pair["second"])
else:
d.putEmptyValue()
if d.isExpanded():
with Children(d, 2):
d.putSubItem("first", pair["first"])
d.putSubItem("second", pair["second"])
node = node["__next_"]
def qdump__std____debug__unordered_set(d, value):
qdump__std__unordered_set(d, value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment