diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index 5de202b946a..94093fe1507 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -1272,11 +1272,15 @@ SimpleTargetRunnerPrivate::SimpleTargetRunnerPrivate(SimpleTargetRunner *parent) + QLatin1Char('\n'), ErrorMessageFormat); }); - connect(WinDebugInterface::instance(), &WinDebugInterface::debugOutput, - this, [this](qint64 pid, const QString &message) { - if (privateApplicationPID() == pid) - q->appendMessage(message, DebugFormat); - }); + connect(WinDebugInterface::instance(), + &WinDebugInterface::debugOutput, + this, + [this](qint64 pid, const QList &messages) { + if (privateApplicationPID() != pid) + return; + for (const QString &message : messages) + q->appendMessage(message, DebugFormat); + }); } } diff --git a/src/plugins/projectexplorer/windebuginterface.cpp b/src/plugins/projectexplorer/windebuginterface.cpp index 25f525e9efc..75285669a40 100644 --- a/src/plugins/projectexplorer/windebuginterface.cpp +++ b/src/plugins/projectexplorer/windebuginterface.cpp @@ -150,22 +150,23 @@ void WinDebugInterface::dispatchDebugOutput() QTC_ASSERT(Utils::isMainThread(), return); static size_t maxMessagesToSend = 100; - std::vector> output; + std::map> output; bool hasMoreOutput = false; m_outputMutex.lock(); for (auto &entry : m_debugOutput) { - std::vector &src = entry.second; - if (src.empty()) - continue; - QString dst; - size_t n = std::min(maxMessagesToSend, src.size()); - for (size_t i = 0; i < n; ++i) - dst += src.at(i); - src.erase(src.begin(), std::next(src.begin(), n)); - if (!src.empty()) + auto it = entry.second.begin(); + for (; it != entry.second.end(); ++it) { + output[entry.first].push_back(*it); + if (output.size() >= maxMessagesToSend) + break; + } + if (it != entry.second.begin()) + it = entry.second.erase(entry.second.begin(), it); + if (it != entry.second.end()) { hasMoreOutput = true; - output.emplace_back(entry.first, std::move(dst)); + break; + } } if (!hasMoreOutput) m_readySignalEmitted = false; diff --git a/src/plugins/projectexplorer/windebuginterface.h b/src/plugins/projectexplorer/windebuginterface.h index a9d78fc1115..e759e2252c5 100644 --- a/src/plugins/projectexplorer/windebuginterface.h +++ b/src/plugins/projectexplorer/windebuginterface.h @@ -27,7 +27,7 @@ public: static void startIfNeeded(); signals: - void debugOutput(qint64 pid, const QString &message); + void debugOutput(qint64 pid, const QList &messages); void cannotRetrieveDebugOutput(); void _q_debugOutputReady();