Commit dd714e9c authored by hjk's avatar hjk
Browse files

debugger: improve QVariant(QString) dumper

parent df0e1e56
......@@ -843,7 +843,7 @@ class FrameCommand(gdb.Command):
d.typeformats = typeformats
d.formats = formats
d.useFancy = useFancy
d.passExceptions = "passexceptions" in options
d.passExceptions = "pe" in options
d.autoDerefPointers = "autoderef" in options
d.ns = qtNamespace()
d.expandedINames = expandedINames
......
......@@ -1461,9 +1461,9 @@ def qdump__QUrl(d, item):
def qdumpHelper__QVariant(d, value):
#warn("VARIANT TYPE: %s : " % variantType)
data = value["d"]["data"]
variantType = int(value["d"]["type"])
#warn("VARIANT TYPE: %s : " % variantType)
val = None
inner = ""
innert = ""
......@@ -1605,15 +1605,18 @@ def qdumpHelper__QVariant(d, value):
def qdump__QVariant(d, item):
val, inner, innert = qdumpHelper__QVariant(d, item.value)
#warn("VARIANT DATA: '%s' '%s' '%s': " % (val, inner, innert))
if len(inner):
# Build-in types.
#d.putValue("(%s)" % innert)
d.putType("%sQVariant (%s)" % (d.ns, innert))
d.putNumChild(1)
if d.isExpanded(item):
with Children(d):
d.putItem(Item(val, item.iname, "data", "data"))
if len(inner):
innerType = gdb.lookup_type(inner)
# FIXME: Why "shared"?
if innerType.sizeof > item.value["d"]["data"].type.sizeof:
v = item.value["d"]["data"]["shared"]["ptr"] \
.cast(innerType.pointer()).dereference()
else:
v = item.value["d"]["data"].cast(innerType)
d.putItemHelper(Item(v, item.iname))
d.putType("%sQVariant (%s)" % (d.ns, innert), d.currentTypePriority + 1)
else:
# User types.
d_member = item.value["d"]
......
......@@ -1259,15 +1259,16 @@ void testQThread()
thread2.wait();
}
QVariant testQVariant1()
void testQVariant1()
{
QVariant v;
v = 1;
v = 1.0;
v = "string";
v = QRect(100, 200, 300, 400);
v = QRectF(100, 200, 300, 400);
v = 1;
return v;
//return v;
}
QVariant testQVariant2()
......@@ -1313,7 +1314,7 @@ QVariant testQVariant2()
var.setValue(my);
var.setValue(my);
#endif
return value;
return QVariant("sss");
}
QVariant testQVariant3()
......@@ -1331,7 +1332,7 @@ QVariant testQVariant3()
QVariant variant = qVariantFromValue(list);
list.clear();
list = qVariantValue<QList<int> >(variant);
return variant;
return QVariant("xxx");
}
QVector<int> testQVector()
......
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