Commit f97657b1 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk

Dumpers: Add a show case for C-style strings

Change-Id: Ic70761ffcd76bdfed7879c222d471b50a8b32c0b
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 9ff30645
......@@ -381,3 +381,59 @@ def qdump__QtcDumperTest_BufArray(d, value):
for i in d.childRange():
d.putSubItem(i, (buffer + (i * objsize)).dereference().cast(valueType))
def qdump__QtcDumperTest_List__NodeX(d, value):
typename = value.type.unqualified().name
pos0 = typename.find('<')
pos1 = typename.find('>')
tName = typename[pos0+1:pos1]
d.putBetterType('QtcDumperTest_List<' + tName + '>::Node')
d.putNumChild(1)
if d.isExpanded():
obj_type = d.lookupType(tName)
with Children(d):
d.putSubItem("this", value.cast(obj_type))
d.putFields(value)
#d.putPlainChildren(value)
def qdump__QtcDumperTest_List(d, value):
innerType = value.type[0]
d.putNumChild(1)
p = value['root']
if d.isExpanded():
with Children(d):
d.putSubItem("[p]", p)
d.putSubItem("[root]", value["root"].cast(innerType))
d.putFields(value)
#d.putPlainChildren(value)
def qdump__QtcDumperTest_List__NodeX(d, value):
typename = value.type.unqualified().name
pos0 = typename.find('<')
pos1 = typename.find('>')
tName = typename[pos0+1:pos1]
d.putBetterType('QtcDumperTest_List<' + tName + '>::Node')
d.putNumChild(1)
if d.isExpanded():
obj_type = d.lookupType(tName)
with Children(d):
d.putSubItem("this", value.cast(obj_type))
d.putFields(value)
#d.putPlainChildren(value)
def qdump__QtcDumperTest_List(d, value):
innerType = value.type[0]
d.putNumChild(1)
p = value['root']
if d.isExpanded():
with Children(d):
d.putSubItem("[p]", p)
d.putSubItem("[root]", value["root"].cast(innerType))
d.putFields(value)
#d.putPlainChildren(value)
def qdump__QtcDumperTest_String(d, value):
with Children(d):
first = d.hexdecode(d.putSubItem('first', value['first']).value)
second = d.hexdecode(d.putSubItem('second', value['second']).value)
third = d.hexdecode(d.putSubItem('third', value['third']).value)[:-1]
d.putValue(first + ', ' + second + ', ' + third)
......@@ -6860,6 +6860,25 @@ void tst_Dumpers::dumper_data()
+ Check("arr.2.baz", "5", "int");
QTest::newRow("StringDisplay")
<< Data("#include <string.h>\n"
"struct QtcDumperTest_String"
"{\n"
" char *first;\n"
" const char *second = \"second\";\n"
" const char third[6] = \"third\";\n"
" QtcDumperTest_String()\n"
" {\n"
" first = new char[6];\n"
" strcpy(first, \"first\");\n"
" }\n"
" ~QtcDumperTest_String() { delete[] first; }\n"
"};\n\n",
"QtcDumperTest_String str; unused(&str);\n")
+ Cxx11Profile()
+ Check("str", "first, second, third", "QtcDumperTest_String");
QTest::newRow("UndefinedStaticMembers")
<< Data("struct Foo { int a = 15; static int b; }; \n",
"Foo f; unused(&f);\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