diff --git a/share/qtcreator/gdbmacros/gdbmacros.py b/share/qtcreator/gdbmacros/gdbmacros.py index 9b8ff345c73..cc621edd5bf 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.py +++ b/share/qtcreator/gdbmacros/gdbmacros.py @@ -2397,3 +2397,32 @@ if False: d.putSubItem(Item(p.dereference(), iiname)) p = p + 1 + #struct KRBase + #{ + # enum Type { TYPE_A, TYPE_B } type; + # KRBase(Type _type) : type(_type) {} + #}; + # + #struct KRA : KRBase { int x; int y; KRA():KRBase(TYPE_A),x(1),y(32) {} }; + #struct KRB : KRBase { KRB():KRBase(TYPE_B) {} }; + # + #void testKR() + #{ + # KRBase *ptr1 = new KRA; + # KRBase *ptr2 = new KRB; + # ptr2 = new KRB; + #} + + def qdump__KRBase(d, item): + warn("DIR %s " % dir(item)) + if getattr(item, "__nested__", None) is None: + base = ["KRA", "KRB"][int(item.value["type"])] + nest = Item(item.value.cast(lookupType(base)), item.iname) + nest.__nested__ = True + warn("NEST %s " % dir(nest)) + d.putItem(nest) + else: + d.putName("type") + d.putValue(item.value["type"]) + d.putType(" ") + diff --git a/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp b/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp index e9fa91861fb..a81f206f859 100644 --- a/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp +++ b/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp @@ -2556,12 +2556,30 @@ void testMPI() } -enum E { - ONE = 6 +enum E { ONE = 6 }; + + + +struct KRBase +{ + enum Type { TYPE_A, TYPE_B } type; + KRBase(Type _type) : type(_type) {} }; +struct KRA : KRBase { int x; int y; KRA():KRBase(TYPE_A),x(1),y(32) {} }; +struct KRB : KRBase { KRB():KRBase(TYPE_B) {} }; + +void testKR() +{ + KRBase *ptr1 = new KRA; + KRBase *ptr2 = new KRB; + ptr2 = new KRB; +} + + int main(int argc, char *argv[]) { + testKR(); int *x = new int(32); Q_UNUSED(x); std::string s;