From 6ea24c6e65e848efcba5270540c75a03a49f6329 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Wed, 24 Jun 2009 14:35:53 +0200 Subject: [PATCH] debugger: better dumper support for QChar and unsigned short. --- share/qtcreator/gdbmacros/gdbmacros.cpp | 35 ++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index 204a1479ae5..fa55c4d7bc8 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -334,8 +334,8 @@ static bool isSimpleType(const char *type) case 'l': return isEqual(type, "long") || startsWith(type, "long "); case 's': - return isEqual(type, "short") || isEqual(type, "signed") - || startsWith(type, "signed "); + return isEqual(type, "short") || startsWith(type, "short ") + || isEqual(type, "signed") || startsWith(type, "signed "); case 'u': return isEqual(type, "unsigned") || startsWith(type, "unsigned "); } @@ -369,7 +369,8 @@ static bool isMovableType(const char *type) || isEqual(type, "QBitArray") || isEqual(type, "QByteArray") ; case 'C': - return isEqual(type, "QCustomTypeInfo"); + return isEqual(type, "QCustomTypeInfo") + || isEqual(type, "QChar"); case 'D': return isEqual(type, "QDate") || isEqual(type, "QDateTime"); @@ -386,6 +387,7 @@ static bool isMovableType(const char *type) case 'L': return isEqual(type, "QLine") || isEqual(type, "QLineF") + || isEqual(type, "QLatin1Char") || isEqual(type, "QLocal"); case 'M': return isEqual(type, "QMatrix") @@ -786,6 +788,17 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr P(d, field, *(QByteArray*)addr); } return; + case 'C': + if (isEqual(type, "QChar")) { + d.addCommaIfNeeded(); + QChar c = *(QChar *)addr; + char str[] = "'?', usc=\0"; + if (c.isPrint() && c.unicode() < 127) + str[1] = char(c.unicode()); + P(d, field, str << c.unicode()); + P(d, "numchild", 0); + } + return; case 'L': if (startsWith(type, "QList<")) { const QListData *ldata = reinterpret_cast<const QListData*>(addr); @@ -990,6 +1003,18 @@ static void qDumpQByteArray(QDumper &d) d.disarm(); } +static void qDumpQChar(QDumper &d) +{ + d.addCommaIfNeeded(); + QChar c = *(QChar *)d.data; + char str[] = "'?', usc=\0"; + if (c.isPrint() && c.unicode() < 127) + str[1] = char(c.unicode()); + P(d, "value", str << c.unicode()); + P(d, "numchild", 0); + d.disarm(); +} + static void qDumpQDateTime(QDumper &d) { #ifdef QT_NO_DATESTRING @@ -2664,6 +2689,10 @@ static void handleProtocolVersion2and3(QDumper & d) if (isEqual(type, "QByteArray")) qDumpQByteArray(d); break; + case 'C': + if (isEqual(type, "QChar")) + qDumpQChar(d); + break; case 'D': if (isEqual(type, "QDateTime")) qDumpQDateTime(d); -- GitLab