forked from qt-creator/qt-creator
debugger: simplify QList dumper
This commit is contained in:
@@ -1613,31 +1613,28 @@ static void qDumpQList(QDumper &d)
|
|||||||
// This uses the knowledge that QList<T> has only a single member
|
// This uses the knowledge that QList<T> has only a single member
|
||||||
// of type union { QListData p; QListData::Data *d; };
|
// of type union { QListData p; QListData::Data *d; };
|
||||||
|
|
||||||
const QListData &ldata = *reinterpret_cast<const QListData*>(d.data);
|
const QListData &pdata = *reinterpret_cast<const QListData*>(d.data);
|
||||||
const QListData::Data *pdata =
|
const int nn = pdata.size();
|
||||||
*reinterpret_cast<const QListData::Data* const*>(d.data);
|
|
||||||
const int nn = ldata.size();
|
|
||||||
if (nn < 0)
|
if (nn < 0)
|
||||||
return;
|
return;
|
||||||
const bool innerTypeIsPointer = isPointerType(d.innerType);
|
const bool innerTypeIsPointer = isPointerType(d.innerType);
|
||||||
const int n = qMin(nn, 1000);
|
const int n = qMin(nn, 1000);
|
||||||
if (nn > 0) {
|
if (nn > 0) {
|
||||||
if (ldata.d->begin < 0)
|
if (pdata.d->begin < 0)
|
||||||
return;
|
return;
|
||||||
if (ldata.d->begin > ldata.d->end)
|
if (pdata.d->begin > pdata.d->end)
|
||||||
return;
|
return;
|
||||||
#if QT_VERSION >= 0x040400
|
#if QT_VERSION >= 0x040400
|
||||||
if (ldata.d->ref._q_value <= 0)
|
if (pdata.d->ref._q_value <= 0)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
qCheckAccess(ldata.d->array);
|
qCheckAccess(pdata.d->array);
|
||||||
// Additional checks on pointer arrays
|
// Additional checks on pointer arrays
|
||||||
if (innerTypeIsPointer)
|
if (innerTypeIsPointer)
|
||||||
for (int i = 0; i != n; ++i)
|
for (int i = 0; i != n; ++i)
|
||||||
if (const void *p = ldata.d->array + i + pdata->begin)
|
if (const void *p = pdata.d->array + i + pdata.d->begin)
|
||||||
qCheckPointer(deref(p));
|
qCheckPointer(deref(p));
|
||||||
}
|
}
|
||||||
qCheckAccess(pdata);
|
|
||||||
|
|
||||||
d.putItemCount("value", nn);
|
d.putItemCount("value", nn);
|
||||||
d.putItem("valueeditable", "false");
|
d.putItem("valueeditable", "false");
|
||||||
@@ -1658,7 +1655,7 @@ static void qDumpQList(QDumper &d)
|
|||||||
for (int i = 0; i != n; ++i) {
|
for (int i = 0; i != n; ++i) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
if (innerTypeIsPointer) {
|
if (innerTypeIsPointer) {
|
||||||
void *p = ldata.d->array + i + pdata->begin;
|
void *p = pdata.d->array + i + pdata.d->begin;
|
||||||
d.putItem("saddr", p);
|
d.putItem("saddr", p);
|
||||||
if (*(void**)p) {
|
if (*(void**)p) {
|
||||||
//d.putItem("value","@").put(p);
|
//d.putItem("value","@").put(p);
|
||||||
@@ -1668,7 +1665,7 @@ static void qDumpQList(QDumper &d)
|
|||||||
d.putItem("numchild", "0");
|
d.putItem("numchild", "0");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
void *p = ldata.d->array + i + pdata->begin;
|
void *p = pdata.d->array + i + pdata.d->begin;
|
||||||
if (isInternal) {
|
if (isInternal) {
|
||||||
//qDumpInnerValue(d, d.innerType, p);
|
//qDumpInnerValue(d, d.innerType, p);
|
||||||
d.putItem("addr", p);
|
d.putItem("addr", p);
|
||||||
|
Reference in New Issue
Block a user