From 4cbbe366afefacdbf604306f956cd6a3eb64f0ad Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Wed, 1 Sep 2010 17:36:09 +0200
Subject: [PATCH] debugger: make a 'type' a QByteArray, not a QString

Saves lots of conversion.
---
 src/plugins/debugger/cdb/cdbengine.cpp        |   2 +-
 .../debugger/cdb/cdbsymbolgroupcontext.cpp    |   4 +-
 src/plugins/debugger/debuggerengine.h         |   2 +-
 src/plugins/debugger/gdb/classicgdbengine.cpp |  35 +-
 src/plugins/debugger/gdb/gdbengine.cpp        |  16 +-
 src/plugins/debugger/gdb/gdbengine.h          |   4 +-
 src/plugins/debugger/qml/qmlcppengine.cpp     |   2 +-
 src/plugins/debugger/qml/qmlcppengine.h       |   2 +-
 src/plugins/debugger/qml/qmlengine.cpp        |   2 +-
 src/plugins/debugger/script/scriptengine.cpp  |  30 +-
 src/plugins/debugger/watchdata.cpp            |  20 +-
 src/plugins/debugger/watchdata.h              |   4 +-
 src/plugins/debugger/watchhandler.cpp         |  10 +-
 src/plugins/debugger/watchutils.cpp           | 323 +++++++++---------
 src/plugins/debugger/watchutils.h             |  73 ++--
 15 files changed, 269 insertions(+), 260 deletions(-)

diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp
index 957153da6cf..89a655e8cf9 100644
--- a/src/plugins/debugger/cdb/cdbengine.cpp
+++ b/src/plugins/debugger/cdb/cdbengine.cpp
@@ -683,7 +683,7 @@ void CdbEngine::evaluateWatcher(WatchData *wd)
         exp.remove(0, 6);
     if (m_d->evaluateExpression(exp, &value, &type, &errorMessage)) {
         wd->setValue(value);
-        wd->setType(type);
+        wd->setType(type.toUtf8());
     } else {
         wd->setValue(errorMessage);
         wd->setTypeUnneeded();
diff --git a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp
index cfb29b62e69..2051afadf14 100644
--- a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp
+++ b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp
@@ -343,14 +343,14 @@ CdbSymbolGroupContext *CdbSymbolGroupContext::create(const QString &prefix,
 // Fix display values: Pass through strings, convert unsigned integers
 // to decimal ('0x5454`fedf'), remove inner templates from
 // "0x4343 class list<>".
-static inline QString fixValue(const QString &value, const QString &type)
+static inline QString fixValue(const QString &value, const QLatin1String &type)
 {
     // Pass through strings
     if (value.endsWith(QLatin1Char('"')))
         return value;
     const int size = value.size();
     // Real Integer numbers Unsigned hex numbers (0x)/decimal numbers (0n)
-    if (type != QLatin1String("bool") && isIntType(type)) {
+    if (type != "bool" && isIntType(type)) {
         const QVariant intValue = CdbCore::SymbolGroupContext::getIntValue(value);
         if (intValue.isValid())
             return intValue.toString();
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index 04194e405f8..551c5daf46b 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -165,7 +165,7 @@ public:
     virtual unsigned debuggerCapabilities() const { return 0; }
 
     virtual bool isSynchronous() const { return false; }
-    virtual QString qtNamespace() const { return QString(); }
+    virtual QByteArray qtNamespace() const { return QByteArray(); }
 
     virtual void createSnapshot() {}
     virtual void updateAll() {}
diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp
index fbb241e9853..308342a6923 100644
--- a/src/plugins/debugger/gdb/classicgdbengine.cpp
+++ b/src/plugins/debugger/gdb/classicgdbengine.cpp
@@ -134,7 +134,7 @@ static inline QString msgRetrievingWatchData(int pending)
 void GdbEngine::runDirectDebuggingHelperClassic(const WatchData &data, bool dumpChildren)
 {
     Q_UNUSED(dumpChildren)
-    QByteArray type = data.type.toLatin1();
+    QByteArray type = data.type;
     QByteArray cmd;
 
     if (type == "QString" || type.endsWith("::QString"))
@@ -172,7 +172,7 @@ void GdbEngine::runDebuggingHelperClassic(const WatchData &data0, bool dumpChild
     m_processedNames.insert(processedName);
 
     QByteArray params;
-    QStringList extraArgs;
+    QList<QByteArray> extraArgs;
     const QtDumperHelper::TypeData td = m_dumperHelper.typeData(data0.type);
     m_dumperHelper.evaluationParameters(data, td, QtDumperHelper::GdbDebugger, &params, &extraArgs);
 
@@ -185,18 +185,23 @@ void GdbEngine::runDebuggingHelperClassic(const WatchData &data0, bool dumpChild
     if (data.addr.startsWith("0x"))
         addr = "(void*)" + data.addr;
     else if (data.exp.isEmpty()) // happens e.g. for QAbstractItem
-        addr =  QByteArray (1, '0');
+        addr = QByteArray(1, '0');
     else
         addr = "&(" + data.exp + ')';
 
     sendWatchParameters(params);
 
-    QString cmd;
-    QTextStream(&cmd) << "call " << "(void*)qDumpObjectData440(" <<
-            protocol << ",0," <<  addr << ',' << (dumpChildren ? '1' : '0')
-            << ',' << extraArgs.join(QString(_c(','))) <<  ')';
+    QByteArray cmd = "call (void*)qDumpObjectData440("
+        + QByteArray::number(protocol)
+        + ",0,"
+        + addr
+        + ','
+        + (dumpChildren ? '1' : '0');
+    foreach (const QByteArray &ex, extraArgs)
+        cmd + ',' + ex;
+    cmd += ')';
 
-    postCommand(cmd.toLatin1(), WatchUpdate | NonCriticalResponse);
+    postCommand(cmd, WatchUpdate | NonCriticalResponse);
 
     showStatusMessage(msgRetrievingWatchData(m_pendingWatchRequests + 1), 10000);
 
@@ -269,7 +274,7 @@ void GdbEngine::updateSubItemClassic(const WatchData &data0)
         if (theDebuggerBoolSetting(AutoDerefPointers)) {
             // Try automatic dereferentiation
             data.exp = "(*(" + data.exp + "))";
-            data.type = data.type + _("."); // FIXME: fragile HACK to avoid recursion
+            data.type = data.type + "."; // FIXME: fragile HACK to avoid recursion
             insertData(data);
         } else {
             data.setChildrenUnneeded();
@@ -439,8 +444,8 @@ void GdbEngine::handleDebuggingHelperValue3Classic(const GdbResponse &response)
             data.setError(WatchData::msgNotInScope());
             data.setAllUnneeded();
             insertData(data);
-        } else if (data.type == __("QString")
-                || data.type.endsWith(__("::QString"))) {
+        } else if (data.type == "QString"
+                || data.type.endsWith("::QString")) {
             QList<QByteArray> list = out.split(' ');
             QString str;
             int l = out.isEmpty() ? 0 : list.size();
@@ -450,8 +455,8 @@ void GdbEngine::handleDebuggingHelperValue3Classic(const GdbResponse &response)
             data.setHasChildren(false);
             data.setAllUnneeded();
             insertData(data);
-        } else if (data.type == __("QStringList")
-                || data.type.endsWith(__("::QStringList"))) {
+        } else if (data.type == "QStringList"
+                || data.type.endsWith("::QStringList")) {
             if (out.isEmpty()) {
                 data.setValue(tr("<0 items>"));
                 data.setHasChildren(false);
@@ -731,7 +736,7 @@ void GdbEngine::handleQueryDebuggingHelperClassic(const GdbResponse &response)
         showStatusMessage(successMsg);
 
         // Sanity check for Qt version of dumpers and debuggee.
-        QByteArray ns = m_dumperHelper.qtNamespace().toLatin1();
+        QByteArray ns = m_dumperHelper.qtNamespace();
         postCommand("-var-create A@ * '" + ns + "qVersion'()",
             CB(handleDebuggingHelperVersionCheckClassic));
         postCommand("-var-delete A@");
@@ -855,7 +860,7 @@ void GdbEngine::handleVarListChildrenHelperClassic(const GdbMi &item,
             data.exp = parent.exp;
             data.name = tr("<n/a>");
             data.iname = parent.iname + ".@";
-            data.type = tr("<anonymous union>");
+            data.type = tr("<anonymous union>").toUtf8();
         } else {
             // A structure. Hope there's nothing else...
             data.exp = '(' + parent.exp + ")." + data.name.toLatin1();
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 37e3d15bfa2..860baa8b140 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -3267,15 +3267,15 @@ void GdbEngine::setAutoDerefPointers(const QVariant &on)
     updateLocals();
 }
 
-bool GdbEngine::hasDebuggingHelperForType(const QString &type) const
+bool GdbEngine::hasDebuggingHelperForType(const QByteArray &type) const
 {
     if (!theDebuggerBoolSetting(UseDebuggingHelpers))
         return false;
 
     if (m_gdbAdapter->dumperHandling() == AbstractGdbAdapter::DumperNotAvailable) {
         // "call" is not possible in gdb when looking at core files
-        return type == __("QString") || type.endsWith(__("::QString"))
-            || type == __("QStringList") || type.endsWith(__("::QStringList"));
+        return type == "QString" || type.endsWith("::QString")
+            || type == "QStringList" || type.endsWith("::QStringList");
     }
 
     if (theDebuggerBoolSetting(DebugDebuggingHelpers)
@@ -3429,7 +3429,7 @@ void GdbEngine::handleVarCreate(const GdbResponse &response)
         data.setError(QString::fromLocal8Bit(response.data.findChild("msg").data()));
         if (data.isWatcher()) {
             data.value = WatchData::msgNotInScope();
-            data.type = _(" ");
+            data.type = " ";
             data.setAllUnneeded();
             data.setHasChildren(false);
             data.valueEnabled = false;
@@ -3496,7 +3496,7 @@ WatchData GdbEngine::localVariable(const GdbMi &item,
         //: Type of local variable or parameter shadowed by another
         //: variable of the same name in a nested block.
         setWatchDataValue(data, item);
-        data.setType(GdbEngine::tr("<shadowed>"));
+        data.setType(GdbEngine::tr("<shadowed>").toUtf8());
         data.setHasChildren(false);
         return data;
     }
@@ -3576,9 +3576,9 @@ void GdbEngine::handleWatchPoint(const GdbResponse &response)
         QString str = _(parsePlainConsoleStream(response));
         // "(void *) 0xbfa7ebfc"
         QString addr = str.mid(9);
-        QString ns = m_dumperHelper.qtNamespace();
-        QString type = ns.isEmpty() ? _("QWidget*") : _("'%1QWidget'*").arg(ns);
-        QString exp = _("(*(%1)%2)").arg(type).arg(addr);
+        QByteArray ns = m_dumperHelper.qtNamespace();
+        QByteArray type = ns.isEmpty() ? "QWidget*" : ("'" + ns + "QWidget'*");
+        QString exp = _("(*(%1)%2)").arg(_(type)).arg(addr);
         watchHandler()->watchExpression(exp);
     }
 }
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index ce04dadb449..514f3a9f482 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -116,7 +116,7 @@ private: ////////// General Interface //////////
     virtual void notifyInferiorSetupFailed();
 
     virtual void executeDebuggerCommand(const QString &command);
-    virtual QString qtNamespace() const { return m_dumperHelper.qtNamespace(); }
+    virtual QByteArray qtNamespace() const { return m_dumperHelper.qtNamespace(); }
 
 private: ////////// General State //////////
 
@@ -471,7 +471,7 @@ private: ////////// View & Data Stuff //////////
 
     void runDebuggingHelperClassic(const WatchData &data, bool dumpChildren);
     void runDirectDebuggingHelperClassic(const WatchData &data, bool dumpChildren);
-    bool hasDebuggingHelperForType(const QString &type) const;
+    bool hasDebuggingHelperForType(const QByteArray &type) const;
 
     void handleVarListChildrenClassic(const GdbResponse &response);
     void handleVarListChildrenHelperClassic(const GdbMi &child,
diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp
index ae368f2e016..17486f65710 100644
--- a/src/plugins/debugger/qml/qmlcppengine.cpp
+++ b/src/plugins/debugger/qml/qmlcppengine.cpp
@@ -180,7 +180,7 @@ bool QmlCppEngine::isSynchronous() const
     return m_activeEngine->isSynchronous();
 }
 
-QString QmlCppEngine::qtNamespace() const
+QByteArray QmlCppEngine::qtNamespace() const
 {
     return m_cppEngine->qtNamespace();
 }
diff --git a/src/plugins/debugger/qml/qmlcppengine.h b/src/plugins/debugger/qml/qmlcppengine.h
index 0fcdd3cce05..68b2558ab04 100644
--- a/src/plugins/debugger/qml/qmlcppengine.h
+++ b/src/plugins/debugger/qml/qmlcppengine.h
@@ -46,7 +46,7 @@ public:
     virtual unsigned debuggerCapabilities() const;
 
     virtual bool isSynchronous() const;
-    virtual QString qtNamespace() const;
+    virtual QByteArray qtNamespace() const;
 
     virtual void createSnapshot();
     virtual void updateAll();
diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index 5c135d861f5..7e0207bcd81 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -88,7 +88,7 @@ QDataStream& operator>>(QDataStream& s, WatchData &data)
     QString type;
     bool hasChildren;
     s >> data.exp >> data.name >> value >> type >> hasChildren >> data.objectId;
-    data.setType(type, false);
+    data.setType(type.toUtf8(), false);
     data.setValue(value);
     data.setHasChildren(hasChildren);
     data.setAllUnneeded();
diff --git a/src/plugins/debugger/script/scriptengine.cpp b/src/plugins/debugger/script/scriptengine.cpp
index ef3a84460c5..08e846b446b 100644
--- a/src/plugins/debugger/script/scriptengine.cpp
+++ b/src/plugins/debugger/script/scriptengine.cpp
@@ -746,55 +746,55 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
     if (data.isTypeNeeded() || data.isValueNeeded()) {
         const QScriptValue &ob = data.scriptValue;
         if (ob.isArray()) {
-            data.setType(QLatin1String("Array"), false);
+            data.setType("Array", false);
             data.setValue(QString(QLatin1Char(' ')));
         } else if (ob.isBool()) {
-            data.setType(QLatin1String("Bool"), false);
+            data.setType("Bool", false);
             data.setValue(ob.toBool() ? QLatin1String("true") : QLatin1String("false"));
             data.setHasChildren(false);
         } else if (ob.isDate()) {
-            data.setType(QLatin1String("Date"), false);
+            data.setType("Date", false);
             data.setValue(ob.toDateTime().toString());
             data.setHasChildren(false);
         } else if (ob.isError()) {
-            data.setType(QLatin1String("Error"), false);
+            data.setType("Error", false);
             data.setValue(QString(QLatin1Char(' ')));
         } else if (ob.isFunction()) {
-            data.setType(QLatin1String("Function"), false);
+            data.setType("Function", false);
             data.setValue(QString(QLatin1Char(' ')));
         } else if (ob.isNull()) {
             const QString nullValue = QLatin1String("<null>");
-            data.setType(nullValue, false);
+            data.setType("<null>", false);
             data.setValue(nullValue);
         } else if (ob.isNumber()) {
-            data.setType(QLatin1String("Number"), false);
+            data.setType("Number", false);
             data.setValue(QString::number(ob.toNumber()));
             data.setHasChildren(false);
         } else if (ob.isObject()) {
-            data.setType(QLatin1String("Object"), false);
+            data.setType("Object", false);
             data.setValue(QString(QLatin1Char(' ')));
         } else if (ob.isQMetaObject()) {
-            data.setType(QLatin1String("QMetaObject"), false);
+            data.setType("QMetaObject", false);
             data.setValue(QString(QLatin1Char(' ')));
         } else if (ob.isQObject()) {
-            data.setType(QLatin1String("QObject"), false);
+            data.setType("QObject", false);
             data.setValue(QString(QLatin1Char(' ')));
         } else if (ob.isRegExp()) {
-            data.setType(QLatin1String("RegExp"), false);
+            data.setType("RegExp", false);
             data.setValue(ob.toRegExp().pattern());
         } else if (ob.isString()) {
-            data.setType(QLatin1String("String"), false);
+            data.setType("String", false);
             data.setValue(ob.toString());
         } else if (ob.isVariant()) {
-            data.setType(QLatin1String("Variant"), false);
+            data.setType("Variant", false);
             data.setValue(QString(QLatin1Char(' ')));
         } else if (ob.isUndefined()) {
-            data.setType(QLatin1String("<undefined>"), false);
+            data.setType("<undefined>", false);
             data.setValue(QLatin1String("<unknown>"));
             data.setHasChildren(false);
         } else {
             const QString unknown = QLatin1String("<unknown>");
-            data.setType(unknown, false);
+            data.setType("<unknown>", false);
             data.setValue(unknown);
             data.setHasChildren(false);
         }
diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp
index dcd490e79c6..eecc3ad4908 100644
--- a/src/plugins/debugger/watchdata.cpp
+++ b/src/plugins/debugger/watchdata.cpp
@@ -68,7 +68,7 @@ void WatchData::setValue(const QString &value0)
         hasChildren = true; // at least one...
     }
     // strip off quoted characters for chars.
-    if (value.endsWith(QLatin1Char('\'')) && type.endsWith(QLatin1String("char"))) {
+    if (value.endsWith(QLatin1Char('\'')) && type.endsWith("char")) {
         const int blankPos = value.indexOf(QLatin1Char(' '));
         if (blankPos != -1)
             value.truncate(blankPos);
@@ -105,26 +105,26 @@ void WatchData::setValueToolTip(const QString &tooltip)
     valuetooltip = tooltip;
 }
 
-void WatchData::setType(const QString &str, bool guessChildrenFromType)
+void WatchData::setType(const QByteArray &str, bool guessChildrenFromType)
 {
     type = str.trimmed();
     bool changed = true;
     while (changed) {
-        if (type.endsWith(QLatin1String("const")))
+        if (type.endsWith("const"))
             type.chop(5);
-        else if (type.endsWith(QLatin1Char(' ')))
+        else if (type.endsWith(' '))
             type.chop(1);
-        else if (type.endsWith(QLatin1Char('&')))
+        else if (type.endsWith('&'))
             type.chop(1);
-        else if (type.startsWith(QLatin1String("const ")))
+        else if (type.startsWith("const "))
             type = type.mid(6);
-        else if (type.startsWith(QLatin1String("volatile ")))
+        else if (type.startsWith("volatile "))
             type = type.mid(9);
-        else if (type.startsWith(QLatin1String("class ")))
+        else if (type.startsWith("class "))
             type = type.mid(6);
-        else if (type.startsWith(QLatin1String("struct ")))
+        else if (type.startsWith("struct "))
             type = type.mid(6);
-        else if (type.startsWith(QLatin1Char(' ')))
+        else if (type.startsWith(' '))
             type = type.mid(1);
         else
             changed = false;
diff --git a/src/plugins/debugger/watchdata.h b/src/plugins/debugger/watchdata.h
index 0cd0dae433a..4d4ba2a9ca8 100644
--- a/src/plugins/debugger/watchdata.h
+++ b/src/plugins/debugger/watchdata.h
@@ -63,7 +63,7 @@ public:
     };
 
     void setValue(const QString &);
-    void setType(const QString &, bool guessChildrenFromType = true);
+    void setType(const QByteArray &, bool guessChildrenFromType = true);
     void setValueToolTip(const QString &);
     void setError(const QString &);
     void setAddress(const QByteArray &);
@@ -116,7 +116,7 @@ public:
     int editformat;       // Format of displayed value
     QString valuetooltip; // Tooltip in value column
     QString typeFormats;  // Selection of formats of displayed value
-    QString type;         // Type for further processing
+    QByteArray type;         // Type for further processing
     QString displayedType;// Displayed type (optional)
     QByteArray variable;  // Name of internal Gdb variable if created
     QByteArray addr;      // Displayed address
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 6ed126889dc..47e1c1179d4 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -435,7 +435,7 @@ static inline QString formattedValue(const WatchData &data, int format)
         if (!firstChar.isDigit() && firstChar != QLatin1Char('-'))
             return data.value;
         // Append quoted, printable character also for decimal.
-        if (data.type.endsWith(QLatin1String("char"))) {
+        if (data.type.endsWith("char")) {
             bool ok;
             const int code = data.value.toInt(&ok);
             return ok ? reformatCharacter(code, format) : data.value;
@@ -444,7 +444,7 @@ static inline QString formattedValue(const WatchData &data, int format)
         if (format <= 0)
             return data.value;
         // Evil hack, covers 'unsigned' as well as quint64.
-        if (data.type.contains(QLatin1Char('u')))
+        if (data.type.contains('u'))
             return reformatInteger(data.value.toULongLong(), format);
         return reformatInteger(data.value.toLongLong(), format);
     }
@@ -653,7 +653,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
                 bool ok;
                 const quint64 addr = data.addr.toULongLong(&ok, 16);
                 if (ok && addr)
-                    return QString("*(%1*)%2").arg(data.type).arg(addr);
+                    return QString("*(%1*)%2").arg(QLatin1String(data.type)).arg(addr);
             }
             WatchItem *parent = item->parent;
             if (parent && !parent->exp.isEmpty())
@@ -669,10 +669,10 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
             return m_handler->m_expandedINames.contains(data.iname);
 
         case LocalsTypeFormatListRole: {
-            if (isIntType(data.type) && data.type != QLatin1String("bool"))
+            if (isIntType(data.type) && data.type != "bool")
                 return QStringList() << tr("decimal") << tr("hexadecimal")
                     << tr("binary") << tr("octal");
-            if (data.type.endsWith(QLatin1Char('*')))
+            if (data.type.endsWith('*'))
                 return QStringList()
                     << tr("Raw pointer")
                     << tr("Latin1 string")
diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp
index fb7d504c4b9..4f592b8e935 100644
--- a/src/plugins/debugger/watchutils.cpp
+++ b/src/plugins/debugger/watchutils.cpp
@@ -227,6 +227,13 @@ bool isLeavableFunction(const QString &funcName, const QString &fileName)
     return false;
 }
 
+bool isLetterOrNumber(char c)
+{
+    return (c >= 'a' && c <= 'z')
+        || (c >= 'A' && c <= 'Z')
+        || (c >= '0' && c <= '9');
+}
+
 bool hasLetterOrNumber(const QString &exp)
 {
     const QChar underscore = QLatin1Char('_');
@@ -266,16 +273,14 @@ bool isKeyWord(const QString &exp)
         || exp == QLatin1String("while");
 }
 
-bool isPointerType(const QString &type)
+bool isPointerType(const QByteArray &type)
 {
-    return type.endsWith(QLatin1Char('*')) || type.endsWith(QLatin1String("* const"));
+    return type.endsWith('*') || type.endsWith("* const");
 }
 
-bool isCharPointerType(const QString &type)
+bool isCharPointerType(const QByteArray &type)
 {
-    return type == QLatin1String("char *")
-        || type == QLatin1String("const char *")
-        || type == QLatin1String("char const *");
+    return type == "char *" || type == "const char *" || type == "char const *";
 }
 
 bool startsWithDigit(const QString &str)
@@ -283,13 +288,13 @@ bool startsWithDigit(const QString &str)
     return !str.isEmpty() && str.at(0).isDigit();
 }
 
-QString stripPointerType(QString type)
+QByteArray stripPointerType(QByteArray type)
 {
-    if (type.endsWith(QLatin1Char('*')))
+    if (type.endsWith('*'))
         type.chop(1);
-    if (type.endsWith(QLatin1String("* const")))
+    if (type.endsWith("* const"))
         type.chop(7);
-    if (type.endsWith(QLatin1Char(' ')))
+    if (type.endsWith(' '))
         type.chop(1);
     return type;
 }
@@ -423,7 +428,7 @@ bool getUninitializedVariables(const CPlusPlus::Snapshot &snapshot,
     return rc == 0;
 }
 
-QString gdbQuoteTypes(const QString &type)
+QByteArray gdbQuoteTypes(const QByteArray &type)
 {
     // gdb does not understand sizeof(Core::IFile*).
     // "sizeof('Core::IFile*')" is also not acceptable,
@@ -439,19 +444,19 @@ QString gdbQuoteTypes(const QString &type)
     // (*('myns::QPointer<myns::QObject>*'*)0x684060)" is not acceptable
     // (*('myns::QPointer<myns::QObject>'**)0x684060)" is acceptable
     if (isPointerType(type))
-        return gdbQuoteTypes(stripPointerType(type)) + QLatin1Char('*');
+        return gdbQuoteTypes(stripPointerType(type)) + '*';
 
-    QString accu;
-    QString result;
+    QByteArray accu;
+    QByteArray result;
     int templateLevel = 0;
 
-    const QChar colon = QLatin1Char(':');
-    const QChar singleQuote = QLatin1Char('\'');
-    const QChar lessThan = QLatin1Char('<');
-    const QChar greaterThan = QLatin1Char('>');
+    const char colon = ':';
+    const char singleQuote = '\'';
+    const char lessThan = '<';
+    const char greaterThan = '>';
     for (int i = 0; i != type.size(); ++i) {
-        const QChar c = type.at(i);
-        if (c.isLetterOrNumber() || c == QLatin1Char('_') || c == colon || c == QLatin1Char(' ')) {
+        const char c = type.at(i);
+        if (isLetterOrNumber(c) || c == '_' || c == colon || c == ' ') {
             accu += c;
         } else if (c == lessThan) {
             ++templateLevel;
@@ -479,7 +484,7 @@ QString gdbQuoteTypes(const QString &type)
     return result;
 }
 
-bool extractTemplate(const QString &type, QString *tmplate, QString *inner)
+bool extractTemplate(const QByteArray &type, QByteArray *tmplate, QByteArray *inner)
 {
     // Input "Template<Inner1,Inner2,...>::Foo" will return "Template::Foo" in
     // 'tmplate' and "Inner1@Inner2@..." etc in 'inner'. Result indicates
@@ -487,16 +492,15 @@ bool extractTemplate(const QString &type, QString *tmplate, QString *inner)
     // Gdb inserts a blank after each comma which we would like to avoid
     tmplate->clear();
     inner->clear();
-    if (!type.contains(QLatin1Char('<')))
+    if (!type.contains('<'))
         return  false;
     int level = 0;
     bool skipSpace = false;
     const int size = type.size();
 
     for (int i = 0; i != size; ++i) {
-        const QChar c = type.at(i);
-        const char asciiChar = c.toAscii();
-        switch (asciiChar) {
+        const char c = type.at(i);
+        switch (c) {
         case '<':
             *(level == 0 ? tmplate : inner) += c;
             ++level;
@@ -506,11 +510,11 @@ bool extractTemplate(const QString &type, QString *tmplate, QString *inner)
             *(level == 0 ? tmplate : inner) += c;
             break;
         case ',':
-            *inner += (level == 1) ? QLatin1Char('@') : QLatin1Char(',');
+            *inner += (level == 1) ? '@' : ',';
             skipSpace = true;
             break;
         default:
-            if (!skipSpace || asciiChar != ' ') {
+            if (!skipSpace || c != ' ') {
                 *(level == 0 ? tmplate : inner) += c;
                 skipSpace = false;
             }
@@ -518,7 +522,7 @@ bool extractTemplate(const QString &type, QString *tmplate, QString *inner)
         }
     }
     *tmplate = tmplate->trimmed();
-    *tmplate = tmplate->remove(QLatin1String("<>"));
+    tmplate->replace("<>", "");
     *inner = inner->trimmed();
     // qDebug() << "EXTRACT TEMPLATE: " << *tmplate << *inner << " FROM " << type;
     return !inner->isEmpty();
@@ -536,42 +540,50 @@ QString extractTypeFromPTypeOutput(const QString &str)
     return res.simplified();
 }
 
-bool isIntType(const QString &type)
-{
-    static const QStringList types = QStringList()
-        << QLatin1String("char") << QLatin1String("int") << QLatin1String("short")
-        << QLatin1String("long") << QLatin1String("bool")
-        << QLatin1String("signed char") << QLatin1String("unsigned")
-        << QLatin1String("unsigned char") << QLatin1String("unsigned long")
-        << QLatin1String("short") << QLatin1String("unsigned short")
-        << QLatin1String("long long")  << QLatin1String("unsigned long long")
-        << QLatin1String("qint16") << QLatin1String("quint16")
-        << QLatin1String("qint32") << QLatin1String("quint32")
-        << QLatin1String("qint64") << QLatin1String("quint64")
-        << QLatin1String("size_t")
-        << QLatin1String("ptrdiff_t")
-        << QLatin1String("std::size_t")
-        << QLatin1String("std::ptrdiff_t");
-    return type.endsWith(QLatin1String(" int"))
-            || type.endsWith(QLatin1String(" int64"))
-            || types.contains(type);
+bool isIntType(const QByteArray &type)
+{
+    switch (type.at(0)) {
+        case 'b':
+            return type == "bool";
+        case 'c':
+            return type == "char";
+        case 'i':
+            return type == "int";
+        case 'l':
+            return type == "long"
+                || type == "long long";
+        case 'p':
+            return type == "ptrdiff_t";
+        case 'q':
+            return type == "qint16" || type == "quint16"
+                || type == "qint32" || type == "quint32"
+                || type == "qint64" || type == "quint64";
+        case 's':
+            return type == "short"
+                || type == "signed"
+                || type == "size_t"
+                || type == "std::size_t"
+                || type == "std::ptrdiff_t"
+                || type.startsWith("signed ");
+        case 'u':
+            return type == "unsigned"
+                || type.startsWith("unsigned ");
+        default:
+            return false;
+    }
 }
 
-bool isSymbianIntType(const QString &type)
+bool isSymbianIntType(const QByteArray &type)
 {
-    static const QStringList types = QStringList()
-        << QLatin1String("TInt") << QLatin1String("TBool");
-    return types.contains(type);
+    return type == "TInt" || type == "TBool";
 }
 
-bool isIntOrFloatType(const QString &type)
+bool isIntOrFloatType(const QByteArray &type)
 {
-    static const QStringList types = QStringList()
-        << QLatin1String("float") << QLatin1String("double");
-    return isIntType(type) || types.contains(type);
+    return isIntType(type) || type == "float" || type == "double";
 }
 
-GuessChildrenResult guessChildren(const QString &type)
+GuessChildrenResult guessChildren(const QByteArray &type)
 {
     if (isIntOrFloatType(type))
         return HasNoChildren;
@@ -579,18 +591,18 @@ GuessChildrenResult guessChildren(const QString &type)
         return HasNoChildren;
     if (isPointerType(type))
         return HasChildren;
-    if (type.endsWith(QLatin1String("QString")))
+    if (type.endsWith("QString"))
         return HasNoChildren;
     return HasPossiblyChildren;
 }
 
-QString sizeofTypeExpression(const QString &type, QtDumperHelper::Debugger debugger)
+QByteArray sizeofTypeExpression(const QByteArray &type, QtDumperHelper::Debugger debugger)
 {
-    if (type.endsWith(QLatin1Char('*')))
-        return QLatin1String("sizeof(void*)");
-    if (debugger != QtDumperHelper::GdbDebugger || type.endsWith(QLatin1Char('>')))
-        return QLatin1String("sizeof(") + type + QLatin1Char(')');
-    return QLatin1String("sizeof(") + gdbQuoteTypes(type) + QLatin1Char(')');
+    if (type.endsWith('*'))
+        return "sizeof(void*)";
+    if (debugger != QtDumperHelper::GdbDebugger || type.endsWith('>'))
+        return "sizeof(" + type + ')';
+    return "sizeof(" + gdbQuoteTypes(type) + ')';
 }
 
 // Utilities to decode string data returned by the dumper helpers.
@@ -732,7 +744,7 @@ QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos,
 
     const QPlainTextEdit *plaintext = qobject_cast<QPlainTextEdit*>(editor->widget());
     if (!plaintext)
-        return QString();
+        return QByteArray();
 
     QString expr = plaintext->textCursor().selectedText();
     CppModelManagerInterface *modelManager =
@@ -763,7 +775,7 @@ QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos,
                 *function = AbstractEditorSupport::functionAt(modelManager,
                     file->fileName(), *line, *column);
 
-    return expr;
+    return expr.toUtf8();
 }
 
 
@@ -788,7 +800,7 @@ QtDumperHelper::QtDumperHelper() :
     m_dumperVersion(1.0)
 {
     qFill(m_specialSizes, m_specialSizes + SpecialSizeCount, 0);
-    setQClassPrefixes(QString());
+    setQClassPrefixes(QByteArray());
 }
 
 void QtDumperHelper::clear()
@@ -800,7 +812,7 @@ void QtDumperHelper::clear()
     m_sizeCache.clear();
     qFill(m_specialSizes, m_specialSizes + SpecialSizeCount, 0);
     m_expressionCache.clear();
-    setQClassPrefixes(QString());
+    setQClassPrefixes(QByteArray());
 }
 
 QString QtDumperHelper::msgDumperOutdated(double requiredVersion, double currentVersion)
@@ -837,8 +849,8 @@ QString QtDumperHelper::toString(bool debug) const
             str << ' ' << it.key() << '=' << it.value() << '\n';
         }
         str << "\nExpression cache: (" << m_expressionCache.size() << ")\n";
-        const QMap<QString, QString>::const_iterator excend = m_expressionCache.constEnd();
-        for (QMap<QString, QString>::const_iterator it = m_expressionCache.constBegin(); it != excend; ++it)
+        const ExpressionCache::const_iterator excend = m_expressionCache.constEnd();
+        for (ExpressionCache::const_iterator it = m_expressionCache.constBegin(); it != excend; ++it)
             str << "    " << it.key() << ' ' << it.value() << '\n';
         return rc;
     }
@@ -850,7 +862,7 @@ QString QtDumperHelper::toString(bool debug) const
        m_nameTypeMap.size()).arg(qtVersionString(), nameSpace).arg(m_dumperVersion);
 }
 
-QtDumperHelper::Type QtDumperHelper::simpleType(const QString &simpleType) const
+QtDumperHelper::Type QtDumperHelper::simpleType(const QByteArray &simpleType) const
 {
     return m_nameTypeMap.value(simpleType, UnknownType);
 }
@@ -860,7 +872,7 @@ int QtDumperHelper::qtVersion() const
     return m_qtVersion;
 }
 
-QString QtDumperHelper::qtNamespace() const
+QByteArray QtDumperHelper::qtNamespace() const
 {
     return m_qtNamespace;
 }
@@ -929,28 +941,28 @@ static QtDumperHelper::Type specialType(QByteArray type)
     return QtDumperHelper::UnknownType;
 }
 
-QString QtDumperHelper::qtVersionString() const
+QByteArray QtDumperHelper::qtVersionString() const
 {
     QString rc;
     QTextStream str(&rc);
     formatQtVersion(m_qtVersion, str);
-    return rc;
+    return rc.toLatin1();
 }
 
 // Parse a list of types.
 typedef QList<QByteArray> QByteArrayList;
 
-static inline QString qClassName(const QString &qtNamespace, const char *className)
+static inline QByteArray qClassName(const QByteArray &qtNamespace, const char *className)
 {
     if (qtNamespace.isEmpty())
-        return QString::fromAscii(className);
-    QString rc = qtNamespace;
-    rc += QLatin1String("::");
-    rc += QString::fromAscii(className);
+        return className;
+    QByteArray rc = qtNamespace;
+    rc += "::";
+    rc += className;
     return rc;
 }
 
-void QtDumperHelper::setQClassPrefixes(const QString &qNamespace)
+void QtDumperHelper::setQClassPrefixes(const QByteArray &qNamespace)
 {
     // Prefixes with namespaces
     m_qPointerPrefix = qClassName(qNamespace, "QPointer");
@@ -982,7 +994,7 @@ bool QtDumperHelper::parseQuery(const GdbMi &contents)
         qDebug() << "parseQuery" << contents.toString(true, 2);
 
     // Common info, dumper version, etc
-    m_qtNamespace = QLatin1String(contents.findChild("namespace").data());
+    m_qtNamespace = contents.findChild("namespace").data();
     int qtv = 0;
     const GdbMi qtversion = contents.findChild("qtversion");
     if (qtversion.children().size() == 3) {
@@ -1010,14 +1022,14 @@ bool QtDumperHelper::parseQuery(const GdbMi &contents)
         if (childCount > 1) {
             const int size = sizesList.childAt(0).data().toInt();
             for (int c = 1; c < childCount; c++)
-                addSize(QLatin1String(sizesList.childAt(c).data()), size);
+                addSize(sizesList.childAt(c).data(), size);
         }
     }
     // Parse expressions
     foreach (const GdbMi &exprList, contents.findChild("expressions").children())
         if (exprList.childCount() == 2)
-            m_expressionCache.insert(QLatin1String(exprList.childAt(0).data()),
-                                     QLatin1String(exprList.childAt(1).data()));
+            m_expressionCache.insert(exprList.childAt(0).data(),
+                                     exprList.childAt(1).data());
     return true;
 }
 
@@ -1031,10 +1043,10 @@ bool QtDumperHelper::parseQuery(const char *data)
     return parseQuery(root);
 }
 
-void QtDumperHelper::addSize(const QString &name, int size)
+void QtDumperHelper::addSize(const QByteArray &name, int size)
 {
     // Special interest cases
-    if (name == QLatin1String("char*")) {
+    if (name == "char*") {
         m_specialSizes[PointerSize] = size;
         return;
     }
@@ -1045,27 +1057,27 @@ void QtDumperHelper::addSize(const QString &name, int size)
     }
     do {
         // CDB helpers
-        if (name == QLatin1String("std::string")) {
-            m_sizeCache.insert(QLatin1String("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"), size);
-            m_sizeCache.insert(QLatin1String("basic_string<char,char_traits<char>,allocator<char> >"), size);
+        if (name == "std::string") {
+            m_sizeCache.insert("std::basic_string<char,std::char_traits<char>,std::allocator<char> >", size);
+            m_sizeCache.insert("basic_string<char,char_traits<char>,allocator<char> >", size);
             break;
         }
-        if (name == QLatin1String("std::wstring")) {
-            m_sizeCache.insert(QLatin1String("basic_string<unsigned short,char_traits<unsignedshort>,allocator<unsignedshort> >"), size);
-            m_sizeCache.insert(QLatin1String("std::basic_string<unsigned short,std::char_traits<unsigned short>,std::allocator<unsigned short> >"), size);
+        if (name == "std::wstring") {
+            m_sizeCache.insert("basic_string<unsigned short,char_traits<unsignedshort>,allocator<unsignedshort> >", size);
+            m_sizeCache.insert("std::basic_string<unsigned short,std::char_traits<unsigned short>,std::allocator<unsigned short> >", size);
             break;
         }
     } while (false);
     m_sizeCache.insert(name, size);
 }
 
-QtDumperHelper::Type QtDumperHelper::type(const QString &typeName) const
+QtDumperHelper::Type QtDumperHelper::type(const QByteArray &typeName) const
 {
     const QtDumperHelper::TypeData td = typeData(typeName);
     return td.type;
 }
 
-QtDumperHelper::TypeData QtDumperHelper::typeData(const QString &typeName) const
+QtDumperHelper::TypeData QtDumperHelper::typeData(const QByteArray &typeName) const
 {
     TypeData td;
     td.type = UnknownType;
@@ -1086,32 +1098,30 @@ QtDumperHelper::TypeData QtDumperHelper::typeData(const QString &typeName) const
 
 // Format an expression to have the debugger query the
 // size. Use size cache if possible
-QString QtDumperHelper::evaluationSizeofTypeExpression(const QString &typeName,
+QByteArray QtDumperHelper::evaluationSizeofTypeExpression(const QByteArray &typeName,
                                                        Debugger debugger) const
 {
     // Look up special size types
     const SpecialSizeType st = specialSizeType(typeName);
     if (st != SpecialSizeCount) {
         if (const int size = m_specialSizes[st])
-            return QString::number(size);
+            return QByteArray::number(size);
     }
     // Look up size cache
     const SizeCache::const_iterator sit = m_sizeCache.constFind(typeName);
     if (sit != m_sizeCache.constEnd())
-        return QString::number(sit.value());
+        return QByteArray::number(sit.value());
     // Finally have the debugger evaluate
     return sizeofTypeExpression(typeName, debugger);
 }
 
-QtDumperHelper::SpecialSizeType QtDumperHelper::specialSizeType(const QString &typeName) const
+QtDumperHelper::SpecialSizeType QtDumperHelper::specialSizeType(const QByteArray &typeName) const
 {
     if (isPointerType(typeName))
         return PointerSize;
-    static const QString intType = QLatin1String("int");
-    static const QString stdAllocatorPrefix = QLatin1String("std::allocator");
-    if (typeName == intType)
+    if (typeName == "int")
         return IntSize;
-    if (typeName.startsWith(stdAllocatorPrefix))
+    if (typeName.startsWith("std::allocator"))
         return StdAllocatorSize;
     if (typeName.startsWith(m_qPointerPrefix))
         return QPointerSize;
@@ -1147,14 +1157,14 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
                                           const TypeData &td,
                                           Debugger debugger,
                                           QByteArray *inBuffer,
-                                          QStringList *extraArgsIn) const
+                                          QByteArrayList *extraArgsIn) const
 {
     enum { maxExtraArgCount = 4 };
 
-    QStringList &extraArgs = *extraArgsIn;
+    QByteArrayList &extraArgs = *extraArgsIn;
 
     // See extractTemplate for parameters
-    QStringList inners = td.inner.split(QLatin1Char('@'));
+    QByteArrayList inners = td.inner.split('@');
     if (inners.at(0).isEmpty())
         inners.clear();
     for (int i = 0; i != inners.size(); ++i)
@@ -1162,10 +1172,11 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
 
     QString outertype = td.isTemplate ? td.tmplate : data.type;
     // adjust the data extract
-    if (outertype == m_qtNamespace + QLatin1String("QWidget"))
-        outertype = m_qtNamespace + QLatin1String("QObject");
+    if (outertype == m_qtNamespace + "QWidget")
+        outertype = m_qtNamespace + "QObject";
 
     QString inner = td.inner;
+    const QByteArray zero = "0";
 
     extraArgs.clear();
 
@@ -1178,10 +1189,9 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
     }
     int extraArgCount = extraArgs.size();
     // Pad with zeros
-    const QString zero = QString(QLatin1Char('0'));
     const int extraPad = maxExtraArgCount - extraArgCount;
     for (int i = 0; i < extraPad; i++)
-        extraArgs.push_back(zero);
+        extraArgs.push_back("0");
 
     // in rare cases we need more or less:
     switch (td.type) {
@@ -1193,20 +1203,20 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
             // we need the number out of something like
             // iname="local.ob.slots.2" // ".deleteLater()"?
             const int pos = data.iname.lastIndexOf('.');
-            const QString slotNumber = data.iname.mid(pos + 1);
+            const QByteArray slotNumber = data.iname.mid(pos + 1);
             QTC_ASSERT(slotNumber.toInt() != -1, /**/);
             extraArgs[0] = slotNumber;
         }
         break;
     case QMapType:
     case QMultiMapType: {
-            QString nodetype;
+            QByteArray nodetype;
             if (m_qtVersion >= 0x040500) {
-                nodetype = m_qtNamespace + QLatin1String("QMapNode");
+                nodetype = m_qtNamespace + "QMapNode";
                 nodetype += data.type.mid(outertype.size());
             } else {
                 // FIXME: doesn't work for QMultiMap
-                nodetype  = data.type + QLatin1String("::Node");
+                nodetype  = data.type + "::Node";
             }
             //qDebug() << "OUTERTYPE: " << outertype << " NODETYPE: " << nodetype
             //    << "QT VERSION" << m_qtVersion << ((4 << 16) + (5 << 8) + 0);
@@ -1220,22 +1230,21 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
         break;
     case StdVectorType:
         //qDebug() << "EXTRACT TEMPLATE: " << outertype << inners;
-        if (inners.at(0) == QLatin1String("bool")) {
-            outertype = QLatin1String("std::vector::bool");
-        }
+        if (inners.at(0) == "bool")
+            outertype = "std::vector::bool";
         break;
     case StdDequeType:
-        extraArgs[1] = zero;
+        extraArgs[1] = "0";
         break;
     case StdStackType:
         // remove 'std::allocator<...>':
-        extraArgs[1] = zero;
+        extraArgs[1] = "0";
         break;
     case StdSetType:
         // remove 'std::less<...>':
-        extraArgs[1] = zero;
+        extraArgs[1] = "0";
         // remove 'std::allocator<...>':
-        extraArgs[2] = zero;
+        extraArgs[2] = "0";
         break;
     case StdMapType: {
             // We need the offset of the second item in the value pair.
@@ -1245,42 +1254,40 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
             // -> "std::pair<Key,Value>". Different debuggers have varying
             // amounts of terminating blanks...
             extraArgs[2].clear();
-            extraArgs[3] = zero;
-            QString pairType = inners.at(3);
-            int bracketPos = pairType.indexOf(QLatin1Char('<'));
+            extraArgs[3] = "0";
+            QByteArray pairType = inners.at(3);
+            int bracketPos = pairType.indexOf('<');
             if (bracketPos != -1)
                 pairType.remove(0, bracketPos + 1);
             // We don't want the comparator and the allocator confuse gdb.
-            const QChar closingBracket = QLatin1Char('>');
+            const char closingBracket = '>';
             bracketPos = pairType.lastIndexOf(closingBracket);
             if (bracketPos != -1)
                 bracketPos = pairType.lastIndexOf(closingBracket, bracketPos - pairType.size() - 1);
             if (bracketPos != -1)
                 pairType.truncate(bracketPos + 1);
             if (debugger == GdbDebugger) {
-                extraArgs[2] = QLatin1String("(size_t)&(('");
+                extraArgs[2] = "(size_t)&(('";
                 extraArgs[2] += pairType;
-                extraArgs[2] += QLatin1String("'*)0)->second");
+                extraArgs[2] += "'*)0)->second";
             } else {
                 // Cdb: The std::pair is usually in scope. Still, this expression
                 // occasionally fails for complex types (std::string).
                 // We need an address as CDB cannot do the 0-trick.
                 // Use data address or try at least cache if missing.
-                const QString address = data.addr.isEmpty() ? QString::fromLatin1("DUMMY_ADDRESS") : data.addr;
-                QString offsetExpr;
-                QTextStream str(&offsetExpr);
-                str << "(size_t)&(((" << pairType << " *)" << address << ")->second)" << '-' << address;
+                const QByteArray address = data.addr.isEmpty() ? "DUMMY_ADDRESS" : data.addr;
+                QByteArray offsetExpr = "(size_t)&(((" + pairType + " *)" + address
+                        + ")->second)" + '-' + address;
                 extraArgs[2] = lookupCdbDummyAddressExpression(offsetExpr, address);
             }
         }
         break;
     case StdStringType:
         //qDebug() << "EXTRACT TEMPLATE: " << outertype << inners;
-        if (inners.at(0) == QLatin1String("char")) {
-            outertype = QLatin1String("std::string");
-        } else if (inners.at(0) == QLatin1String("wchar_t")) {
-            outertype = QLatin1String("std::wstring");
-        }
+        if (inners.at(0) == "char")
+            outertype = "std::string";
+        else if (inners.at(0) == "wchar_t")
+            outertype = "std::wstring";
         qFill(extraArgs, zero);
         break;
     case UnknownType:
@@ -1296,12 +1303,12 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
 
     // Look up expressions in the cache
     if (!m_expressionCache.empty()) {
-        const QMap<QString, QString>::const_iterator excCend = m_expressionCache.constEnd();
-        const QStringList::iterator eend = extraArgs.end();
-        for (QStringList::iterator it = extraArgs.begin(); it != eend; ++it) {
-            QString &e = *it;
+        const ExpressionCache::const_iterator excCend = m_expressionCache.constEnd();
+        const QByteArrayList::iterator eend = extraArgs.end();
+        for (QByteArrayList::iterator it = extraArgs.begin(); it != eend; ++it) {
+            QByteArray &e = *it;
             if (!e.isEmpty() && e != zero && !isInteger(e)) {
-                const QMap<QString, QString>::const_iterator eit = m_expressionCache.constFind(e);
+                const ExpressionCache::const_iterator eit = m_expressionCache.constFind(e);
                 if (eit != excCend)
                     e = eit.value();
             }
@@ -1325,25 +1332,23 @@ void QtDumperHelper::evaluationParameters(const WatchData &data,
 }
 
 // Return debugger expression to get the offset of a map node.
-QString QtDumperHelper::qMapNodeValueOffsetExpression(const QString &type,
-                                                      const QString &addressIn,
-                                                      Debugger debugger) const
+QByteArray QtDumperHelper::qMapNodeValueOffsetExpression
+    (const QByteArray &type, const QByteArray &addressIn, Debugger debugger) const
 {
     switch (debugger) {
     case GdbDebugger:
-        return QLatin1String("(size_t)&(('") + type + QLatin1String("'*)0)->value");
+        return "(size_t)&(('" + type + "'*)0)->value";
     case CdbDebugger: {
             // Cdb: This will only work if a QMapNode is in scope.
             // We need an address as CDB cannot do the 0-trick.
             // Use data address or try at least cache if missing.
-            const QString address = addressIn.isEmpty() ? QString::fromLatin1("DUMMY_ADDRESS") : addressIn;
-            QString offsetExpression;
-            QTextStream(&offsetExpression) << "(size_t)&(((" << type
-                    << " *)" << address << ")->value)-" << address;
+            const QByteArray address = addressIn.isEmpty() ? "DUMMY_ADDRESS" : addressIn;
+            QByteArray offsetExpression = "(size_t)&(((" + type
+                    + " *)" + address + ")->value)-" + address;
             return lookupCdbDummyAddressExpression(offsetExpression, address);
         }
     }
-    return QString();
+    return QByteArray();
 }
 
 /* Cdb cannot do tricks like ( "&(std::pair<int,int>*)(0)->second)",
@@ -1352,12 +1357,12 @@ QString QtDumperHelper::qMapNodeValueOffsetExpression(const QString &type,
  * "memory access error". As a trick, use the address of the watch item
  * to do this. However, in the expression cache, 0 is still used, so,
  * for cache lookups,  use '0' as address. */
-QString QtDumperHelper::lookupCdbDummyAddressExpression(const QString &expr,
-                                                        const QString &address) const
+QByteArray QtDumperHelper::lookupCdbDummyAddressExpression
+    (const QByteArray &expr, const QByteArray &address) const
 {
-    QString nullExpr = expr;
-    nullExpr.replace(address, QString(QLatin1Char('0')));
-    const QString rc = m_expressionCache.value(nullExpr, expr);
+    QByteArray nullExpr = expr;
+    nullExpr.replace(address, "0");
+    const QByteArray rc = m_expressionCache.value(nullExpr, expr);
     if (debug)
         qDebug() << "lookupCdbDummyAddressExpression" << expr << rc;
     return rc;
@@ -1365,9 +1370,7 @@ QString QtDumperHelper::lookupCdbDummyAddressExpression(const QString &expr,
 
 // GdbMi parsing helpers for parsing dumper value results
 
-static bool gdbMiGetIntValue(int *target,
-                             const GdbMi &node,
-                             const char *child)
+static bool gdbMiGetIntValue(int *target, const GdbMi &node, const char *child)
 {
     *target = -1;
     const GdbMi childNode = node.findChild(child);
@@ -1497,9 +1500,9 @@ static void gbdMiToWatchData(const GdbMi &root,
     // Type from context or self
     if (ctx.childType.isEmpty()) {
         if (gdbMiGetStringValue(&v, root, "type"))
-            w.setType(v);
+            w.setType(v.toUtf8());
     } else {
-        w.setType(ctx.childType);
+        w.setType(ctx.childType.toUtf8());
     }
     // child count?
     int numChild = -1;
@@ -1616,14 +1619,14 @@ void setWatchDataAddressHelper(WatchData &data, const QByteArray &addr)
 {
     data.addr = addr;
     if (data.exp.isEmpty() && !data.addr.startsWith("$"))
-        data.exp = "*(" + gdbQuoteTypes(data.type).toLatin1() + "*)" + data.addr;
+        data.exp = "*(" + gdbQuoteTypes(data.type) + "*)" + data.addr;
 }
 
 // Find the "type" and "displayedtype" children of root and set up type.
 void setWatchDataType(WatchData &data, const GdbMi &item)
 {
     if (item.isValid())
-        data.setType(_(item.data()));
+        data.setType(item.data());
     else if (data.type.isEmpty())
         data.setTypeNeeded();
 }
diff --git a/src/plugins/debugger/watchutils.h b/src/plugins/debugger/watchutils.h
index e2afe8fff9d..b63e815f73e 100644
--- a/src/plugins/debugger/watchutils.h
+++ b/src/plugins/debugger/watchutils.h
@@ -70,19 +70,19 @@ inline bool isNameChar(char c)
 bool hasLetterOrNumber(const QString &exp);
 bool hasSideEffects(const QString &exp);
 bool isKeyWord(const QString &exp);
-bool isPointerType(const QString &type);
-bool isCharPointerType(const QString &type);
+bool isPointerType(const QByteArray &type);
+bool isCharPointerType(const QByteArray &type);
 bool startsWithDigit(const QString &str);
-QString stripPointerType(QString type);
+QByteArray stripPointerType(QByteArray type);
 QString gdbQuoteTypes(const QString &type);
 bool extractTemplate(const QString &type, QString *tmplate, QString *inner);
 QString extractTypeFromPTypeOutput(const QString &str);
-bool isIntOrFloatType(const QString &type);
-bool isIntType(const QString &type);
-bool isSymbianIntType(const QString &type);
+bool isIntOrFloatType(const QByteArray &type);
+bool isIntType(const QByteArray &type);
+bool isSymbianIntType(const QByteArray &type);
 
 enum GuessChildrenResult { HasChildren, HasNoChildren, HasPossiblyChildren };
-GuessChildrenResult guessChildren(const QString &type);
+GuessChildrenResult guessChildren(const QByteArray &type);
 
 QString quoteUnprintableLatin1(const QByteArray &ba);
 
@@ -144,8 +144,8 @@ public:
 
         Type type;
         bool isTemplate;
-        QString tmplate;
-        QString inner;
+        QByteArray tmplate;
+        QByteArray inner;
     };
 
     QtDumperHelper();
@@ -155,28 +155,28 @@ public:
 
     int typeCount() const;
     // Look up a simple, non-template  type
-    Type simpleType(const QString &simpleType) const;
+    Type simpleType(const QByteArray &simpleType) const;
     // Look up a (potentially) template type and fill parameter struct
-    TypeData typeData(const QString &typeName) const;
-    Type type(const QString &typeName) const;
+    TypeData typeData(const QByteArray &typeName) const;
+    Type type(const QByteArray &typeName) const;
 
     int qtVersion() const;
-    QString qtVersionString() const;
-    QString qtNamespace() const;
+    QByteArray qtVersionString() const;
+    QByteArray qtNamespace() const;
 
     // Complete parse of "query" (protocol 1) response from debuggee buffer.
     // 'data' excludes the leading indicator character.
     bool parseQuery(const char *data);
     bool parseQuery(const GdbMi &data);
     // Sizes can be added as the debugger determines them
-    void addSize(const QString &name, int size);
+    void addSize(const QByteArray &type, int size);
 
     // Determine the parameters required for an "evaluate" (protocol 2) call
     void evaluationParameters(const WatchData &data,
                               const TypeData &td,
                               Debugger debugger,
                               QByteArray *inBuffer,
-                              QStringList *extraParameters) const;
+                              QList<QByteArray> *extraParameters) const;
 
     // Parse the value response (protocol 2) from debuggee buffer.
     // 'data' excludes the leading indicator character.
@@ -188,15 +188,15 @@ public:
 
 private:
     typedef QMap<QString, Type> NameTypeMap;
-    typedef QMap<QString, int> SizeCache;
+    typedef QMap<QByteArray, int> SizeCache;
 
     // Look up a simple (namespace) type
-    QString evaluationSizeofTypeExpression(const QString &typeName, Debugger d) const;
-    QString qMapNodeValueOffsetExpression(const QString &type,
-                                          const QString &addressIn,
-                                          Debugger debugger) const;
+    QByteArray evaluationSizeofTypeExpression(const QByteArray &typeName, Debugger d) const;
+    QByteArray qMapNodeValueOffsetExpression(const QByteArray &type,
+        const QByteArray &addressIn, Debugger debugger) const;
 
-    QString lookupCdbDummyAddressExpression(const QString &expr, const QString &address) const;
+    QByteArray lookupCdbDummyAddressExpression
+        (const QByteArray &expr, const QByteArray &address) const;
 
     NameTypeMap m_nameTypeMap;
     SizeCache m_sizeCache;
@@ -211,25 +211,26 @@ private:
                            SpecialSizeCount };
 
     // Resolve name to enumeration or SpecialSizeCount (invalid)
-    SpecialSizeType specialSizeType(const QString &t) const;
+    SpecialSizeType specialSizeType(const QByteArray &type) const;
 
     int m_specialSizes[SpecialSizeCount];
 
-    QMap<QString, QString> m_expressionCache;
+    typedef QMap<QByteArray, QByteArray> ExpressionCache;
+    ExpressionCache m_expressionCache;
     int m_qtVersion;
     double m_dumperVersion;
-    QString m_qtNamespace;
-
-    void setQClassPrefixes(const QString &qNamespace);
-
-    QString m_qPointerPrefix;
-    QString m_qSharedPointerPrefix;
-    QString m_qSharedDataPointerPrefix;
-    QString m_qWeakPointerPrefix;
-    QString m_qListPrefix;
-    QString m_qLinkedListPrefix;
-    QString m_qVectorPrefix;
-    QString m_qQueuePrefix;
+    QByteArray m_qtNamespace;
+
+    void setQClassPrefixes(const QByteArray &qNamespace);
+
+    QByteArray m_qPointerPrefix;
+    QByteArray m_qSharedPointerPrefix;
+    QByteArray m_qSharedDataPointerPrefix;
+    QByteArray m_qWeakPointerPrefix;
+    QByteArray m_qListPrefix;
+    QByteArray m_qLinkedListPrefix;
+    QByteArray m_qVectorPrefix;
+    QByteArray m_qQueuePrefix;
 };
 
 QDebug operator<<(QDebug in, const QtDumperHelper::TypeData &d);
-- 
GitLab