Debugger: Extend and fix QPolygon dumper and test for Qt6

Task-number: QTCREATORBUG-24098
Change-Id: Ia2e43d15263e18698d9db6b4d23fa553c7b7ae5b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-12-01 13:15:29 +01:00
parent b1f5bfdd4e
commit 08a1117c26
2 changed files with 10 additions and 4 deletions

View File

@@ -556,9 +556,10 @@ class DumperBase():
return size, limit
def vectorData(self, value):
vector_data_ptr = self.extractPointer(value)
# vector_data_ptr is what is e.g. stored in a QVector's d_ptr.
if self.qtVersion() >= 0x050000:
if self.qtVersion() >= 0x060000:
data, size, alloc = self.qArrayData(value)
elif self.qtVersion() >= 0x050000:
vector_data_ptr = self.extractPointer(value)
if self.ptrSize() == 4:
(ref, size, alloc, offset) = self.split('IIIp', vector_data_ptr)
else:
@@ -566,6 +567,7 @@ class DumperBase():
alloc = alloc & 0x7ffffff
data = vector_data_ptr + offset
else:
vector_data_ptr = self.extractPointer(value)
(ref, alloc, size) = self.split('III', vector_data_ptr)
data = vector_data_ptr + 16
self.check(0 <= size and size <= alloc and alloc <= 1000 * 1000 * 1000)
@@ -708,7 +710,7 @@ class DumperBase():
return self.encodedUtf16ToUtf8(self.encodeString(value, limit))
def stringData(self, value): # -> (data, size, alloc)
return self.qArrayData(value)
return self.qArrayData(value)
def extractTemplateArgument(self, typename, position):
level = 0

View File

@@ -7442,6 +7442,8 @@ void tst_Dumpers::dumper_data()
"QApplication app(argc, argv);\n"
"QGraphicsScene sc;\n"
"QPolygon p0;\n"
"QPolygonF p1;\n"
"QPolygonF pol;\n"
"pol.append(QPointF(1, 2));\n"
"pol.append(QPointF(2, 2));\n"
@@ -7454,6 +7456,8 @@ void tst_Dumpers::dumper_data()
+ GuiProfile()
+ Check("p0", "<0 items>", "@QPolygon")
+ Check("p1", "<0 items>", "@QPolygonF")
+ Check("pol", "<5 items>", "@QPolygonF")
+ Check("p", "<5 items>", "@QGraphicsPolygonItem");