diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py index d8517218ba69ca27d7eb1b89ff656c8a7f3df014..600e99477d2b9376491a4ea3031a8d69c8a956f1 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.py +++ b/share/qtcreator/gdbmacros/gdbmacros.py @@ -1950,6 +1950,37 @@ def qdump__TLitC(d, item): ####################################################################### if False: + + # FIXME: Make that work + def qdump__Color(d, item): + v = item.value + d.putValue("(%s, %s, %s; %s)" % (v["r"], v["g"], v["b"], v["a"])) + if d.isExpanded(item): + with Children(d): + d.putItem(Item(v["r"], item.iname, "0", "r")) + d.putItem(Item(v["g"], item.iname, "1", "g")) + d.putItem(Item(v["b"], item.iname, "2", "b")) + d.putItem(Item(v["a"], item.iname, "3", "a")) + + def qdump__Color_(d, item): + v = item.value + d.putValue("(%s, %s, %s; %s)" % (v["r"], v["g"], v["b"], v["a"])) + if d.isExpanded(item): + with Children(d): + with SubItem(d): + d.putField("iname", item.iname + ".0") + d.putItemHelper(Item(v["r"], item.iname, "0", "r")) + with SubItem(d): + d.putField("iname", item.iname + ".1") + d.putItemHelper(Item(v["g"], item.iname, "1", "g")) + with SubItem(d): + d.putField("iname", item.iname + ".2") + d.putItemHelper(Item(v["b"], item.iname, "2", "b")) + with SubItem(d): + d.putField("iname", item.iname + ".3") + d.putItemHelper(Item(v["a"], item.iname, "3", "a")) + + def qdump__Function(d, item): min = item.value["min"] max = item.value["max"] diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index 8d700848c7f8f2e8bb988ce3df670768c405b399..eb4e338aff0cf9e28ecde38e2f873b97f48488b2 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -1593,8 +1593,22 @@ int testReference() return a.size() + b.size() + c.size(); } +struct Color +{ + int r,g,b,a; + Color() { r = 1, g = 2, b = 3, a = 4; } +}; + +void testColor() +{ + Color c; + c.r = 5; +} + int main(int argc, char *argv[]) { + testColor(); + testPeekAndPoke3(); testFunctionPointer(); testAnonymous();