OSDN Git Service

debugger: compile fix msvc. done by hjk.
authorRobert Loehning <robert.loehning@nokia.com>
Wed, 1 Sep 2010 16:01:08 +0000 (18:01 +0200)
committerRobert Loehning <robert.loehning@nokia.com>
Wed, 1 Sep 2010 16:02:56 +0000 (18:02 +0200)
src/plugins/debugger/cdb/cdbdumperhelper.cpp
src/plugins/debugger/cdb/cdbdumperhelper.h
src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp
src/plugins/debugger/gdb/classicgdbengine.cpp
src/plugins/debugger/watchutils.h

index 4646e04..70a9dc6 100644 (file)
@@ -624,7 +624,8 @@ CdbDumperHelper::DumpResult CdbDumperHelper::dumpTypeI(const WatchData &wd, bool
         return DumpNotHandled;
     }
     if (wd.addr.isEmpty()) {
-        *errorMessage = QString::fromLatin1("Address is missing for '%1' (%2).").arg(wd.exp, wd.type);
+        *errorMessage = QString::fromLatin1("Address is missing for '%1' (%2).")
+            .arg(QString::fromUtf8(wd.exp)).arg(QString::fromUtf8(wd.type));
         return DumpNotHandled;
     }
 
@@ -684,14 +685,14 @@ CdbDumperHelper::DumpExecuteResult
                                 QList<WatchData> *result, QString *errorMessage)
 {
     QByteArray inBuffer;
-    QStringList extraParameters;
+    QList<QByteArray> extraParameters;
     // Build parameter list.
     m_helper.evaluationParameters(wd, td, QtDumperHelper::CdbDebugger, &inBuffer, &extraParameters);
     QString callCmd;
     QTextStream str(&callCmd);
     str << ".call " << m_dumpObjectSymbol << "(2,0," << wd.addr << ',' << (dumpChildren ? 1 : 0);
-    foreach(const QString &e, extraParameters)
-        str << ',' << e;
+    foreach(const QByteArray &e, extraParameters)
+        str << ',' << QString::fromUtf8(e);
     str << ')';
     if (dumpDebug)
         qDebug() << "Query: " << wd.toString() << "\nwith: " << callCmd << '\n';
@@ -718,18 +719,18 @@ CdbDumperHelper::DumpExecuteResult
 }
 
 // Simplify some types for sizeof expressions
-static inline void simplifySizeExpression(QString *typeName)
+static void simplifySizeExpression(QByteArray *typeName)
 {
-    typeName->replace(QLatin1String("std::basic_string<char,std::char_traits<char>,std::allocator<char>>"),
-                      QLatin1String("std::string"));
+    typeName->replace("std::basic_string<char,std::char_traits<char>,std::allocator<char>>",
+                      "std::string");
 }
 
