diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index f30b0fbafa0..744d246142c 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -265,6 +265,12 @@ class Dumper(DumperBase): except: # GDB only support converting integers of max. 64 bits to Python int as of now pass + elif code == gdb.TYPE_CODE_TYPEDEF: + targetType = nativeType.strip_typedefs().unqualified() + if targetType.code in [gdb.TYPE_CODE_BOOL, gdb.TYPE_CODE_INT]: + typeid = val.typeid + val = self.fromNativeValue(nativeValue.cast(targetType)) + val.typeid = typeid #elif code == gdb.TYPE_CODE_ARRAY: # val.type.ltarget = nativeValue[0].type.unqualified() return val diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 0cca38e0bc5..e5763e847ef 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -6243,15 +6243,19 @@ void tst_Dumpers::dumper_data() QTest::newRow("Bitfields") << Data("", + "typedef int gint;\n" + "typedef unsigned int guint;\n" "enum E { V1, V2 };\n" "struct S\n" "{\n" - " S() : front(13), x(2), y(3), z(39), e(V2), c(1), b(0), f(5)," + " S() : front(13), x(2), y(3), z(39), t1(1), t2(1), e(V2), c(1), b(0), f(5)," " g(46), h(47), d(6), i(7) {}\n" " unsigned int front;\n" " unsigned int x : 3;\n" " unsigned int y : 4;\n" " unsigned int z : 18;\n" + " gint t1 : 2;\n" + " guint t2 : 2;\n" " E e : 3;\n" " bool c : 1;\n" " bool b;\n" @@ -6284,7 +6288,7 @@ void tst_Dumpers::dumper_data() + Check("s.e", "V2 (1)", TypePattern("main::[a-zA-Z0-9_]*::E")) % CdbEngine // checks for the "Expressions" view, GDB-only for now - + Watcher("watch.1", "s;s.b;s.c;s.f;s.d;s.i;s.x;s.y;s.z;s.e;s.g;s.h;s.front") + + Watcher("watch.1", "s;s.b;s.c;s.f;s.d;s.i;s.x;s.y;s.z;s.e;s.g;s.h;s.front;s.t1;s.t2") + Check("watch.1.0", "s", "", "S") % GdbEngine + Check("watch.1.1", "s.b", "0", "bool") % GdbEngine + Check("watch.1.2", "s.c", "1", "bool") % GdbEngine @@ -6297,7 +6301,9 @@ void tst_Dumpers::dumper_data() + Check("watch.1.9", "s.e", "V2 (1)", "E") % GdbEngine + Check("watch.1.10", "s.g", "46", "char") % GdbEngine + Check("watch.1.11", "s.h", "47", "char") % GdbEngine - + Check("watch.1.12", "s.front", "13", "unsigned int") % GdbEngine; + + Check("watch.1.12", "s.front", "13", "unsigned int") % GdbEngine + + Check("watch.1.13", "s.t1", "1", "gint") % GdbEngine + + Check("watch.1.14", "s.t2", "1", "guint") % GdbEngine; QTest::newRow("Bitfield2")