Debugger: Fix build with Qt6

QStringRef gone.
ViewOptions changed.
MetaType register stream operators automatically.

Task-number: QTCREATORBUG-24098
Change-Id: Ibf98561af951aa5fc4ec483d18dafeaad02e07c3
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2020-09-18 13:05:37 +02:00
parent 3a602e8338
commit 2a70bc1d09
14 changed files with 59 additions and 47 deletions

View File

@@ -137,7 +137,7 @@ void BreakpointParameters::updateLocation(const QString &location)
{ {
if (!location.isEmpty()) { if (!location.isEmpty()) {
int pos = location.indexOf(':'); int pos = location.indexOf(':');
lineNumber = location.midRef(pos + 1).toInt(); lineNumber = location.mid(pos + 1).toInt();
QString file = location.left(pos); QString file = location.left(pos);
if (file.startsWith('"') && file.endsWith('"')) if (file.startsWith('"') && file.endsWith('"'))
file = file.mid(1, file.size() - 2); file = file.mid(1, file.size() - 2);
@@ -156,9 +156,9 @@ bool BreakpointParameters::isQmlFileAndLineBreakpoint() const
if (qmlExtensionString.isEmpty()) if (qmlExtensionString.isEmpty())
qmlExtensionString = ".qml;.js"; qmlExtensionString = ".qml;.js";
const auto qmlFileExtensions = qmlExtensionString.splitRef(';', Qt::SkipEmptyParts); const auto qmlFileExtensions = qmlExtensionString.split(';', Qt::SkipEmptyParts);
const QString file = fileName.toString(); const QString file = fileName.toString();
for (const QStringRef &extension : qmlFileExtensions) { for (const QString &extension : qmlFileExtensions) {
if (file.endsWith(extension, Qt::CaseInsensitive)) if (file.endsWith(extension, Qt::CaseInsensitive))
return true; return true;
} }
@@ -347,7 +347,7 @@ void BreakpointParameters::updateFromGdbOutput(const GdbMi &bkpt)
QString what = bkpt["what"].data(); QString what = bkpt["what"].data();
if (what.startsWith("*0x")) { if (what.startsWith("*0x")) {
type = WatchpointAtAddress; type = WatchpointAtAddress;
address = what.midRef(1).toULongLong(nullptr, 0); address = what.mid(1).toULongLong(nullptr, 0);
} else { } else {
type = WatchpointAtExpression; type = WatchpointAtExpression;
expression = what; expression = what;

View File

@@ -1026,20 +1026,19 @@ void CdbEngine::runCommand(const DebuggerCommand &dbgCmd)
// Post an extension command producing one-line output with a callback, // Post an extension command producing one-line output with a callback,
// pass along token for identification in hash. // pass along token for identification in hash.
const QString prefix = m_extensionCommandPrefix + dbgCmd.function; const QString prefix = m_extensionCommandPrefix + dbgCmd.function;
QList<QStringRef> splittedArguments;
if (dbgCmd.args.isString()) { if (dbgCmd.args.isString()) {
const QString &arguments = dbgCmd.argsToString(); const QString &arguments = dbgCmd.argsToString();
cmd = prefix + arguments; cmd = prefix + arguments;
int argumentSplitPos = 0; int argumentSplitPos = 0;
QList<QStringRef> splittedArguments; QList<QStringView> splittedArguments;
int maxArgumentSize = maxCommandLength - prefix.length() - maxTokenLength; int maxArgumentSize = maxCommandLength - prefix.length() - maxTokenLength;
while (argumentSplitPos < arguments.size()) { while (argumentSplitPos < arguments.size()) {
splittedArguments << arguments.midRef(argumentSplitPos, maxArgumentSize); splittedArguments << Utils::midView(arguments, argumentSplitPos, maxArgumentSize);
argumentSplitPos += splittedArguments.last().length(); argumentSplitPos += splittedArguments.last().length();
} }
QTC_CHECK(argumentSplitPos == arguments.size()); QTC_CHECK(argumentSplitPos == arguments.size());
int tokenPart = splittedArguments.size(); int tokenPart = splittedArguments.size();
for (const QStringRef &part : qAsConst(splittedArguments)) for (const QStringView &part : qAsConst(splittedArguments))
str << prefix << " -t " << token << '.' << --tokenPart << ' ' << part << '\n'; str << prefix << " -t " << token << '.' << --tokenPart << ' ' << part << '\n';
} else { } else {
cmd = prefix; cmd = prefix;
@@ -1961,8 +1960,8 @@ void CdbEngine::ensureUsing32BitStackInWow64(const DebuggerResponse &response, c
{ {
// Parsing the header of the stack output to check which bitness // Parsing the header of the stack output to check which bitness
// the cdb is currently using. // the cdb is currently using.
const QVector<QStringRef> lines = response.data.data().splitRef('\n'); const QStringList lines = response.data.data().split('\n');
for (const QStringRef &line : lines) { for (const QString &line : lines) {
if (!line.startsWith("Child")) if (!line.startsWith("Child"))
continue; continue;
if (line.startsWith("ChildEBP")) { if (line.startsWith("ChildEBP")) {
@@ -2238,7 +2237,7 @@ static inline bool checkCommandToken(const QString &tokenPrefix, const QString &
if (!c.startsWith(tokenPrefix)) if (!c.startsWith(tokenPrefix))
return false; return false;
bool ok; bool ok;
*token = c.midRef(tokenPrefixSize, size - tokenPrefixSize - 1).toInt(&ok); *token = c.mid(tokenPrefixSize, size - tokenPrefixSize - 1).toInt(&ok);
return ok; return ok;
} }
@@ -2259,19 +2258,21 @@ void CdbEngine::parseOutputLine(QString line)
const int tokenPos = creatorExtPrefix.size() + 2; const int tokenPos = creatorExtPrefix.size() + 2;
const int tokenEndPos = line.indexOf('|', tokenPos); const int tokenEndPos = line.indexOf('|', tokenPos);
QTC_ASSERT(tokenEndPos != -1, return); QTC_ASSERT(tokenEndPos != -1, return);
const int token = line.midRef(tokenPos, tokenEndPos - tokenPos).toInt(); const int token = line.mid(tokenPos, tokenEndPos - tokenPos).toInt();
// remainingChunks // remainingChunks
const int remainingChunksPos = tokenEndPos + 1; const int remainingChunksPos = tokenEndPos + 1;
const int remainingChunksEndPos = line.indexOf('|', remainingChunksPos); const int remainingChunksEndPos = line.indexOf('|', remainingChunksPos);
QTC_ASSERT(remainingChunksEndPos != -1, return); QTC_ASSERT(remainingChunksEndPos != -1, return);
const int remainingChunks = line.midRef(remainingChunksPos, remainingChunksEndPos - remainingChunksPos).toInt(); const int remainingChunks = line.mid(remainingChunksPos,
remainingChunksEndPos - remainingChunksPos)
.toInt();
// const char 'serviceName' // const char 'serviceName'
const int whatPos = remainingChunksEndPos + 1; const int whatPos = remainingChunksEndPos + 1;
const int whatEndPos = line.indexOf('|', whatPos); const int whatEndPos = line.indexOf('|', whatPos);
QTC_ASSERT(whatEndPos != -1, return); QTC_ASSERT(whatEndPos != -1, return);
const QString what = line.mid(whatPos, whatEndPos - whatPos); const QString what = line.mid(whatPos, whatEndPos - whatPos);
// Build up buffer, call handler once last chunk was encountered // Build up buffer, call handler once last chunk was encountered
m_extensionMessageBuffer += line.midRef(whatEndPos + 1); m_extensionMessageBuffer += line.mid(whatEndPos + 1);
if (remainingChunks == 0) { if (remainingChunks == 0) {
handleExtensionMessage(type, token, what, m_extensionMessageBuffer); handleExtensionMessage(type, token, what, m_extensionMessageBuffer);
m_extensionMessageBuffer.clear(); m_extensionMessageBuffer.clear();
@@ -2742,7 +2743,7 @@ void CdbEngine::setupScripting(const DebuggerResponse &response)
const QString &verOutput = data.childAt(0).data(); const QString &verOutput = data.childAt(0).data();
const QString firstToken = verOutput.split(' ').constFirst(); const QString firstToken = verOutput.split(' ').constFirst();
const QVector<QStringRef> pythonVersion = firstToken.splitRef('.'); const QStringList pythonVersion = firstToken.split('.');
bool ok = false; bool ok = false;
if (pythonVersion.size() == 3) { if (pythonVersion.size() == 3) {
@@ -2849,7 +2850,7 @@ void CdbEngine::handleWidgetAt(const DebuggerResponse &response)
break; break;
} }
// 0x000 -> nothing found // 0x000 -> nothing found
if (!watchExp.midRef(sepPos + 1).toULongLong(nullptr, 0)) { if (!watchExp.mid(sepPos + 1).toULongLong(nullptr, 0)) {
message = QString("No widget could be found at %1, %2.").arg(m_watchPointX).arg(m_watchPointY); message = QString("No widget could be found at %1, %2.").arg(m_watchPointX).arg(m_watchPointY);
break; break;
} }

View File

@@ -42,7 +42,11 @@ public:
StringInputStream &operator<<(char a) { m_target.append(a); return *this; } StringInputStream &operator<<(char a) { m_target.append(a); return *this; }
StringInputStream &operator<<(const char *a) { m_target.append(QString::fromUtf8(a)); return *this; } StringInputStream &operator<<(const char *a) { m_target.append(QString::fromUtf8(a)); return *this; }
StringInputStream &operator<<(const QString &a) { m_target.append(a); return *this; } StringInputStream &operator<<(const QString &a) { m_target.append(a); return *this; }
StringInputStream &operator<<(const QStringRef &a) { m_target.append(a); return *this; } StringInputStream &operator<<(const QStringView &a)
{
m_target.append(a.toString());
return *this;
}
StringInputStream &operator<<(int i) { appendInt(i); return *this; } StringInputStream &operator<<(int i) { appendInt(i); return *this; }
StringInputStream &operator<<(unsigned i) { appendInt(i); return *this; } StringInputStream &operator<<(unsigned i) { appendInt(i); return *this; }

View File

@@ -104,8 +104,13 @@ void ConsoleView::mousePressEvent(QMouseEvent *event)
bool handled = false; bool handled = false;
if (type == ConsoleItem::DefaultType) { if (type == ConsoleItem::DefaultType) {
bool showTypeIcon = index.parent() == QModelIndex(); bool showTypeIcon = index.parent() == QModelIndex();
ConsoleItemPositions positions(m_model, visualRect(index), viewOptions().font, showTypeIcon, #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
true); const QStyleOptionViewItem option = viewOptions();
#else
QStyleOptionViewItem option;
initViewItemOption(&option);
#endif
ConsoleItemPositions positions(m_model, visualRect(index), option.font, showTypeIcon, true);
if (positions.expandCollapseIcon().contains(pos)) { if (positions.expandCollapseIcon().contains(pos)) {
if (isExpanded(index)) if (isExpanded(index))

View File

@@ -2128,7 +2128,9 @@ DebuggerPlugin::DebuggerPlugin()
m_instance = this; m_instance = this;
qRegisterMetaType<PerspectiveState>("Utils::PerspectiveState"); qRegisterMetaType<PerspectiveState>("Utils::PerspectiveState");
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
qRegisterMetaTypeStreamOperators<PerspectiveState>("Utils::PerspectiveState"); qRegisterMetaTypeStreamOperators<PerspectiveState>("Utils::PerspectiveState");
#endif
} }
DebuggerPlugin::~DebuggerPlugin() DebuggerPlugin::~DebuggerPlugin()

View File

@@ -657,7 +657,7 @@ QString decodeData(const QString &ba, const QString &encoding)
case DebuggerEncoding::JulianDateAndMillisecondsSinceMidnight: { case DebuggerEncoding::JulianDateAndMillisecondsSinceMidnight: {
const int p = ba.indexOf('/'); const int p = ba.indexOf('/');
const QDate date = dateFromData(ba.left(p).toInt()); const QDate date = dateFromData(ba.left(p).toInt());
const QTime time = timeFromData(ba.midRef(p + 1 ).toInt()); const QTime time = timeFromData(ba.mid(p + 1).toInt());
const QDateTime dateTime = QDateTime(date, time); const QDateTime dateTime = QDateTime(date, time);
return dateTime.isValid() ? dateTime.toString(Qt::TextDate) : "(invalid)"; return dateTime.isValid() ? dateTime.toString(Qt::TextDate) : "(invalid)";
} }
@@ -698,15 +698,15 @@ QString decodeData(const QString &ba, const QString &encoding)
qint64 msecs = ba.left(p0).toLongLong(); qint64 msecs = ba.left(p0).toLongLong();
++p0; ++p0;
Qt::TimeSpec spec = Qt::TimeSpec(ba.midRef(p0, p1 - p0).toInt()); Qt::TimeSpec spec = Qt::TimeSpec(ba.mid(p0, p1 - p0).toInt());
++p1; ++p1;
qulonglong offset = ba.midRef(p1, p2 - p1).toInt(); qulonglong offset = ba.mid(p1, p2 - p1).toInt();
++p2; ++p2;
QByteArray timeZoneId = QByteArray::fromHex(ba.mid(p2, p3 - p2).toUtf8()); QByteArray timeZoneId = QByteArray::fromHex(ba.mid(p2, p3 - p2).toUtf8());
++p3; ++p3;
int status = ba.midRef(p3, p4 - p3).toInt(); int status = ba.mid(p3, p4 - p3).toInt();
++p4; ++p4;
int tiVersion = ba.midRef(p4).toInt(); int tiVersion = ba.mid(p4).toInt();
QDate date; QDate date;
QTime time; QTime time;
@@ -861,9 +861,9 @@ QString DebuggerCommand::argsToString() const
DebuggerEncoding::DebuggerEncoding(const QString &data) DebuggerEncoding::DebuggerEncoding(const QString &data)
{ {
const QVector<QStringRef> l = data.splitRef(':'); const QStringList l = data.split(':');
const QStringRef &t = l.at(0); const QString &t = l.at(0);
if (t == "latin1") { if (t == "latin1") {
type = HexEncodedLatin1; type = HexEncodedLatin1;
size = 1; size = 1;

View File

@@ -940,9 +940,9 @@ void DebuggerToolTipHolder::positionShow(const TextEditorWidget *editorWidget)
//// Parse a 'yyyyMMdd' date //// Parse a 'yyyyMMdd' date
static QDate dateFromString(const QString &date) static QDate dateFromString(const QString &date)
{ {
return date.size() == 8 ? return date.size() == 8
QDate(date.leftRef(4).toInt(), date.midRef(4, 2).toInt(), date.midRef(6, 2).toInt()) : ? QDate(date.left(4).toInt(), date.mid(4, 2).toInt(), date.mid(6, 2).toInt())
QDate(); : QDate();
} }
void DebuggerToolTipHolder::saveSessionData(QXmlStreamWriter &w) const void DebuggerToolTipHolder::saveSessionData(QXmlStreamWriter &w) const

View File

@@ -46,7 +46,7 @@ void DisassemblerLine::fromString(const QString &unparsed)
// Mac gdb has an overflow reporting 64bit addresses causing the instruction // Mac gdb has an overflow reporting 64bit addresses causing the instruction
// to follow the last digit "0x000000013fff4810mov 1,1". Truncate here. // to follow the last digit "0x000000013fff4810mov 1,1". Truncate here.
if (pos > 19 && unparsed.midRef(3, 16).toULongLong()) if (pos > 19 && unparsed.mid(3, 16).toULongLong())
pos = 19; pos = 19;
QString addr = unparsed.left(pos); QString addr = unparsed.left(pos);
@@ -190,7 +190,7 @@ void DisassemblerLines::appendUnparsed(const QString &unparsed)
} }
dl.address = address.left(pos1 - 1).toULongLong(nullptr, 0); dl.address = address.left(pos1 - 1).toULongLong(nullptr, 0);
dl.function = m_lastFunction; dl.function = m_lastFunction;
dl.offset = address.midRef(pos2).toUInt(); dl.offset = address.mid(pos2).toUInt();
} else { } else {
// Plain data like "0x0000cd64:\tadd\tlr, pc, lr\n" // Plain data like "0x0000cd64:\tadd\tlr, pc, lr\n"
dl.address = address.toULongLong(nullptr, 0); dl.address = address.toULongLong(nullptr, 0);

View File

@@ -178,7 +178,7 @@ static QString msgWinException(const QString &data, unsigned *exCodeIn = nullptr
const int addressPos = blankPos != -1 ? data.indexOf("0x", blankPos + 1) : -1; const int addressPos = blankPos != -1 ? data.indexOf("0x", blankPos + 1) : -1;
if (addressPos < 0) if (addressPos < 0)
return GdbEngine::tr("An exception was triggered."); return GdbEngine::tr("An exception was triggered.");
const unsigned exCode = data.midRef(exCodePos, blankPos - exCodePos).toUInt(nullptr, 0); const unsigned exCode = data.mid(exCodePos, blankPos - exCodePos).toUInt(nullptr, 0);
if (exCodeIn) if (exCodeIn)
*exCodeIn = exCode; *exCodeIn = exCode;
const quint64 address = data.mid(addressPos).trimmed().toULongLong(nullptr, 0); const quint64 address = data.mid(addressPos).trimmed().toULongLong(nullptr, 0);
@@ -1388,7 +1388,7 @@ void GdbEngine::handleStop2(const GdbMi &data)
const GdbMi wpt = data["wpt"]; const GdbMi wpt = data["wpt"];
const QString rid = wpt["number"].data(); const QString rid = wpt["number"].data();
const Breakpoint bp = breakHandler()->findBreakpointByResponseId(rid); const Breakpoint bp = breakHandler()->findBreakpointByResponseId(rid);
const quint64 bpAddress = wpt["exp"].data().midRef(1).toULongLong(nullptr, 0); const quint64 bpAddress = wpt["exp"].data().mid(1).toULongLong(nullptr, 0);
QString msg; QString msg;
if (bp) { if (bp) {
if (bp->type() == WatchpointAtExpression) if (bp->type() == WatchpointAtExpression)
@@ -2149,7 +2149,7 @@ void GdbEngine::handleWatchInsert(const DebuggerResponse &response, const Breakp
bp->setResponseId(wpt["number"].data()); bp->setResponseId(wpt["number"].data());
QString exp = wpt["exp"].data(); QString exp = wpt["exp"].data();
if (exp.startsWith('*')) if (exp.startsWith('*'))
bp->setAddress(exp.midRef(1).toULongLong(nullptr, 0)); bp->setAddress(exp.mid(1).toULongLong(nullptr, 0));
QTC_CHECK(!bp->needsChange()); QTC_CHECK(!bp->needsChange());
notifyBreakpointInsertOk(bp); notifyBreakpointInsertOk(bp);
} else if (ba.startsWith("Hardware watchpoint ") } else if (ba.startsWith("Hardware watchpoint ")
@@ -2160,7 +2160,7 @@ void GdbEngine::handleWatchInsert(const DebuggerResponse &response, const Breakp
const QString address = ba.mid(end + 2).trimmed(); const QString address = ba.mid(end + 2).trimmed();
bp->setResponseId(ba.mid(begin, end - begin)); bp->setResponseId(ba.mid(begin, end - begin));
if (address.startsWith('*')) if (address.startsWith('*'))
bp->setAddress(address.midRef(1).toULongLong(nullptr, 0)); bp->setAddress(address.mid(1).toULongLong(nullptr, 0));
QTC_CHECK(!bp->needsChange()); QTC_CHECK(!bp->needsChange());
notifyBreakpointInsertOk(bp); notifyBreakpointInsertOk(bp);
} else { } else {
@@ -3189,14 +3189,14 @@ void GdbEngine::handleRegisterListing(const DebuggerResponse &response)
m_registers.clear(); m_registers.clear();
QStringList lines = response.consoleStreamOutput.split('\n'); QStringList lines = response.consoleStreamOutput.split('\n');
for (int i = 1; i < lines.size(); ++i) { for (int i = 1; i < lines.size(); ++i) {
const QVector<QStringRef> parts = lines.at(i).splitRef(' ', Qt::SkipEmptyParts); const QStringList parts = lines.at(i).split(' ', Qt::SkipEmptyParts);
if (parts.size() < 7) if (parts.size() < 7)
continue; continue;
int gdbRegisterNumber = parts.at(1).toInt(); int gdbRegisterNumber = parts.at(1).toInt();
Register reg; Register reg;
reg.name = parts.at(0).toString(); reg.name = parts.at(0);
reg.size = parts.at(4).toInt(); reg.size = parts.at(4).toInt();
reg.reportedType = parts.at(5).toString(); reg.reportedType = parts.at(5);
m_registers[gdbRegisterNumber] = reg; m_registers[gdbRegisterNumber] = reg;
} }
} }
@@ -3587,7 +3587,7 @@ void GdbEngine::setupEngine()
} }
const QString tests = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_TESTS")); const QString tests = QString::fromLocal8Bit(qgetenv("QTC_DEBUGGER_TESTS"));
foreach (const QStringRef &test, tests.splitRef(',')) foreach (const QString &test, tests.split(','))
m_testCases.insert(test.toInt()); m_testCases.insert(test.toInt());
foreach (int test, m_testCases) foreach (int test, m_testCases)
showMessage("ENABLING TEST CASE: " + QString::number(test)); showMessage("ENABLING TEST CASE: " + QString::number(test));

View File

@@ -536,14 +536,14 @@ void LogWindow::showOutput(int channel, const QString &output)
const int npos = output.indexOf(nchar, pos); const int npos = output.indexOf(nchar, pos);
const int nnpos = npos == -1 ? n : npos; const int nnpos = npos == -1 ? n : npos;
const int l = nnpos - pos; const int l = nnpos - pos;
if (l != 6 || output.midRef(pos, 6) != "(gdb) ") { if (l != 6 || QStringView(output).mid(pos, 6) != QLatin1String("(gdb) ")) {
out.append(cchar); out.append(cchar);
if (l > 30000) { if (l > 30000) {
// FIXME: QTextEdit asserts on really long lines... // FIXME: QTextEdit asserts on really long lines...
out.append(output.midRef(pos, 30000)); out.append(output.mid(pos, 30000));
out.append(" [...] <cut off>\n"); out.append(" [...] <cut off>\n");
} else { } else {
out.append(output.midRef(pos, l + 1)); out.append(output.mid(pos, l + 1));
} }
} }
pos = nnpos + 1; pos = nnpos + 1;

View File

@@ -499,7 +499,7 @@ void PdbEngine::handleOutput2(const QString &data)
QTC_ASSERT(pos2 != -1, continue); QTC_ASSERT(pos2 != -1, continue);
const Utils::FilePath fileName = Utils::FilePath::fromString( const Utils::FilePath fileName = Utils::FilePath::fromString(
line.mid(pos1 + 4, pos2 - pos1 - 4)); line.mid(pos1 + 4, pos2 - pos1 - 4));
const int lineNumber = line.midRef(pos2 + 1).toInt(); const int lineNumber = line.mid(pos2 + 1).toInt();
const Breakpoint bp = Utils::findOrDefault(breakHandler()->breakpoints(), [&](const Breakpoint &bp) { const Breakpoint bp = Utils::findOrDefault(breakHandler()->breakpoints(), [&](const Breakpoint &bp) {
return bp->parameters().isLocatedAt(fileName, lineNumber, bp->markerFileName()) return bp->parameters().isLocatedAt(fileName, lineNumber, bp->markerFileName())
|| bp->requestedParameters().isLocatedAt(fileName, lineNumber, bp->markerFileName()); || bp->requestedParameters().isLocatedAt(fileName, lineNumber, bp->markerFileName());

View File

@@ -440,7 +440,7 @@ void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &objec
const int firstIndex = int(strlen("inspect")); const int firstIndex = int(strlen("inspect"));
const int secondIndex = iname.indexOf('.', firstIndex + 1); const int secondIndex = iname.indexOf('.', firstIndex + 1);
if (secondIndex != -1) if (secondIndex != -1)
engineId = iname.midRef(firstIndex + 1, secondIndex - firstIndex - 1).toInt(); engineId = iname.mid(firstIndex + 1, secondIndex - firstIndex - 1).toInt();
} }
// Still not found? Maybe we're loading the engine itself. // Still not found? Maybe we're loading the engine itself.
@@ -465,7 +465,7 @@ void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &objec
int lastIndex = iname.lastIndexOf('.'); int lastIndex = iname.lastIndexOf('.');
int secondLastIndex = iname.lastIndexOf('.', lastIndex - 1); int secondLastIndex = iname.lastIndexOf('.', lastIndex - 1);
if (secondLastIndex != WatchItem::InvalidId) if (secondLastIndex != WatchItem::InvalidId)
parentId = iname.midRef(secondLastIndex + 1, lastIndex - secondLastIndex - 1).toInt(); parentId = iname.mid(secondLastIndex + 1, lastIndex - secondLastIndex - 1).toInt();
else else
parentId = engineId; parentId = engineId;
} else { } else {

View File

@@ -325,7 +325,7 @@ ContextData getLocationContext(TextDocument *document, int lineNumber)
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
// Possibly one of the "27 [1] foo = x" lines // Possibly one of the "27 [1] foo = x" lines
int pos = line.indexOf('['); int pos = line.indexOf('[');
int ln = line.leftRef(pos - 1).toInt(); int ln = line.left(pos - 1).toInt();
if (ln > 0) { if (ln > 0) {
data.type = LocationByFile; data.type = LocationByFile;
data.fileName = Utils::FilePath::fromString(fileName); data.fileName = Utils::FilePath::fromString(fileName);

View File

@@ -2685,7 +2685,7 @@ void WatchHandler::addDumpers(const GdbMi &dumpers)
DisplayFormats formats; DisplayFormats formats;
formats.append(RawFormat); formats.append(RawFormat);
QString reportedFormats = dumper["formats"].data(); QString reportedFormats = dumper["formats"].data();
foreach (const QStringRef &format, reportedFormats.splitRef(',')) { foreach (const QString &format, reportedFormats.split(',')) {
if (int f = format.toInt()) if (int f = format.toInt())
formats.append(DisplayFormat(f)); formats.append(DisplayFormat(f));
} }