forked from qt-creator/qt-creator
Analyzer: Use Utils::OutputFormat everywhere
Replace hard distinction between 'out', 'err' with flexible OutputFormat. Also make sure that QmlProfiler shows application output. Change-Id: I130c71884321e4c59c9a75f0836c37a7f0e805c4 Reviewed-on: http://codereview.qt.nokia.com/458 Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
This commit is contained in:
@@ -128,14 +128,14 @@ void LocalValgrindProcess::readyReadStandardError()
|
|||||||
{
|
{
|
||||||
const QByteArray b = m_process.readAllStandardError();
|
const QByteArray b = m_process.readAllStandardError();
|
||||||
if (!b.isEmpty())
|
if (!b.isEmpty())
|
||||||
emit standardErrorReceived(b);
|
emit processOutput(b, Utils::StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalValgrindProcess::readyReadStandardOutput()
|
void LocalValgrindProcess::readyReadStandardOutput()
|
||||||
{
|
{
|
||||||
const QByteArray b = m_process.readAllStandardOutput();
|
const QByteArray b = m_process.readAllStandardOutput();
|
||||||
if (!b.isEmpty())
|
if (!b.isEmpty())
|
||||||
emit standardOutputReceived(b);
|
emit processOutput(b, Utils::StdOutFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
@@ -202,9 +202,9 @@ void RemoteValgrindProcess::connected()
|
|||||||
|
|
||||||
m_process = m_connection->createRemoteProcess(cmd.toUtf8());
|
m_process = m_connection->createRemoteProcess(cmd.toUtf8());
|
||||||
connect(m_process.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
connect(m_process.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||||
this, SIGNAL(standardErrorReceived(QByteArray)));
|
this, SLOT(standardError(QByteArray)));
|
||||||
connect(m_process.data(), SIGNAL(outputAvailable(QByteArray)),
|
connect(m_process.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||||
this, SIGNAL(standardOutputReceived(QByteArray)));
|
this, SLOT(standardOutput(QByteArray)));
|
||||||
connect(m_process.data(), SIGNAL(closed(int)),
|
connect(m_process.data(), SIGNAL(closed(int)),
|
||||||
this, SLOT(closed(int)));
|
this, SLOT(closed(int)));
|
||||||
connect(m_process.data(), SIGNAL(started()),
|
connect(m_process.data(), SIGNAL(started()),
|
||||||
@@ -242,7 +242,7 @@ void RemoteValgrindProcess::processStarted()
|
|||||||
|
|
||||||
m_findPID = m_connection->createRemoteProcess(cmd.toUtf8());
|
m_findPID = m_connection->createRemoteProcess(cmd.toUtf8());
|
||||||
connect(m_findPID.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
connect(m_findPID.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||||
this, SIGNAL(standardErrorReceived(QByteArray)));
|
this, SLOT(standardOutput(QByteArray)));
|
||||||
connect(m_findPID.data(), SIGNAL(outputAvailable(QByteArray)),
|
connect(m_findPID.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||||
this, SLOT(findPIDOutputReceived(QByteArray)));
|
this, SLOT(findPIDOutputReceived(QByteArray)));
|
||||||
m_findPID->start();
|
m_findPID->start();
|
||||||
@@ -263,6 +263,16 @@ void RemoteValgrindProcess::findPIDOutputReceived(const QByteArray &output)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemoteValgrindProcess::standardOutput(const QByteArray &output)
|
||||||
|
{
|
||||||
|
emit processOutput(output, Utils::StdOutFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RemoteValgrindProcess::standardError(const QByteArray &output)
|
||||||
|
{
|
||||||
|
emit processOutput(output, Utils::StdErrFormat);
|
||||||
|
}
|
||||||
|
|
||||||
void RemoteValgrindProcess::error(Utils::SshError error)
|
void RemoteValgrindProcess::error(Utils::SshError error)
|
||||||
{
|
{
|
||||||
switch (error) {
|
switch (error) {
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/ssh/sshremoteprocess.h>
|
#include <utils/ssh/sshremoteprocess.h>
|
||||||
#include <utils/ssh/sshconnection.h>
|
#include <utils/ssh/sshconnection.h>
|
||||||
|
#include <utils/outputformat.h>
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
|
|
||||||
@@ -73,8 +74,7 @@ signals:
|
|||||||
void started();
|
void started();
|
||||||
void finished(int, QProcess::ExitStatus);
|
void finished(int, QProcess::ExitStatus);
|
||||||
void error(QProcess::ProcessError);
|
void error(QProcess::ProcessError);
|
||||||
void standardOutputReceived(const QByteArray &);
|
void processOutput(const QByteArray &, Utils::OutputFormat format);
|
||||||
void standardErrorReceived(const QByteArray &);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,6 +149,8 @@ private slots:
|
|||||||
void error(Utils::SshError error);
|
void error(Utils::SshError error);
|
||||||
void processStarted();
|
void processStarted();
|
||||||
void findPIDOutputReceived(const QByteArray &output);
|
void findPIDOutputReceived(const QByteArray &output);
|
||||||
|
void standardOutput(const QByteArray &output);
|
||||||
|
void standardError(const QByteArray &output);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Utils::SshConnectionParameters m_params;
|
Utils::SshConnectionParameters m_params;
|
||||||
|
|||||||
@@ -97,10 +97,8 @@ void ValgrindRunner::Private::run(ValgrindProcess *_process)
|
|||||||
valgrindArgs << QLatin1String("--dsymutil=yes");
|
valgrindArgs << QLatin1String("--dsymutil=yes");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QObject::connect(process, SIGNAL(standardOutputReceived(QByteArray)),
|
QObject::connect(process, SIGNAL(processOutput(QByteArray,Utils::OutputFormat)),
|
||||||
q, SIGNAL(standardOutputReceived(QByteArray)));
|
q, SIGNAL(processOutputReceived(QByteArray,Utils::OutputFormat)));
|
||||||
QObject::connect(process, SIGNAL(standardErrorReceived(QByteArray)),
|
|
||||||
q, SIGNAL(standardErrorReceived(QByteArray)));
|
|
||||||
QObject::connect(process, SIGNAL(started()),
|
QObject::connect(process, SIGNAL(started()),
|
||||||
q, SLOT(processStarted()));
|
q, SLOT(processStarted()));
|
||||||
QObject::connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
|
QObject::connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#define VALGRIND_RUNNER_H
|
#define VALGRIND_RUNNER_H
|
||||||
|
|
||||||
#include <QtCore/QProcess>
|
#include <QtCore/QProcess>
|
||||||
|
#include <utils/outputformat.h>
|
||||||
|
|
||||||
#include "valgrind_global.h"
|
#include "valgrind_global.h"
|
||||||
|
|
||||||
@@ -85,8 +86,7 @@ protected:
|
|||||||
virtual QString tool() const = 0;
|
virtual QString tool() const = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void standardOutputReceived(const QByteArray &);
|
void processOutputReceived(const QByteArray &, Utils::OutputFormat);
|
||||||
void standardErrorReceived(const QByteArray &);
|
|
||||||
void processErrorReceived(const QString &, QProcess::ProcessError);
|
void processErrorReceived(const QString &, QProcess::ProcessError);
|
||||||
void started();
|
void started();
|
||||||
void finished();
|
void finished();
|
||||||
|
|||||||
@@ -76,10 +76,8 @@ AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
|
|||||||
IAnalyzerTool *tool = AnalyzerManager::instance()->currentTool();
|
IAnalyzerTool *tool = AnalyzerManager::instance()->currentTool();
|
||||||
d->m_engine = tool->createEngine(sp, runConfiguration);
|
d->m_engine = tool->createEngine(sp, runConfiguration);
|
||||||
|
|
||||||
connect(d->m_engine, SIGNAL(standardErrorReceived(QString)),
|
connect(d->m_engine, SIGNAL(outputReceived(QString,Utils::OutputFormat)),
|
||||||
SLOT(receiveStandardError(QString)));
|
SLOT(receiveOutput(QString,Utils::OutputFormat)));
|
||||||
connect(d->m_engine, SIGNAL(standardOutputReceived(QString)),
|
|
||||||
SLOT(receiveStandardOutput(QString)));
|
|
||||||
connect(d->m_engine, SIGNAL(taskToBeAdded(ProjectExplorer::Task::TaskType,QString,QString,int)),
|
connect(d->m_engine, SIGNAL(taskToBeAdded(ProjectExplorer::Task::TaskType,QString,QString,int)),
|
||||||
SLOT(addTask(ProjectExplorer::Task::TaskType,QString,QString,int)));
|
SLOT(addTask(ProjectExplorer::Task::TaskType,QString,QString,int)));
|
||||||
connect(d->m_engine, SIGNAL(finished()),
|
connect(d->m_engine, SIGNAL(finished()),
|
||||||
@@ -138,14 +136,9 @@ QIcon AnalyzerRunControl::icon() const
|
|||||||
return QIcon(QLatin1String(":/images/analyzer_start_small.png"));
|
return QIcon(QLatin1String(":/images/analyzer_start_small.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerRunControl::receiveStandardOutput(const QString &text)
|
void AnalyzerRunControl::receiveOutput(const QString &text, Utils::OutputFormat format)
|
||||||
{
|
{
|
||||||
appendMessage(text, Utils::StdOutFormat);
|
appendMessage(text, format);
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerRunControl::receiveStandardError(const QString &text)
|
|
||||||
{
|
|
||||||
appendMessage(text, Utils::StdErrFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerRunControl::addTask(ProjectExplorer::Task::TaskType type, const QString &description,
|
void AnalyzerRunControl::addTask(ProjectExplorer::Task::TaskType type, const QString &description,
|
||||||
|
|||||||
@@ -64,8 +64,7 @@ public:
|
|||||||
QIcon icon() const;
|
QIcon icon() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void receiveStandardOutput(const QString &);
|
void receiveOutput(const QString &, Utils::OutputFormat format);
|
||||||
void receiveStandardError(const QString &);
|
|
||||||
|
|
||||||
void addTask(ProjectExplorer::Task::TaskType type, const QString &description,
|
void addTask(ProjectExplorer::Task::TaskType type, const QString &description,
|
||||||
const QString &file, int line);
|
const QString &file, int line);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include <projectexplorer/task.h>
|
#include <projectexplorer/task.h>
|
||||||
#include <utils/ssh/sshconnection.h>
|
#include <utils/ssh/sshconnection.h>
|
||||||
|
#include <utils/outputformat.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
@@ -76,9 +77,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
/// should be emitted when the debuggee outputted something
|
/// should be emitted when the debuggee outputted something
|
||||||
void standardOutputReceived(const QString &);
|
void outputReceived(const QString &, Utils::OutputFormat format);
|
||||||
/// should be emitted when the debuggee outputted an error
|
|
||||||
void standardErrorReceived(const QString &);
|
|
||||||
/// can be emitted when you want to show a task, e.g. to display an error
|
/// can be emitted when you want to show a task, e.g. to display an error
|
||||||
void taskToBeAdded(ProjectExplorer::Task::TaskType type, const QString &description,
|
void taskToBeAdded(ProjectExplorer::Task::TaskType type, const QString &description,
|
||||||
const QString &file, int line);
|
const QString &file, int line);
|
||||||
|
|||||||
@@ -245,9 +245,9 @@ void QmlProfilerEngine::filterApplicationMessage(const QString &msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QmlProfilerEngine::logApplicationMessage(const QString &msg, Utils::OutputFormat /*format*/)
|
void QmlProfilerEngine::logApplicationMessage(const QString &msg, Utils::OutputFormat format)
|
||||||
{
|
{
|
||||||
qDebug() << "app: " << msg;
|
emit outputReceived(msg, format);
|
||||||
|
|
||||||
filterApplicationMessage(msg);
|
filterApplicationMessage(msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ Valgrind::ValgrindRunner * CallgrindEngine::runner()
|
|||||||
|
|
||||||
void CallgrindEngine::start()
|
void CallgrindEngine::start()
|
||||||
{
|
{
|
||||||
emit standardOutputReceived(tr("Profiling %1").arg(executable()));
|
emit outputReceived(tr("Profiling %1\n").arg(executable()), Utils::NormalMessageFormat);
|
||||||
ValgrindEngine::start();
|
ValgrindEngine::start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,8 @@ void MemcheckEngine::start()
|
|||||||
{
|
{
|
||||||
m_runner.setParser(&m_parser);
|
m_runner.setParser(&m_parser);
|
||||||
|
|
||||||
emit standardOutputReceived(tr("Analyzing memory of %1").arg(executable()));
|
emit outputReceived(tr("Analyzing memory of %1\n").arg(executable()),
|
||||||
|
Utils::NormalMessageFormat);
|
||||||
ValgrindEngine::start();
|
ValgrindEngine::start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ void ValgrindEngine::start()
|
|||||||
m_progressWatcher->setFuture(m_progress->future());
|
m_progressWatcher->setFuture(m_progress->future());
|
||||||
|
|
||||||
#if VALGRIND_DEBUG_OUTPUT
|
#if VALGRIND_DEBUG_OUTPUT
|
||||||
emit standardOutputReceived(tr("Valgrind options: %1").arg(toolArguments().join(" ")));
|
emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(" ")), Utils::DebugFormat);
|
||||||
emit standardOutputReceived(tr("Working directory: %1").arg(m_workingDirectory));
|
emit outputReceived(tr("Working directory: %1").arg(m_workingDirectory), Utils::DebugFormat);
|
||||||
emit standardOutputReceived(tr("Command-line arguments: %1").arg(m_commandLineArguments));
|
emit outputReceived(tr("Command-line arguments: %1").arg(m_commandLineArguments), Utils::DebugFormat);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const AnalyzerStartParameters &sp = startParameters();
|
const AnalyzerStartParameters &sp = startParameters();
|
||||||
@@ -104,10 +104,8 @@ void ValgrindEngine::start()
|
|||||||
runner()->setDebuggeeArguments(sp.debuggeeArgs);
|
runner()->setDebuggeeArguments(sp.debuggeeArgs);
|
||||||
runner()->setEnvironment(sp.environment);
|
runner()->setEnvironment(sp.environment);
|
||||||
|
|
||||||
connect(runner(), SIGNAL(standardOutputReceived(QByteArray)),
|
connect(runner(), SIGNAL(processOutputReceived(QByteArray,Utils::OutputFormat)),
|
||||||
SLOT(receiveStandardOutput(QByteArray)));
|
SLOT(receiveProcessOutput(QByteArray,Utils::OutputFormat)));
|
||||||
connect(runner(), SIGNAL(standardErrorReceived(QByteArray)),
|
|
||||||
SLOT(receiveStandardError(QByteArray)));
|
|
||||||
connect(runner(), SIGNAL(processErrorReceived(QString, QProcess::ProcessError)),
|
connect(runner(), SIGNAL(processErrorReceived(QString, QProcess::ProcessError)),
|
||||||
SLOT(receiveProcessError(QString, QProcess::ProcessError)));
|
SLOT(receiveProcessError(QString, QProcess::ProcessError)));
|
||||||
connect(runner(), SIGNAL(finished()),
|
connect(runner(), SIGNAL(finished()),
|
||||||
@@ -142,29 +140,20 @@ void ValgrindEngine::handleProgressFinished()
|
|||||||
|
|
||||||
void ValgrindEngine::runnerFinished()
|
void ValgrindEngine::runnerFinished()
|
||||||
{
|
{
|
||||||
emit standardOutputReceived(tr("** Analyzing finished **"));
|
emit outputReceived(tr("** Analyzing finished **\n"), Utils::NormalMessageFormat);
|
||||||
emit finished();
|
emit finished();
|
||||||
|
|
||||||
m_progress->reportFinished();
|
m_progress->reportFinished();
|
||||||
|
|
||||||
disconnect(runner(), SIGNAL(standardOutputReceived(QByteArray)),
|
disconnect(runner(), SIGNAL(processOutputReceived(QByteArray,Utils::OutputFormat)),
|
||||||
this, SLOT(receiveStandardOutput(QByteArray)));
|
this, SLOT(receiveProcessOutput(QByteArray,Utils::OutputFormat)));
|
||||||
disconnect(runner(), SIGNAL(standardErrorReceived(QByteArray)),
|
|
||||||
this, SLOT(receiveStandardError(QByteArray)));
|
|
||||||
disconnect(runner(), SIGNAL(processErrorReceived(QString, QProcess::ProcessError)),
|
|
||||||
this, SLOT(receiveProcessError(QString, QProcess::ProcessError)));
|
|
||||||
disconnect(runner(), SIGNAL(finished()),
|
disconnect(runner(), SIGNAL(finished()),
|
||||||
this, SLOT(runnerFinished()));
|
this, SLOT(runnerFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindEngine::receiveStandardOutput(const QByteArray &b)
|
void ValgrindEngine::receiveProcessOutput(const QByteArray &b, Utils::OutputFormat format)
|
||||||
{
|
{
|
||||||
emit standardOutputReceived(QString::fromLocal8Bit(b));
|
emit outputReceived(QString::fromLocal8Bit(b), format);
|
||||||
}
|
|
||||||
|
|
||||||
void ValgrindEngine::receiveStandardError(const QByteArray &b)
|
|
||||||
{
|
|
||||||
emit standardErrorReceived(QString::fromLocal8Bit(b));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindEngine::receiveProcessError(const QString &error, QProcess::ProcessError e)
|
void ValgrindEngine::receiveProcessError(const QString &error, QProcess::ProcessError e)
|
||||||
@@ -172,14 +161,14 @@ void ValgrindEngine::receiveProcessError(const QString &error, QProcess::Process
|
|||||||
if (e == QProcess::FailedToStart) {
|
if (e == QProcess::FailedToStart) {
|
||||||
const QString &valgrind = m_settings->subConfig<ValgrindSettings>()->valgrindExecutable();
|
const QString &valgrind = m_settings->subConfig<ValgrindSettings>()->valgrindExecutable();
|
||||||
if (!valgrind.isEmpty()) {
|
if (!valgrind.isEmpty()) {
|
||||||
emit standardErrorReceived(tr("** Error: \"%1\" could not be started: %2 **").arg(valgrind).arg(error));
|
emit outputReceived(tr("** Error: \"%1\" could not be started: %2 **\n").arg(valgrind).arg(error), Utils::ErrorMessageFormat);
|
||||||
} else {
|
} else {
|
||||||
emit standardErrorReceived(tr("** Error: no valgrind executable set **"));
|
emit outputReceived(tr("** Error: no valgrind executable set **\n"), Utils::ErrorMessageFormat);
|
||||||
}
|
}
|
||||||
} else if (m_isStopping && e == QProcess::Crashed) { // process gets killed on stop
|
} else if (m_isStopping && e == QProcess::Crashed) { // process gets killed on stop
|
||||||
emit standardErrorReceived(tr("** Process Terminated **"));
|
emit outputReceived(tr("** Process Terminated **\n"), Utils::ErrorMessageFormat);
|
||||||
} else {
|
} else {
|
||||||
emit standardErrorReceived(QString("** %1 **").arg(error));
|
emit outputReceived(QString("** %1 **\n").arg(error), Utils::ErrorMessageFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_isStopping)
|
if (m_isStopping)
|
||||||
|
|||||||
@@ -83,8 +83,7 @@ private slots:
|
|||||||
void handleProgressFinished();
|
void handleProgressFinished();
|
||||||
void runnerFinished();
|
void runnerFinished();
|
||||||
|
|
||||||
void receiveStandardOutput(const QByteArray &);
|
void receiveProcessOutput(const QByteArray &, Utils::OutputFormat);
|
||||||
void receiveStandardError(const QByteArray &);
|
|
||||||
void receiveProcessError(const QString &, QProcess::ProcessError);
|
void receiveProcessError(const QString &, QProcess::ProcessError);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user