diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index c19ca7abba7..eaed72b3d23 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -415,7 +415,10 @@ static ExecutableItem logcatRecipe(const Storage &storage) const QString pidString = QString::number(storagePtr->m_processPID); for (const QByteArray &msg : std::as_const(lines)) { const QString line = QString::fromUtf8(msg).trimmed() + QLatin1Char('\n'); - if (!line.contains(pidString)) + // Get type excluding the initial color characters + const QString msgType = line.mid(5, 2); + const bool isFatal = msgType == "F/"; + if (!line.contains(pidString) && !isFatal) continue; if (storagePtr->m_useCppDebugger) { @@ -427,32 +430,31 @@ static ExecutableItem logcatRecipe(const Storage &storage) static const QRegularExpression regExpLogcat{ "^\\x1B\\[[0-9]+m" // color - "(\\w/)" // message type 1. capture + "\\w/" // message type ".*" // source - "(\\(\\s*\\d*\\)):" // pid 2. capture + "(\\(\\s*\\d*\\)):" // pid 1. capture "\\s*" ".*" // message "\\x1B\\[[0-9]+m" // color "[\\n\\r]*$" }; - static QStringList errorMsgTypes{"F/", "E/", "W/"}; + static QStringList errorMsgTypes{"W/", "E/", "F/"}; const bool onlyError = channel == QProcess::StandardError; const QRegularExpressionMatch match = regExpLogcat.match(line); if (match.hasMatch()) { - const QString pidMatch = match.captured(2); + const QString pidMatch = match.captured(1); const QString cleanPidMatch = pidMatch.mid(1, pidMatch.size() - 2).trimmed(); - if (cleanPidMatch == pidString) { - const QString msgType = match.captured(1); - const QString output = QString(line).remove(pidMatch); + const QString output = QString(line).remove(pidMatch); + if (isFatal) { + storagePtr->m_glue->addStdErr(output); + } else if (cleanPidMatch == pidString) { if (onlyError || errorMsgTypes.contains(msgType)) storagePtr->m_glue->addStdErr(output); else storagePtr->m_glue->addStdOut(output); } } else { - // Get type excluding the initial color characters - const QString msgType = line.mid(5, 7); if (onlyError || errorMsgTypes.contains(msgType)) storagePtr->m_glue->addStdErr(line); else