Valgrind: Consolidate message production and consumption

Change-Id: I779f97a658b55f3c79111df1946b8d72863ce513
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2022-06-16 13:53:26 +02:00
parent 178d555151
commit ff6f3dc65d
4 changed files with 9 additions and 14 deletions

View File

@@ -61,8 +61,8 @@ ValgrindToolRunner::ValgrindToolRunner(RunControl *runControl)
m_settings.fromMap(runControl->settingsData(ANALYZER_VALGRIND_SETTINGS)); m_settings.fromMap(runControl->settingsData(ANALYZER_VALGRIND_SETTINGS));
connect(&m_runner, &ValgrindRunner::processOutputReceived, connect(&m_runner, &ValgrindRunner::appendMessage,
this, &ValgrindToolRunner::receiveProcessOutput); this, &ValgrindToolRunner::appendMessage);
connect(&m_runner, &ValgrindRunner::valgrindExecuted, connect(&m_runner, &ValgrindRunner::valgrindExecuted,
this, [this](const QString &commandLine) { this, [this](const QString &commandLine) {
appendMessage(commandLine, NormalMessageFormat); appendMessage(commandLine, NormalMessageFormat);
@@ -162,11 +162,6 @@ void ValgrindToolRunner::runnerFinished()
reportStopped(); reportStopped();
} }
void ValgrindToolRunner::receiveProcessOutput(const QString &output, OutputFormat format)
{
appendMessage(output, format);
}
void ValgrindToolRunner::receiveProcessError(const QString &message, QProcess::ProcessError error) void ValgrindToolRunner::receiveProcessError(const QString &message, QProcess::ProcessError error)
{ {
if (error == QProcess::FailedToStart) { if (error == QProcess::FailedToStart) {

View File

@@ -60,7 +60,6 @@ private:
void handleProgressFinished(); void handleProgressFinished();
void runnerFinished(); void runnerFinished();
void receiveProcessOutput(const QString &output, Utils::OutputFormat format);
void receiveProcessError(const QString &message, QProcess::ProcessError error); void receiveProcessError(const QString &message, QProcess::ProcessError error);
QStringList genericToolArguments() const; QStringList genericToolArguments() const;

View File

@@ -120,12 +120,12 @@ bool ValgrindRunner::Private::run()
this, &ValgrindRunner::Private::processDone); this, &ValgrindRunner::Private::processDone);
connect(&m_valgrindProcess, &QtcProcess::readyReadStandardOutput, q, [this] { connect(&m_valgrindProcess, &QtcProcess::readyReadStandardOutput, q, [this] {
q->processOutputReceived(QString::fromUtf8(m_valgrindProcess.readAllStandardOutput()), emit q->appendMessage(QString::fromUtf8(m_valgrindProcess.readAllStandardOutput()),
Utils::StdOutFormat); StdOutFormat);
}); });
connect(&m_valgrindProcess, &QtcProcess::readyReadStandardError, q, [this] { connect(&m_valgrindProcess, &QtcProcess::readyReadStandardError, q, [this] {
q->processOutputReceived(QString::fromUtf8(m_valgrindProcess.readAllStandardError()), emit q->appendMessage(QString::fromUtf8(m_valgrindProcess.readAllStandardError()),
Utils::StdErrFormat); StdErrFormat);
}); });
if (cmd.executable().osType() == OsTypeMac) { if (cmd.executable().osType() == OsTypeMac) {
@@ -210,7 +210,7 @@ void ValgrindRunner::Private::remoteProcessStarted()
void ValgrindRunner::Private::findPidProcessDone() void ValgrindRunner::Private::findPidProcessDone()
{ {
if (m_findPID.result() != ProcessResult::FinishedWithSuccess) { if (m_findPID.result() != ProcessResult::FinishedWithSuccess) {
emit q->processOutputReceived(m_findPID.allOutput(), StdErrFormat); emit q->appendMessage(m_findPID.allOutput(), StdErrFormat);
return; return;
} }
QString out = m_findPID.cleanedStdOut(); QString out = m_findPID.cleanedStdOut();

View File

@@ -64,8 +64,9 @@ public:
XmlProtocol::ThreadedParser *parser() const; XmlProtocol::ThreadedParser *parser() const;
signals: signals:
void appendMessage(const QString &, Utils::OutputFormat);
void logMessageReceived(const QByteArray &); void logMessageReceived(const QByteArray &);
void processOutputReceived(const QString &, Utils::OutputFormat);
void processErrorReceived(const QString &, QProcess::ProcessError); void processErrorReceived(const QString &, QProcess::ProcessError);
void valgrindExecuted(const QString &); void valgrindExecuted(const QString &);
void valgrindStarted(qint64 pid); void valgrindStarted(qint64 pid);