Commit b7d8d9ba authored by hjk's avatar hjk

Debugger: Add a QBitArray dumper

Task-number: QTCREATORBUG-15974
Change-Id: Iafb0d94f5d780b3165d8bb749429754a5de051e3
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
parent 0408aee3
......@@ -82,6 +82,22 @@ def qdump__QByteArrayData(d, value):
d.putIntItem("size", size)
d.putIntItem("alloc", alloc)
def qdump__QBitArray(d, value):
data, basize, alloc = d.byteArrayDataHelper(d.extractPointer(value["d"]))
unused = d.extractByte(data)
size = basize * 8 - unused
d.putItemCount(size)
if d.isExpanded():
with Children(d, size, maxNumChild=10000):
for i in d.childRange():
q = data + 1 + int(i / 8)
with SubItem(d, i):
d.putValue((int(d.extractPointer(q)) >> (i % 8)) & 1)
d.putType("bool")
d.putNumChild(0)
def qdump__QChar(d, value):
d.putValue(int(value["ucs"]))
d.putNumChild(0)
......
......@@ -1566,6 +1566,30 @@ void tst_Dumpers::dumper_data()
" } // namespace nsB\n"
" } // namespace nsA\n";
QTest::newRow("QBitArray")
<< Data("#include <QBitArray>\n",
"QBitArray ba0;\n"
"unused(&ba0);\n"
"QBitArray ba1(20, true);\n"
"ba1.setBit(1, false);\n"
"ba1.setBit(3, false);\n"
"ba1.setBit(16, false);\n"
"unused(&ba1);\n")
+ CoreProfile()
+ Check("ba0", "<0 items>", "@QBitArray")
+ Check("ba1", "<20 items>", "@QBitArray")
// Cdb has "proper" "false"/"true"
+ Check("ba1.0", "[0]", "true", "bool") % CdbEngine
+ Check("ba1.0", "[0]", "1", "bool") % NoCdbEngine
+ Check("ba1.1", "[1]", "0", "bool") % NoCdbEngine
+ Check("ba1.2", "[2]", "1", "bool") % NoCdbEngine
+ Check("ba1.3", "[3]", "0", "bool") % NoCdbEngine
+ Check("ba1.15", "[15]", "1", "bool") % NoCdbEngine
+ Check("ba1.16", "[16]", "0", "bool") % NoCdbEngine
+ Check("ba1.17", "[17]", "1", "bool") % NoCdbEngine;
QTest::newRow("QByteArray")
<< Data("#include <QByteArray>\n"
"#include <QString>\n"
......
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