Commit 56b24aac authored by hjk's avatar hjk
Browse files

debugger: reduce amount of data produced by the dumpers by removing

predicatable parts.
parent ef786bf3
......@@ -1202,7 +1202,6 @@ static void qDumpQByteArray(QDumper &d)
unsigned char u = (isprint(c) && c != '\'' && c != '"') ? c : '?';
sprintf(buf, "%02x (%u '%c')", c, c, u);
d.beginHash();
d.putItem("name", i);
d.putItem("value", buf);
d.endHash();
}
......@@ -1490,7 +1489,6 @@ static void qDumpQHash(QDumper &d)
d.beginChildren();
while (node != end) {
d.beginHash();
d.putItem("name", i);
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
if (isSimpleKey && isSimpleValue) {
......@@ -1632,7 +1630,6 @@ static void qDumpQList(QDumper &d)
d.beginChildren(n ? d.innertype : 0);
for (int i = 0; i != n; ++i) {
d.beginHash();
d.putItem("name", i);
if (innerTypeIsPointer) {
void *p = ldata.d->array + i + pdata->begin;
d.putItem("saddr", p);
......@@ -1691,7 +1688,6 @@ static void qDumpQLinkedList(QDumper &d)
const void *p = deref(ldata);
for (int i = 0; i != n; ++i) {
d.beginHash();
d.putItem("name", i);
const void *addr = addOffset(p, 2 * sizeof(void*));
qDumpInnerValueOrPointer(d, d.innertype, stripped, addr);
p = deref(p);
......@@ -1837,7 +1833,6 @@ static void qDumpQMap(QDumper &d)
while (node != end) {
d.beginHash();
d.putItem("name", i);
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
if (isSimpleKey && isSimpleValue) {
......@@ -2568,7 +2563,6 @@ static void qDumpQObjectChildList(QDumper &d)
d.beginChildren();
for (int i = 0; i != size; ++i) {
d.beginHash();
d.putItem("name", i);
qDumpInnerValueHelper(d, NS"QObject *", children.at(i));
d.endHash();
}
......@@ -2616,7 +2610,6 @@ static void qDumpQSet(QDumper &d)
for (int bucket = 0; bucket != hd->numBuckets && i <= 10000; ++bucket) {
for (node = hd->buckets[bucket]; node->next; node = node->next) {
d.beginHash();
d.putItem("name", i);
d.putItem("type", d.innertype);
d.beginItem("exp");
d.put("(('"NS"QHashNode<").put(d.innertype
......@@ -2721,7 +2714,6 @@ static void qDumpQStringList(QDumper &d)
d.beginChildren(n ? NS"QString" : 0);
for (int i = 0; i != n; ++i) {
d.beginHash();
d.putItem("name", i);
d.putItem("value", list[i]);
d.putItem("valueencoded", "2");
d.endHash();
......@@ -2780,7 +2772,6 @@ static void qDumpQVector(QDumper &d)
d.beginChildren(d.innertype);
for (int i = 0; i != n; ++i) {
d.beginHash();
d.putItem("name", i);
qDumpInnerValueOrPointer(d, d.innertype, stripped,
addOffset(v, i * innersize + typeddatasize));
d.endHash();
......@@ -2876,7 +2867,6 @@ static void qDumpStdList(QDumper &d)
it = list.begin();
for (int i = 0; i < 1000 && it != cend; ++i, ++it) {
d.beginHash();
d.putItem("name", i);
qDumpInnerValueOrPointer(d, d.innertype, stripped, it.operator->());
d.endHash();
}
......@@ -2944,7 +2934,6 @@ static void qDumpStdMapHelper(QDumper &d)
for (int i = 0; i < 1000 && it != cend; ++i, ++it) {
d.beginHash();
const void *node = it.operator->();
d.putItem("name", i);
qDumpInnerValueHelper(d, keyType, node, "key");
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
if (isSimpleKey && isSimpleValue) {
......@@ -3039,7 +3028,6 @@ static void qDumpStdSetHelper(QDumper &d)
for (int i = 0; i < 1000 && it != cend; ++i, ++it) {
const void *node = it.operator->();
d.beginHash();
d.putItem("name", i);
qDumpInnerValueOrPointer(d, d.innertype, stripped, node);
d.endHash();
}
......@@ -3143,7 +3131,6 @@ static void qDumpStdVector(QDumper &d)
d.beginChildren(n ? d.innertype : 0);
for (int i = 0; i != n; ++i) {
d.beginHash();
d.putItem("name", i);
qDumpInnerValueOrPointer(d, d.innertype, stripped,
addOffset(v->start, i * innersize));
d.endHash();
......
......@@ -3419,9 +3419,14 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
setWatchDataChildCount(childtemplate, contents.findChild("childnumchild"));
//qDebug() << "DATA:" << data.toString();
insertData(data);
int i = 0;
foreach (GdbMi item, children.children()) {
WatchData data1 = childtemplate;
data1.name = _(item.findChild("name").data());
GdbMi name = item.findChild("name");
if (name.isValid())
data1.name = _(name.data());
else
data1.name = QString::number(i);
data1.iname = data.iname + _c('.') + data1.name;
if (!data1.name.isEmpty() && data1.name.at(0).isDigit())
data1.name = _c('[') + data1.name + _c(']');
......@@ -3450,6 +3455,7 @@ void GdbEngine::handleDebuggingHelperValue2(const GdbResultRecord &record,
data1.setChildrenUnneeded();
//qDebug() << "HANDLE CUSTOM SUBCONTENTS:" << data1.toString();
insertData(data1);
++i;
}
}
......
......@@ -415,8 +415,8 @@ void tst_Debugger::dumpQList_int()
ilist.append(2);
testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
"internal='1',childtype='int',childnumchild='0',children=["
"{name='0',addr='" + str(&ilist.at(0)) + "',value='1'},"
"{name='1',addr='" + str(&ilist.at(1)) + "',value='2'}]",
"{addr='" + str(&ilist.at(0)) + "',value='1'},"
"{addr='" + str(&ilist.at(1)) + "',value='2'}]",
&ilist, NS"QList", true, "int");
}
......@@ -430,10 +430,8 @@ void tst_Debugger::dumpQList_char()
clist.append('b');
testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
"internal='1',childtype='char',childnumchild='0',children=["
"{name='0',addr='" + str(&clist.at(0)) + "',"
"value=''a', ascii=97'},"
"{name='1',addr='" + str(&clist.at(1)) + "',"
"value=''b', ascii=98'}]",
"{addr='" + str(&clist.at(0)) + "',value=''a', ascii=97'},"
"{addr='" + str(&clist.at(1)) + "',value=''b', ascii=98'}]",
&clist, NS"QList", true, "char");
}
......@@ -447,10 +445,8 @@ void tst_Debugger::dumpQList_QString()
slist.append("b");
testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
"internal='1',childtype='"NS"QString',childnumchild='0',children=["
"{name='0',addr='" + str(&slist.at(0)) + "',"
"value='YQA=',valueencoded='2'},"
"{name='1',addr='" + str(&slist.at(1)) + "',"
"value='YgA=',valueencoded='2'}]",
"{addr='" + str(&slist.at(0)) + "',value='YQA=',valueencoded='2'},"
"{addr='" + str(&slist.at(1)) + "',value='YgA=',valueencoded='2'}]",
&slist, NS"QList", true, NS"QString");
}
......@@ -464,8 +460,8 @@ void tst_Debugger::dumpQList_Int3()
i3list.append(Int3());
testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
"internal='0',childtype='Int3',children=["
"{name='0',addr='" + str(&i3list.at(0)) + "'},"
"{name='1',addr='" + str(&i3list.at(1)) + "'}]",
"{addr='" + str(&i3list.at(0)) + "'},"
"{addr='" + str(&i3list.at(1)) + "'}]",
&i3list, NS"QList", true, "Int3");
}
......@@ -479,8 +475,8 @@ void tst_Debugger::dumpQList_QString3()
s3list.append(QString3());
testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
"internal='0',childtype='QString3',children=["
"{name='0',addr='" + str(&s3list.at(0)) + "'},"
"{name='1',addr='" + str(&s3list.at(1)) + "'}]",
"{addr='" + str(&s3list.at(0)) + "'},"
"{addr='" + str(&s3list.at(1)) + "'}]",
&s3list, NS"QList", true, "QString3");
}
......@@ -597,16 +593,16 @@ void tst_Debugger::dumpStdVector()
vector.push_back(new std::list<int>(list));
testDumper("value='<1 items>',valuedisabled='true',numchild='1',"
"childtype='" + inner + "',childnumchild='1',"
"children=[{name='0',addr='" + str(deref(&vector[0])) + "',"
"children=[{addr='" + str(deref(&vector[0])) + "',"
"saddr='" + str(deref(&vector[0])) + "',type='" + innerp + "'}]",
&vector, "std::vector", true, inner, "", sizeof(std::list<int> *));
vector.push_back(0);
list.push_back(45);
testDumper("value='<2 items>',valuedisabled='true',numchild='2',"
"childtype='" + inner + "',childnumchild='1',"
"children=[{name='0',addr='" + str(deref(&vector[0])) + "',"
"children=[{addr='" + str(deref(&vector[0])) + "',"
"saddr='" + str(deref(&vector[0])) + "',type='" + innerp + "'},"
"{name='1',addr='" + str(&vector[1]) + "',"
"{addr='" + str(&vector[1]) + "',"
"type='" + innerp + "',value='<null>',numchild='0'}]",
&vector, "std::vector", true, inner, "", sizeof(std::list<int> *));
vector.push_back(new std::list<int>(list));
......
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