diff --git a/src/plugins/debugger/cdb/cdbdumperhelper.cpp b/src/plugins/debugger/cdb/cdbdumperhelper.cpp index 4646e046e8740a3fd46e9ff61ae44e9c4f2e0cdc..70a9dc60d94cf496c54c1286948af13f49a0b5bf 100644 --- a/src/plugins/debugger/cdb/cdbdumperhelper.cpp +++ b/src/plugins/debugger/cdb/cdbdumperhelper.cpp @@ -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; diff --git a/src/plugins/debugger/cdb/cdbdumperhelper.h b/src/plugins/debugger/cdb/cdbdumperhelper.h index 3ab493f18be00e5461fd50fcb2764ecb610b537e..3535dc7e41259ad453d31b17524ec8729aa56635 100644 --- a/src/plugins/debugger/cdb/cdbdumperhelper.h +++ b/src/plugins/debugger/cdb/cdbdumperhelper.h @@ -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); diff --git a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp index 2051afadf14e65e9debeec7282a087c3826bc2dd..f656e71e36bbe49a7547bc905cb17329c2068e05 100644 --- a/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp +++ b/src/plugins/debugger/cdb/cdbsymbolgroupcontext.cpp @@ -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()) diff --git a/src/plugins/debugger/gdb/classicgdbengine.cpp b/src/plugins/debugger/gdb/classicgdbengine.cpp index 308342a6923c3647b4aa3c2335da2e96ab55fbfc..aa75fd65d59e4270dc82faae5a2f60a5c523df80 100644 --- a/src/plugins/debugger/gdb/classicgdbengine.cpp +++ b/src/plugins/debugger/gdb/classicgdbengine.cpp @@ -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 + ')'; diff --git a/src/plugins/debugger/watchutils.h b/src/plugins/debugger/watchutils.h index b63e815f73e3bb3baffa8f854c8af2246fffcd99..a9c3bb5318a22eacba88700906ca7acf7e13e862 100644 --- a/src/plugins/debugger/watchutils.h +++ b/src/plugins/debugger/watchutils.h @@ -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);