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));
connect(&m_runner, &ValgrindRunner::processOutputReceived,
this, &ValgrindToolRunner::receiveProcessOutput);
connect(&m_runner, &ValgrindRunner::appendMessage,
this, &ValgrindToolRunner::appendMessage);
connect(&m_runner, &ValgrindRunner::valgrindExecuted,
this, [this](const QString &commandLine) {
appendMessage(commandLine, NormalMessageFormat);
@@ -162,11 +162,6 @@ void ValgrindToolRunner::runnerFinished()
reportStopped();
}
void ValgrindToolRunner::receiveProcessOutput(const QString &output, OutputFormat format)
{
appendMessage(output, format);
}
void ValgrindToolRunner::receiveProcessError(const QString &message, QProcess::ProcessError error)
{
if (error == QProcess::FailedToStart) {

View File

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

View File

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

View File

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