-bool CdbDumperHelper::getTypeSize(const QString &typeNameIn, int *size, QString *errorMessage)
+bool CdbDumperHelper::getTypeSize(const QByteArray &typeNameIn, int *size, QString *errorMessage)
 {
     if (loadDebug > 1)
         qDebug() << Q_FUNC_INFO << typeNameIn;
     // Look up cache
-    QString typeName = typeNameIn;
+    QByteArray typeName = typeNameIn;
     simplifySizeExpression(&typeName);
     // "std::" types sometimes only work without namespace.
     // If it fails, try again with stripped namespace
@@ -740,10 +741,9 @@ bool CdbDumperHelper::getTypeSize(const QString &typeNameIn, int *size, QString
             success = true;
             break;
         }
-        const QString stdNameSpace = QLatin1String("std::");
-        if (!typeName.contains(stdNameSpace))
+        if (!typeName.contains("std::"))
             break;
-        typeName.remove(stdNameSpace);
+        typeName.replace("std::", "");
         errorMessage->clear();
         if (!runTypeSizeQuery(typeName, size, errorMessage))
             break;
@@ -755,14 +755,13 @@ bool CdbDumperHelper::getTypeSize(const QString &typeNameIn, int *size, QString
     return success;
 }
 
-bool CdbDumperHelper::runTypeSizeQuery(const QString &typeName, int *size, QString *errorMessage)
+bool CdbDumperHelper::runTypeSizeQuery
+        (const QByteArray &typeName, int *size, QString *errorMessage)
 {
     // Retrieve by C++ expression. If we knew the module, we could make use
     // of the TypeId query mechanism provided by the IDebugSymbolGroup.
     DEBUG_VALUE sizeValue;
-    QString expression = QLatin1String("sizeof(");
-    expression += typeName;
-    expression += QLatin1Char(')');
+    QByteArray expression = "sizeof(" + typeName + ')';
     if (!m_coreEngine->evaluateExpression(expression, &sizeValue, errorMessage))
         return false;
     qint64 size64;
index 3ab493f..3535dc7 100644 (file)
@@ -126,8 +126,8 @@ private:
     inline DumpResult dumpTypeI(const WatchData &d, bool dumpChildren,
                                 QList<WatchData> *result, QString *errorMessage);
 
-    bool getTypeSize(const QString &typeName, int *size, QString *errorMessage);
-    bool runTypeSizeQuery(const QString &typeName, int *size, QString *errorMessage);
+    bool getTypeSize(const QByteArray &typeName, int *size, QString *errorMessage);
+    bool runTypeSizeQuery(const QByteArray &typeName, int *size, QString *errorMessage);
     enum CallResult { CallOk, CallSyntaxError, CallFailed };
     CallResult callDumper(const QString &call, const QByteArray &inBuffer, const char **outputPtr,
                           bool ignoreAccessViolation, QString *errorMessage);
index 2051afa..f656e71 100644 (file)
@@ -139,7 +139,9 @@ static inline bool fixDumperType(WatchData *wd, const WatchData *source = 0)
 {
     const bool missing = wd->isTypeNeeded() || wd->type.isEmpty();
     if (missing) {
-        static const QString unknownType = QCoreApplication::translate("CdbSymbolGroupContext", "<Unknown Type>");
+        static const QByteArray unknownType =
+                QCoreApplication::translate("CdbSymbolGroupContext", "<Unknown Type>")
+                        .toUtf8();
         wd->setType(source ? source->type : unknownType, false);
     }
     return missing;
@@ -231,7 +233,7 @@ bool WatchHandleDumperInserter::expandPointerToDumpable(const WatchData &wd, QSt
         const QString hexAddrS = wd.value.mid(0, classPos);
         if (m_hexNullPattern.exactMatch(hexAddrS))
             break;
-        const QString type = stripPointerType(wd.type);
+        const QByteArray type = stripPointerType(wd.type);
         WatchData derefedWd;
         derefedWd.setType(type);
         derefedWd.setAddress(hexAddrS.toLatin1());
@@ -343,7 +345,7 @@ 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 QLatin1String &type)
+static inline QString fixValue(const QString &value, const QByteArray &type)
 {
     // Pass through strings
     if (value.endsWith(QLatin1Char('"')))
@@ -368,12 +370,12 @@ unsigned CdbSymbolGroupContext::watchDataAt(unsigned long index, WatchData *wd)
     const unsigned rc = dumpValue(index, &iname, &(wd->name), &address,
                                   &typeId, &type, &value);
     wd->exp = wd->iname = iname.toLatin1();
-    wd->setAddress(("0x") + QByteArray::number(address, 16));
-    wd->setType(type, false);
+    wd->setAddress("0x" + QByteArray::number(address, 16));
+    wd->setType(type.toUtf8(), false);
     if (rc & OutOfScope) {
         wd->setError(WatchData::msgNotInScope());
     } else {
-        wd->setValue(fixValue(value, type));
+        wd->setValue(fixValue(value, type.toUtf8()));
 
         const bool hasChildren = rc & HasChildren;
         wd->setHasChildren(hasChildren);
@@ -445,7 +447,10 @@ bool CdbSymbolGroupContext::completeData(const WatchData &incompleteLocal,
             fixDumperResult(incompleteLocal, &dumperResult, suppressGrandChildren);
             wh->insertBulkData(dumperResult);
         } else {
-            const QString msg = QString::fromLatin1("Unable to further expand dumper watch data: '%1' (%2): %3/%4").arg(incompleteLocal.name, incompleteLocal.type).arg(int(dr)).arg(*errorMessage);
+            const QString msg = QString::fromLatin1("Unable to further expand dumper watch data: '%1' (%2): %3/%4")
+                .arg(incompleteLocal.name)
+                .arg(QString::fromUtf8(incompleteLocal.type))
+                .arg(int(dr)).arg(*errorMessage);
             qWarning("%s", qPrintable(msg));
             WatchData wd = incompleteLocal;
             if (wd.isValueNeeded())
index 308342a..aa75fd6 100644 (file)
@@ -220,7 +220,7 @@ void GdbEngine::createGdbVariableClassic(const WatchData &data)
     postCommand("-var-delete \"" + data.iname + '"', WatchUpdate);
     QByteArray exp = data.exp;
     if (exp.isEmpty() && data.addr.startsWith("0x"))
-        exp = "*(" + gdbQuoteTypes(data.type).toLatin1() + "*)" + data.addr;
+        exp = "*(" + gdbQuoteTypes(data.type) + "*)" + data.addr;
     QVariant val = QVariant::fromValue<WatchData>(data);
     postCommand("-var-create \"" + data.iname + "\" * \"" + exp + '"',
         WatchUpdate, CB(handleVarCreate), val);
@@ -475,7 +475,7 @@ void GdbEngine::handleDebuggingHelperValue3Classic(const GdbResponse &response)
                     data1.type = data.type.left(data.type.size() - 4);
                     data1.iname = data.iname + '.' + QByteArray::number(i);
                     data1.addr = list.at(i);
-                    data1.exp = "((" + gdbQuoteTypes(data1.type).toLatin1() + "*)" + data1.addr + ')';
+                    data1.exp = "((" + gdbQuoteTypes(data1.type) + "*)" + data1.addr + ')';
                     data1.setHasChildren(false);
                     data1.setValueNeeded();
                     QByteArray cmd = "qdumpqstring (" + data1.exp + ')';
index b63e815..a9c3bb5 100644 (file)
@@ -74,7 +74,7 @@ bool isPointerType(const QByteArray &type);
 bool isCharPointerType(const QByteArray &type);
 bool startsWithDigit(const QString &str);
 QByteArray stripPointerType(QByteArray type);
-QString gdbQuoteTypes(const QString &type);
+QByteArray gdbQuoteTypes(const QByteArray &type);
 bool extractTemplate(const QString &type, QString *tmplate, QString *inner);
 QString extractTypeFromPTypeOutput(const QString &str);
 bool isIntOrFloatType(const QByteArray &type);