Commit ccf0abf7 authored by hjk's avatar hjk

Debugger: Fix Q{Size,Rect,Point}F dumpers

They were only showing the integral parts in the
summary line. Duh...

Change-Id: I5efd7a9d5b7bfd6ffd68dcda824c95dd7a7a52b0
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 7a359baa
......@@ -258,7 +258,16 @@ def impl_SBValue__le__(self, other):
def impl_SBValue__int__(self):
return self.GetValueAsSigned()
#return int(self.GetValue(), 0)
def impl_SBValue__float__(self):
error = lldb.SBError()
if self.GetType().GetByteSize() == 4:
result = self.GetData().GetFloat(error, 0)
else:
result = self.GetData().GetDouble(error, 0)
if error.Success():
return result
return NotImplemented
def impl_SBValue__long__(self):
return int(self.GetValue(), 0)
......@@ -286,6 +295,7 @@ lldb.SBValue.__le__ = impl_SBValue__le__
lldb.SBValue.__getitem__ = impl_SBValue__getitem__
lldb.SBValue.__int__ = impl_SBValue__int__
lldb.SBValue.__float__ = impl_SBValue__float__
lldb.SBValue.__long__ = lambda self: long(self.GetValue(), 0)
lldb.SBValue.code = lambda self: self.GetTypeClass()
......
......@@ -1513,10 +1513,10 @@ def qdump__QRect(d, value):
def pp(l):
if l >= 0: return "+%s" % l
return l
x1 = value["x1"]
y1 = value["y1"]
x2 = value["x2"]
y2 = value["y2"]
x1 = int(value["x1"])
y1 = int(value["y1"])
x2 = int(value["x2"])
y2 = int(value["y2"])
w = x2 - x1 + 1
h = y2 - y1 + 1
d.putValue("%sx%s%s%s" % (w, h, pp(x1), pp(y1)))
......@@ -1530,15 +1530,10 @@ def qdump__QRectF(d, value):
def pp(l):
if l >= 0: return "+%s" % l
return l
x = value["xp"]
y = value["yp"]
w = value["w"]
h = value["h"]
# FIXME: workaround, see QPoint
x = x.cast(x.type.strip_typedefs())
y = y.cast(y.type.strip_typedefs())
w = w.cast(w.type.strip_typedefs())
h = h.cast(h.type.strip_typedefs())
x = float(value["xp"])
y = float(value["yp"])
w = float(value["w"])
h = float(value["h"])
d.putValue("%sx%s%s%s" % (w, h, pp(x), pp(y)))
d.putNumChild(4)
if d.isExpanded():
......@@ -1695,8 +1690,8 @@ def qdump__QSharedPointer(d, value):
def qdump__QSize(d, value):
w = value["wd"]
h = value["ht"]
w = int(value["wd"])
h = int(value["ht"])
d.putValue("(%s, %s)" % (w, h))
d.putNumChild(2)
if d.isExpanded():
......@@ -1705,7 +1700,13 @@ def qdump__QSize(d, value):
def qdump__QSizeF(d, value):
qdump__QSize(d, value)
w = float(value["wd"])
h = float(value["ht"])
d.putValue("(%s, %s)" % (w, h))
d.putNumChild(2)
if d.isExpanded():
with Children(d):
d.putFields(value)
def qdump__QStack(d, value):
......
......@@ -2053,10 +2053,10 @@ void tst_Dumpers::dumper_data()
"#include <QString> // Dummy for namespace\n",
"QString dummy;\n"
"QPointF s0, s;\n"
"s = QPointF(100, 200);\n")
"s = QPointF(100.5, 200.5);\n")
% CoreProfile()
% Check("s0", "(0.0, 0.0)", "@QPointF")
% Check("s", "(100.0, 200.0)", "@QPointF");
% Check("s", "(100.5, 200.5)", "@QPointF");
QTest::newRow("QRect")
<< Data("#include <QRect>\n"
......@@ -2072,9 +2072,9 @@ void tst_Dumpers::dumper_data()
"#include <QString> // Dummy for namespace\n",
"QString dummy;\n"
"QRectF rect0, rect;\n"
"rect = QRectF(100, 100, 200, 200);\n")
"rect = QRectF(100.25, 100.25, 200.5, 200.5);\n")
% Check("rect", "0x0+0+0", "@QRectF")
% Check("rect", "200x200+100+100", "@QRectF");
% Check("rect", "200.5x200.5+100.25+100.25", "@QRectF");
QTest::newRow("QSize")
<< Data("#include <QSize>\n"
......@@ -2091,10 +2091,10 @@ void tst_Dumpers::dumper_data()
"#include <QString> // Dummy for namespace\n",
"QString dummy;\n"
"QSizeF s0, s;\n"
"s = QSizeF(100, 200);\n")
"s = QSizeF(100.5, 200.5);\n")
% CoreProfile()
% Check("s0", "(-1, -1)", "@QSizeF")
% Check("s", "(100, 200)", "@QSizeF");
% Check("s0", "(-1.0, -1.0)", "@QSizeF")
% Check("s", "(100.5, 200.5)", "@QSizeF");
QTest::newRow("QRegion")
<< Data("#include <QRegion>\n"
......@@ -3181,7 +3181,7 @@ void tst_Dumpers::dumper_data()
"QVariant var10(QString(\"Hello 10\")); // 10, QString\n"
"QVariant var11(QStringList() << \"Hello\" << \"World\"); // 11, QStringList\n"
"QVariant var19(QRect(100, 200, 300, 400)); // 19 QRect\n"
"QVariant var20(QRectF(100, 200, 300, 400)); // 20 QRectF\n"
"QVariant var20(QRectF(100.5, 200.5, 300.5, 400.5)); // 20 QRectF\n"
)
% CoreProfile()
% Check("var", "(invalid)", "@QVariant (invalid)")
......@@ -3196,7 +3196,7 @@ void tst_Dumpers::dumper_data()
% Check("var11", "<2 items>", "@QVariant (QStringList)")
% Check("var11.1", "[1]", "\"World\"", "@QString")
% Check("var19", "300x400+100+200", "@QVariant (QRect)")
% Check("var20", "300x400+100+200", "@QVariant (QRectF)");
% Check("var20", "300.5x400.5+100.5+200.5", "@QVariant (QRectF)");
/*
"QByteArray", # 12
......
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