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;
}
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';
}
// 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
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;
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;
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);
{
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;
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());
// 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('"')))
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);
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())
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);
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 + ')';
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);