debugger: start merging views of static and dynamic QObject properties

This commit is contained in:
hjk
2010-06-08 17:46:32 +02:00
parent b662312bdd
commit 5b72a49158

View File

@@ -631,18 +631,12 @@ def qdump__QObject(d, item):
d.putItem(Item(d_ptr["parent"], item.iname, "parent", "parent")) d.putItem(Item(d_ptr["parent"], item.iname, "parent", "parent"))
d.putItem(Item(d_ptr["children"], item.iname, "children", "children")) d.putItem(Item(d_ptr["children"], item.iname, "children", "children"))
# User properties. # Properties.
with SubItem(d): with SubItem(d):
d.putName("userprops") # Prolog
d.putType(" ")
extraData = d_ptr["extraData"] # Capitalization! extraData = d_ptr["extraData"] # Capitalization!
if isNull(extraData): if isNull(extraData):
#warn("EXTRADATA Z: %s " % extraData) dynamicPropertyCount = 0
d.putItemCount(0)
d.putNumChild(0)
if d.isExpandedIName(item.iname + ".userprops"):
with Children(d):
pass
else: else:
extraDataType = gdb.lookup_type( extraDataType = gdb.lookup_type(
d.ns + "QObjectPrivate::ExtraData").pointer() d.ns + "QObjectPrivate::ExtraData").pointer()
@@ -654,10 +648,22 @@ def qdump__QObject(d, item):
namesBegin = names["d"]["begin"] namesBegin = names["d"]["begin"]
namesEnd = names["d"]["end"] namesEnd = names["d"]["end"]
namesArray = names["d"]["array"] namesArray = names["d"]["array"]
userPropertyCount = namesEnd - namesBegin dynamicPropertyCount = namesEnd - namesBegin
d.putItemCount(userPropertyCount)
d.putNumChild(userPropertyCount) #staticPropertyCount = metaData[6]
if d.isExpandedIName(item.iname + ".userprops"): # FIXME: Replace with plain memory accesses.
staticPropertyCount = call(mo, "propertyCount()")
#warn("PROPERTY COUNT: %s" % staticPropertyCount)
propertyCount = staticPropertyCount + dynamicPropertyCount
d.putName("properties")
d.putType(" ")
d.putItemCount(propertyCount)
d.putNumChild(propertyCount)
if d.isExpandedIName(item.iname + ".properties"):
with Children(d, [propertyCount, 500]):
# Dynamic properties.
dummyType = gdb.lookup_type("void").pointer().pointer() dummyType = gdb.lookup_type("void").pointer().pointer()
namesType = gdb.lookup_type(d.ns + "QByteArray") namesType = gdb.lookup_type(d.ns + "QByteArray")
valuesBegin = values["d"]["begin"] valuesBegin = values["d"]["begin"]
@@ -666,44 +672,28 @@ def qdump__QObject(d, item):
valuesType = gdb.lookup_type(d.ns + "QVariant") valuesType = gdb.lookup_type(d.ns + "QVariant")
p = namesArray.cast(dummyType) + namesBegin p = namesArray.cast(dummyType) + namesBegin
q = valuesArray.cast(dummyType) + valuesBegin q = valuesArray.cast(dummyType) + valuesBegin
with Children(d, [userPropertyCount, 100]): for i in xrange(dynamicPropertyCount):
for i in xrange(userPropertyCount):
with SubItem(d): with SubItem(d):
warn("Q: %s" % q)
pp = p.cast(namesType.pointer()).dereference(); pp = p.cast(namesType.pointer()).dereference();
d.putField("key", encodeByteArray(pp)) d.putField("key", encodeByteArray(pp))
d.putField("keyencoded", Hex2EncodedLatin1) d.putField("keyencoded", Hex2EncodedLatin1)
qq = q.cast(valuesType.pointer().pointer()) qq = q.cast(valuesType.pointer().pointer())
warn("QQ: %s" % qq)
qq = qq.dereference(); qq = qq.dereference();
warn("QQ: %s" % q)
d.putField("addr", cleanAddress(qq)) d.putField("addr", cleanAddress(qq))
d.putField("exp", "*('%sQVariant'*)%s" d.putField("exp", "*('%sQVariant'*)%s"
% (d.ns, cleanAddress(qq))) % (d.ns, cleanAddress(qq)))
name = "%s.userprops.%d" % (item.iname, i) name = "%s.properties.%d" % (item.iname, i)
t = qdump__QVariant(d, Item(qq, name)) t = qdump__QVariant(d, Item(qq, name))
# Override the "QVariant (foo)" output # Override the "QVariant (foo)" output
d.putType(t, d.currentTypePriority + 1) d.putType(t, d.currentTypePriority + 1)
p += 1 p += 1
q += 1 q += 1
# Static properties.
# Properties.
with SubItem(d):
#propertyCount = metaData[6]
# FIXME: Replace with plain memory accesses.
propertyCount = call(mo, "propertyCount()")
#warn("PROPERTY COUNT: %s" % propertyCount)
propertyData = metaData[7] propertyData = metaData[7]
d.putName("properties") for i in xrange(staticPropertyCount):
d.putItemCount(propertyCount)
d.putType(" ")
d.putNumChild(propertyCount)
if d.isExpandedIName(item.iname + ".properties"):
with Children(d):
for property in xrange(propertyCount):
with SubItem(d): with SubItem(d):
offset = propertyData + 3 * property offset = propertyData + 3 * i
propertyName = extractCString(metaStringData, metaData[offset]) propertyName = extractCString(metaStringData, metaData[offset])
propertyType = extractCString(metaStringData, metaData[offset + 1]) propertyType = extractCString(metaStringData, metaData[offset + 1])
d.putName(propertyName) d.putName(propertyName)
@@ -719,6 +709,7 @@ def qdump__QObject(d, item):
if len(inner): if len(inner):
# Build-in types. # Build-in types.
d.putType(inner) d.putType(inner)
name = "%s.properties.%d" % (item.iname, i + dynamicPropertyCount)
d.putItemHelper(Item(val, item.iname + ".properties", d.putItemHelper(Item(val, item.iname + ".properties",
propertyName, propertyName)) propertyName, propertyName))
@@ -742,8 +733,7 @@ def qdump__QObject(d, item):
d.putValue("...") d.putValue("...")
d.putNumChild(0) d.putNumChild(0)
# Connections.
# connections
with SubItem(d): with SubItem(d):
connectionCount = 0 connectionCount = 0
d.putName("connections") d.putName("connections")