forked from qt-creator/qt-creator
Analyzer: Merge IAnalyzerEngine and AnalyzerRunControl
Change-Id: I74edaef59600a44924d2692c1ebc7f98d8581115 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
This commit is contained in:
@@ -7,7 +7,6 @@ QT += network
|
|||||||
# AnalyzerBase files
|
# AnalyzerBase files
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
ianalyzerengine.cpp \
|
|
||||||
ianalyzertool.cpp \
|
ianalyzertool.cpp \
|
||||||
analyzerplugin.cpp \
|
analyzerplugin.cpp \
|
||||||
analyzerruncontrol.cpp \
|
analyzerruncontrol.cpp \
|
||||||
@@ -19,7 +18,6 @@ SOURCES += \
|
|||||||
startremotedialog.cpp
|
startremotedialog.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
ianalyzerengine.h \
|
|
||||||
ianalyzertool.h \
|
ianalyzertool.h \
|
||||||
analyzerbase_global.h \
|
analyzerbase_global.h \
|
||||||
analyzerconstants.h \
|
analyzerconstants.h \
|
||||||
|
@@ -31,8 +31,6 @@ QtcPlugin {
|
|||||||
"analyzerstartparameters.h",
|
"analyzerstartparameters.h",
|
||||||
"analyzerutils.cpp",
|
"analyzerutils.cpp",
|
||||||
"analyzerutils.h",
|
"analyzerutils.h",
|
||||||
"ianalyzerengine.cpp",
|
|
||||||
"ianalyzerengine.h",
|
|
||||||
"ianalyzertool.cpp",
|
"ianalyzertool.cpp",
|
||||||
"ianalyzertool.h",
|
"ianalyzertool.h",
|
||||||
"startremotedialog.cpp",
|
"startremotedialog.cpp",
|
||||||
|
@@ -29,14 +29,10 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "analyzerruncontrol.h"
|
#include "analyzerruncontrol.h"
|
||||||
#include "ianalyzerengine.h"
|
|
||||||
#include "ianalyzertool.h"
|
#include "ianalyzertool.h"
|
||||||
#include "analyzermanager.h"
|
#include "analyzermanager.h"
|
||||||
#include "analyzerstartparameters.h"
|
#include "analyzerstartparameters.h"
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
|
||||||
#include <projectexplorer/taskhub.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
@@ -44,117 +40,64 @@ using namespace ProjectExplorer;
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// AnalyzerRunControl::Private
|
// AnalyzerRunControl
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
class AnalyzerRunControl::Private
|
AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
|
||||||
|
ProjectExplorer::RunConfiguration *runConfiguration)
|
||||||
|
: RunControl(runConfiguration, sp.runMode)
|
||||||
{
|
{
|
||||||
public:
|
m_runConfig = runConfiguration;
|
||||||
Private();
|
m_sp = sp;
|
||||||
|
|
||||||
bool m_isRunning;
|
|
||||||
IAnalyzerEngine *m_engine;
|
|
||||||
};
|
|
||||||
|
|
||||||
AnalyzerRunControl::Private::Private()
|
|
||||||
: m_isRunning(false), m_engine(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// AnalyzerRunControl
|
|
||||||
//
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
AnalyzerRunControl::AnalyzerRunControl(IAnalyzerTool *tool,
|
|
||||||
const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
|
|
||||||
: RunControl(runConfiguration, tool->runMode()),
|
|
||||||
d(new Private)
|
|
||||||
{
|
|
||||||
d->m_engine = tool->createEngine(sp, runConfiguration);
|
|
||||||
|
|
||||||
if (!d->m_engine)
|
|
||||||
return;
|
|
||||||
|
|
||||||
connect(d->m_engine, SIGNAL(outputReceived(QString,Utils::OutputFormat)),
|
|
||||||
SLOT(receiveOutput(QString,Utils::OutputFormat)));
|
|
||||||
connect(d->m_engine, SIGNAL(taskToBeAdded(ProjectExplorer::Task::TaskType,QString,QString,int)),
|
|
||||||
SLOT(addTask(ProjectExplorer::Task::TaskType,QString,QString,int)));
|
|
||||||
connect(d->m_engine, SIGNAL(finished()),
|
|
||||||
SLOT(engineFinished()));
|
|
||||||
|
|
||||||
|
connect(this, SIGNAL(finished()), SLOT(runControlFinished()));
|
||||||
connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), SLOT(stopIt()));
|
connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), SLOT(stopIt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerRunControl::~AnalyzerRunControl()
|
|
||||||
{
|
|
||||||
if (d->m_isRunning)
|
|
||||||
stop();
|
|
||||||
|
|
||||||
delete d->m_engine;
|
|
||||||
d->m_engine = 0;
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerRunControl::start()
|
|
||||||
{
|
|
||||||
if (!d->m_engine) {
|
|
||||||
emit finished();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AnalyzerManager::handleToolStarted();
|
|
||||||
|
|
||||||
// Clear about-to-be-outdated tasks.
|
|
||||||
ProjectExplorerPlugin::instance()->taskHub()
|
|
||||||
->clearTasks(Core::Id(Constants::ANALYZERTASK_ID));
|
|
||||||
|
|
||||||
if (d->m_engine->start()) {
|
|
||||||
d->m_isRunning = true;
|
|
||||||
emit started();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RunControl::StopResult AnalyzerRunControl::stop()
|
|
||||||
{
|
|
||||||
if (!d->m_engine || !d->m_isRunning)
|
|
||||||
return StoppedSynchronously;
|
|
||||||
|
|
||||||
d->m_engine->stop();
|
|
||||||
d->m_isRunning = false;
|
|
||||||
return AsynchronousStop;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerRunControl::stopIt()
|
void AnalyzerRunControl::stopIt()
|
||||||
{
|
{
|
||||||
if (stop() == RunControl::StoppedSynchronously)
|
if (stop() == RunControl::StoppedSynchronously)
|
||||||
AnalyzerManager::handleToolFinished();
|
AnalyzerManager::handleToolFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerRunControl::engineFinished()
|
void AnalyzerRunControl::runControlFinished()
|
||||||
{
|
{
|
||||||
d->m_isRunning = false;
|
m_isRunning = false;
|
||||||
AnalyzerManager::handleToolFinished();
|
AnalyzerManager::handleToolFinished();
|
||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AnalyzerRunControl::start()
|
||||||
|
{
|
||||||
|
AnalyzerManager::handleToolStarted();
|
||||||
|
|
||||||
|
if (startEngine()) {
|
||||||
|
m_isRunning = true;
|
||||||
|
emit started();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RunControl::StopResult AnalyzerRunControl::stop()
|
||||||
|
{
|
||||||
|
if (!m_isRunning)
|
||||||
|
return StoppedSynchronously;
|
||||||
|
|
||||||
|
stopEngine();
|
||||||
|
m_isRunning = false;
|
||||||
|
return AsynchronousStop;
|
||||||
|
}
|
||||||
|
|
||||||
bool AnalyzerRunControl::isRunning() const
|
bool AnalyzerRunControl::isRunning() const
|
||||||
{
|
{
|
||||||
return d->m_isRunning;
|
return m_isRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AnalyzerRunControl::displayName() const
|
QString AnalyzerRunControl::displayName() const
|
||||||
{
|
{
|
||||||
if (!d->m_engine)
|
return m_runConfig ? m_runConfig->displayName() : m_sp.displayName;
|
||||||
return QString();
|
|
||||||
if (d->m_engine->runConfiguration())
|
|
||||||
return d->m_engine->runConfiguration()->displayName();
|
|
||||||
else
|
|
||||||
return d->m_engine->startParameters().displayName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon AnalyzerRunControl::icon() const
|
QIcon AnalyzerRunControl::icon() const
|
||||||
@@ -162,23 +105,4 @@ QIcon AnalyzerRunControl::icon() const
|
|||||||
return QIcon(QLatin1String(":/images/analyzer_start_small.png"));
|
return QIcon(QLatin1String(":/images/analyzer_start_small.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
IAnalyzerEngine *AnalyzerRunControl::engine() const
|
|
||||||
{
|
|
||||||
return d->m_engine;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerRunControl::receiveOutput(const QString &text, Utils::OutputFormat format)
|
|
||||||
{
|
|
||||||
appendMessage(text, format);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnalyzerRunControl::addTask(Task::TaskType type, const QString &description,
|
|
||||||
const QString &file, int line)
|
|
||||||
{
|
|
||||||
TaskHub *hub = ProjectExplorerPlugin::instance()->taskHub();
|
|
||||||
hub->addTask(Task(type, description, Utils::FileName::fromUserInput(file), line,
|
|
||||||
Core::Id(Constants::ANALYZERTASK_ID)));
|
|
||||||
hub->requestPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
@@ -36,20 +36,55 @@
|
|||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <projectexplorer/task.h>
|
#include <projectexplorer/task.h>
|
||||||
|
|
||||||
|
#include "analyzerbase_global.h"
|
||||||
|
#include "analyzerstartparameters.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/task.h>
|
||||||
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
#include <utils/outputformat.h>
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace ProjectExplorer { class RunConfiguration; }
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
class AnalyzerStartParameters;
|
/**
|
||||||
class IAnalyzerTool;
|
* An AnalyzerRunControl instance handles the launch of an analyzation tool.
|
||||||
class IAnalyzerEngine;
|
*
|
||||||
|
* It gets created for each launch and deleted when the launch is stopped or ended.
|
||||||
|
*/
|
||||||
class ANALYZER_EXPORT AnalyzerRunControl : public ProjectExplorer::RunControl
|
class ANALYZER_EXPORT AnalyzerRunControl : public ProjectExplorer::RunControl
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AnalyzerRunControl(IAnalyzerTool *tool, const AnalyzerStartParameters &sp,
|
AnalyzerRunControl(const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration);
|
||||||
~AnalyzerRunControl();
|
|
||||||
|
/// Start analyzation process.
|
||||||
|
virtual bool startEngine() = 0;
|
||||||
|
/// Trigger async stop of the analyzation process.
|
||||||
|
virtual void stopEngine() = 0;
|
||||||
|
|
||||||
|
/// Controller actions.
|
||||||
|
virtual bool canPause() const { return false; }
|
||||||
|
virtual void pause() {}
|
||||||
|
virtual void unpause() {}
|
||||||
|
|
||||||
|
/// The active run configuration for this engine, might be zero.
|
||||||
|
ProjectExplorer::RunConfiguration *runConfiguration() const { return m_runConfig; }
|
||||||
|
|
||||||
|
/// The start parameters for this engine.
|
||||||
|
const AnalyzerStartParameters &startParameters() const { return m_sp; }
|
||||||
|
|
||||||
|
StartMode mode() const { return m_sp.startMode; }
|
||||||
|
|
||||||
|
virtual void notifyRemoteSetupDone(quint16) {}
|
||||||
|
virtual void notifyRemoteFinished(bool) {}
|
||||||
|
|
||||||
|
bool m_isRunning;
|
||||||
|
|
||||||
// ProjectExplorer::RunControl
|
// ProjectExplorer::RunControl
|
||||||
void start();
|
void start();
|
||||||
@@ -58,22 +93,21 @@ public:
|
|||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
QIcon icon() const;
|
QIcon icon() const;
|
||||||
|
|
||||||
IAnalyzerEngine *engine() const;
|
public slots:
|
||||||
|
virtual void logApplicationMessage(const QString &, Utils::OutputFormat) {}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void stopIt();
|
void stopIt();
|
||||||
void receiveOutput(const QString &, Utils::OutputFormat format);
|
void runControlFinished();
|
||||||
|
|
||||||
void addTask(ProjectExplorer::Task::TaskType type, const QString &description,
|
signals:
|
||||||
const QString &file, int line);
|
/// Must be emitted when the engine is starting.
|
||||||
|
void starting(const Analyzer::AnalyzerRunControl *);
|
||||||
void engineFinished();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Private;
|
ProjectExplorer::RunConfiguration *m_runConfig;
|
||||||
Private *d;
|
AnalyzerStartParameters m_sp;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
|
||||||
#endif // ANALYZERRUNCONTROL_H
|
#endif // ANALYZERRUNCONTROL_H
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
#include <ssh/sshconnection.h>
|
#include <ssh/sshconnection.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
@@ -51,6 +52,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
StartMode startMode;
|
StartMode startMode;
|
||||||
|
ProjectExplorer::RunMode runMode;
|
||||||
QSsh::SshConnectionParameters connParams;
|
QSsh::SshConnectionParameters connParams;
|
||||||
|
|
||||||
Core::Id toolId;
|
Core::Id toolId;
|
||||||
|
@@ -1,42 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "ianalyzerengine.h"
|
|
||||||
|
|
||||||
namespace Analyzer {
|
|
||||||
|
|
||||||
IAnalyzerEngine::IAnalyzerEngine(const AnalyzerStartParameters &sp,
|
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration)
|
|
||||||
{
|
|
||||||
m_runConfig = runConfiguration;
|
|
||||||
m_sp = sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Analyzer
|
|
@@ -1,105 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
|
||||||
** Contact: http://www.qt-project.org/legal
|
|
||||||
** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef IANALYZERENGINE_H
|
|
||||||
#define IANALYZERENGINE_H
|
|
||||||
|
|
||||||
#include "analyzerbase_global.h"
|
|
||||||
#include "analyzerstartparameters.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/task.h>
|
|
||||||
#include <utils/outputformat.h>
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
class RunConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Analyzer {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An IAnalyzerEngine instance handles the launch of an analyzation tool.
|
|
||||||
*
|
|
||||||
* It gets created for each launch and deleted when the launch is stopped or ended.
|
|
||||||
*/
|
|
||||||
class ANALYZER_EXPORT IAnalyzerEngine : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
IAnalyzerEngine(const AnalyzerStartParameters &sp,
|
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
|
||||||
|
|
||||||
/// Start analyzation process.
|
|
||||||
virtual bool start() = 0;
|
|
||||||
/// Trigger async stop of the analyzation process.
|
|
||||||
virtual void stop() = 0;
|
|
||||||
|
|
||||||
/// Controller actions.
|
|
||||||
virtual bool canPause() const { return false; }
|
|
||||||
virtual void pause() {}
|
|
||||||
virtual void unpause() {}
|
|
||||||
|
|
||||||
/// The active run configuration for this engine, might be zero.
|
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration() const { return m_runConfig; }
|
|
||||||
|
|
||||||
/// The start parameters for this engine.
|
|
||||||
const AnalyzerStartParameters &startParameters() const { return m_sp; }
|
|
||||||
|
|
||||||
StartMode mode() const { return m_sp.startMode; }
|
|
||||||
|
|
||||||
virtual void notifyRemoteSetupDone(quint16) {}
|
|
||||||
virtual void notifyRemoteFinished(bool) {}
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
virtual void logApplicationMessage(const QString &, Utils::OutputFormat) {}
|
|
||||||
|
|
||||||
signals:
|
|
||||||
/// Should be emitted when the debuggee outputted something.
|
|
||||||
void outputReceived(const QString &, Utils::OutputFormat format);
|
|
||||||
/// 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,
|
|
||||||
const QString &file, int line);
|
|
||||||
|
|
||||||
/// Must be emitted when the engine finished.
|
|
||||||
void finished();
|
|
||||||
/// Must be emitted when the engine is starting.
|
|
||||||
void starting(const Analyzer::IAnalyzerEngine *);
|
|
||||||
|
|
||||||
private:
|
|
||||||
ProjectExplorer::RunConfiguration *m_runConfig;
|
|
||||||
AnalyzerStartParameters m_sp;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Analyzer
|
|
||||||
|
|
||||||
#endif // IANALYZERENGINE_H
|
|
@@ -45,7 +45,7 @@ class RunConfiguration;
|
|||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
class IAnalyzerOutputPaneAdapter;
|
class IAnalyzerOutputPaneAdapter;
|
||||||
class IAnalyzerEngine;
|
class AnalyzerRunControl;
|
||||||
class AbstractAnalyzerSubConfig;
|
class AbstractAnalyzerSubConfig;
|
||||||
|
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
|
|
||||||
/// Returns a new engine for the given start parameters.
|
/// Returns a new engine for the given start parameters.
|
||||||
/// Called each time the tool is launched.
|
/// Called each time the tool is launched.
|
||||||
virtual IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp,
|
virtual AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0;
|
ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0;
|
||||||
|
|
||||||
/// Returns true if the tool can be run
|
/// Returns true if the tool can be run
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
#include "androidmanager.h"
|
#include "androidmanager.h"
|
||||||
|
|
||||||
#include <analyzerbase/ianalyzertool.h>
|
#include <analyzerbase/ianalyzertool.h>
|
||||||
#include <analyzerbase/ianalyzerengine.h>
|
|
||||||
#include <analyzerbase/analyzermanager.h>
|
#include <analyzerbase/analyzermanager.h>
|
||||||
#include <analyzerbase/analyzerruncontrol.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
#include <analyzerbase/analyzerstartparameters.h>
|
#include <analyzerbase/analyzerstartparameters.h>
|
||||||
@@ -63,6 +62,7 @@ RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfigurati
|
|||||||
|
|
||||||
AnalyzerStartParameters params;
|
AnalyzerStartParameters params;
|
||||||
params.toolId = tool->id();
|
params.toolId = tool->id();
|
||||||
|
params.runMode = runMode;
|
||||||
Target *target = runConfig->target();
|
Target *target = runConfig->target();
|
||||||
params.displayName = AndroidManager::packageName(target);
|
params.displayName = AndroidManager::packageName(target);
|
||||||
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
|
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
|
||||||
@@ -76,23 +76,21 @@ RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfigurati
|
|||||||
params.startMode = StartQmlRemote;
|
params.startMode = StartQmlRemote;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerRunControl * const analyzerRunControl = new AnalyzerRunControl(tool, params, runConfig);
|
AnalyzerRunControl *analyzerRunControl = tool->createRunControl(params, runConfig);
|
||||||
new AndroidAnalyzeSupport(runConfig, analyzerRunControl);
|
(void) new AndroidAnalyzeSupport(runConfig, analyzerRunControl);
|
||||||
return analyzerRunControl;
|
return analyzerRunControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidAnalyzeSupport::AndroidAnalyzeSupport(AndroidRunConfiguration *runConfig,
|
AndroidAnalyzeSupport::AndroidAnalyzeSupport(AndroidRunConfiguration *runConfig,
|
||||||
AnalyzerRunControl *runControl)
|
AnalyzerRunControl *runControl)
|
||||||
: AndroidRunSupport(runConfig, runControl),
|
: AndroidRunSupport(runConfig, runControl),
|
||||||
m_engine(0),
|
m_runControl(0),
|
||||||
m_qmlPort(0)
|
m_qmlPort(0)
|
||||||
{
|
{
|
||||||
if (runControl) {
|
if (runControl) {
|
||||||
m_engine = runControl->engine();
|
m_runControl = runControl;
|
||||||
if (m_engine) {
|
connect(m_runControl, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)),
|
||||||
connect(m_engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
|
m_runner, SLOT(start()));
|
||||||
m_runner, SLOT(start()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
connect(&m_outputParser, SIGNAL(waitingForConnectionOnPort(quint16)),
|
connect(&m_outputParser, SIGNAL(waitingForConnectionOnPort(quint16)),
|
||||||
SLOT(remoteIsRunning()));
|
SLOT(remoteIsRunning()));
|
||||||
@@ -115,8 +113,8 @@ void AndroidAnalyzeSupport::handleRemoteProcessStarted(int qmlPort)
|
|||||||
void AndroidAnalyzeSupport::handleRemoteOutput(const QByteArray &output)
|
void AndroidAnalyzeSupport::handleRemoteOutput(const QByteArray &output)
|
||||||
{
|
{
|
||||||
const QString msg = QString::fromUtf8(output);
|
const QString msg = QString::fromUtf8(output);
|
||||||
if (m_engine)
|
if (m_runControl)
|
||||||
m_engine->logApplicationMessage(msg, Utils::StdOutFormatSameLine);
|
m_runControl->logApplicationMessage(msg, Utils::StdOutFormatSameLine);
|
||||||
else
|
else
|
||||||
AndroidRunSupport::handleRemoteOutput(output);
|
AndroidRunSupport::handleRemoteOutput(output);
|
||||||
m_outputParser.processOutput(msg);
|
m_outputParser.processOutput(msg);
|
||||||
@@ -124,16 +122,16 @@ void AndroidAnalyzeSupport::handleRemoteOutput(const QByteArray &output)
|
|||||||
|
|
||||||
void AndroidAnalyzeSupport::handleRemoteErrorOutput(const QByteArray &output)
|
void AndroidAnalyzeSupport::handleRemoteErrorOutput(const QByteArray &output)
|
||||||
{
|
{
|
||||||
if (m_engine)
|
if (m_runControl)
|
||||||
m_engine->logApplicationMessage(QString::fromUtf8(output), Utils::StdErrFormatSameLine);
|
m_runControl->logApplicationMessage(QString::fromUtf8(output), Utils::StdErrFormatSameLine);
|
||||||
else
|
else
|
||||||
AndroidRunSupport::handleRemoteErrorOutput(output);
|
AndroidRunSupport::handleRemoteErrorOutput(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidAnalyzeSupport::remoteIsRunning()
|
void AndroidAnalyzeSupport::remoteIsRunning()
|
||||||
{
|
{
|
||||||
if (m_engine)
|
if (m_runControl)
|
||||||
m_engine->notifyRemoteSetupDone(m_qmlPort);
|
m_runControl->notifyRemoteSetupDone(m_qmlPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -33,10 +33,7 @@
|
|||||||
#include "androidrunsupport.h"
|
#include "androidrunsupport.h"
|
||||||
#include <qmldebug/qmloutputparser.h>
|
#include <qmldebug/qmloutputparser.h>
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer { class AnalyzerRunControl; }
|
||||||
class IAnalyzerEngine;
|
|
||||||
class AnalyzerRunControl;
|
|
||||||
}
|
|
||||||
namespace ProjectExplorer { class RunControl; }
|
namespace ProjectExplorer { class RunControl; }
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
@@ -66,7 +63,7 @@ private slots:
|
|||||||
void remoteIsRunning();
|
void remoteIsRunning();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Analyzer::IAnalyzerEngine *m_engine;
|
Analyzer::AnalyzerRunControl *m_runControl;
|
||||||
QmlDebug::QmlOutputParser m_outputParser;
|
QmlDebug::QmlOutputParser m_outputParser;
|
||||||
int m_qmlPort;
|
int m_qmlPort;
|
||||||
};
|
};
|
||||||
|
@@ -45,7 +45,7 @@ LocalQmlProfilerRunner *LocalQmlProfilerRunner::createLocalRunner(
|
|||||||
RunConfiguration *runConfiguration,
|
RunConfiguration *runConfiguration,
|
||||||
const Analyzer::AnalyzerStartParameters &sp,
|
const Analyzer::AnalyzerStartParameters &sp,
|
||||||
QString *errorMessage,
|
QString *errorMessage,
|
||||||
QmlProfilerEngine *engine)
|
QmlProfilerRunControl *engine)
|
||||||
{
|
{
|
||||||
QmlProjectManager::QmlProjectRunConfiguration *rc1 =
|
QmlProjectManager::QmlProjectRunConfiguration *rc1 =
|
||||||
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
|
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration);
|
||||||
@@ -81,7 +81,7 @@ LocalQmlProfilerRunner *LocalQmlProfilerRunner::createLocalRunner(
|
|||||||
}
|
}
|
||||||
|
|
||||||
LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration,
|
LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration,
|
||||||
QmlProfilerEngine *engine) :
|
QmlProfilerRunControl *engine) :
|
||||||
AbstractQmlProfilerRunner(engine),
|
AbstractQmlProfilerRunner(engine),
|
||||||
m_configuration(configuration),
|
m_configuration(configuration),
|
||||||
m_engine(engine)
|
m_engine(engine)
|
||||||
|
@@ -41,7 +41,7 @@ namespace Analyzer { class AnalyzerStartParameters; }
|
|||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlProfilerEngine;
|
class QmlProfilerRunControl;
|
||||||
class LocalQmlProfilerRunner : public AbstractQmlProfilerRunner
|
class LocalQmlProfilerRunner : public AbstractQmlProfilerRunner
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
static LocalQmlProfilerRunner *createLocalRunner(ProjectExplorer::RunConfiguration *runConfiguration,
|
static LocalQmlProfilerRunner *createLocalRunner(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||||
const Analyzer::AnalyzerStartParameters &sp,
|
const Analyzer::AnalyzerStartParameters &sp,
|
||||||
QString *errorMessage,
|
QString *errorMessage,
|
||||||
QmlProfilerEngine *engine);
|
QmlProfilerRunControl *engine);
|
||||||
|
|
||||||
~LocalQmlProfilerRunner();
|
~LocalQmlProfilerRunner();
|
||||||
|
|
||||||
@@ -71,12 +71,12 @@ private slots:
|
|||||||
void spontaneousStop(int exitCode);
|
void spontaneousStop(int exitCode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LocalQmlProfilerRunner(const Configuration &configuration, QmlProfilerEngine *engine);
|
LocalQmlProfilerRunner(const Configuration &configuration, QmlProfilerRunControl *engine);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Configuration m_configuration;
|
Configuration m_configuration;
|
||||||
ProjectExplorer::ApplicationLauncher m_launcher;
|
ProjectExplorer::ApplicationLauncher m_launcher;
|
||||||
QmlProfilerEngine *m_engine;
|
QmlProfilerRunControl *m_engine;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -61,15 +61,14 @@ namespace Internal {
|
|||||||
// QmlProfilerEnginePrivate
|
// QmlProfilerEnginePrivate
|
||||||
//
|
//
|
||||||
|
|
||||||
class QmlProfilerEngine::QmlProfilerEnginePrivate
|
class QmlProfilerRunControl::QmlProfilerEnginePrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlProfilerEnginePrivate(const AnalyzerStartParameters &sp) : sp(sp), m_running(false) {}
|
QmlProfilerEnginePrivate() : m_running(false) {}
|
||||||
|
|
||||||
QmlProfilerStateManager *m_profilerState;
|
QmlProfilerStateManager *m_profilerState;
|
||||||
QTimer m_noDebugOutputTimer;
|
QTimer m_noDebugOutputTimer;
|
||||||
QmlDebug::QmlOutputParser m_outputParser;
|
QmlDebug::QmlOutputParser m_outputParser;
|
||||||
const AnalyzerStartParameters sp;
|
|
||||||
bool m_running;
|
bool m_running;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -77,10 +76,10 @@ public:
|
|||||||
// QmlProfilerEngine
|
// QmlProfilerEngine
|
||||||
//
|
//
|
||||||
|
|
||||||
QmlProfilerEngine::QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp,
|
QmlProfilerRunControl::QmlProfilerRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration)
|
ProjectExplorer::RunConfiguration *runConfiguration)
|
||||||
: IAnalyzerEngine(sp, runConfiguration)
|
: AnalyzerRunControl(sp, runConfiguration)
|
||||||
, d(new QmlProfilerEnginePrivate(sp))
|
, d(new QmlProfilerEnginePrivate)
|
||||||
{
|
{
|
||||||
d->m_profilerState = 0;
|
d->m_profilerState = 0;
|
||||||
|
|
||||||
@@ -99,14 +98,14 @@ QmlProfilerEngine::QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp
|
|||||||
this, SLOT(wrongSetupMessageBox(QString)));
|
this, SLOT(wrongSetupMessageBox(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlProfilerEngine::~QmlProfilerEngine()
|
QmlProfilerRunControl::~QmlProfilerRunControl()
|
||||||
{
|
{
|
||||||
if (d->m_profilerState && d->m_profilerState->currentState() == QmlProfilerStateManager::AppRunning)
|
if (d->m_profilerState && d->m_profilerState->currentState() == QmlProfilerStateManager::AppRunning)
|
||||||
stop();
|
stopEngine();
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlProfilerEngine::start()
|
bool QmlProfilerRunControl::startEngine()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->m_profilerState, return false);
|
QTC_ASSERT(d->m_profilerState, return false);
|
||||||
|
|
||||||
@@ -122,7 +121,7 @@ bool QmlProfilerEngine::start()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->sp.startMode == StartQmlRemote || d->sp.startMode == StartLocal) {
|
if (startParameters().startMode == StartQmlRemote || startParameters().startMode == StartLocal) {
|
||||||
d->m_noDebugOutputTimer.start();
|
d->m_noDebugOutputTimer.start();
|
||||||
} else {
|
} else {
|
||||||
emit processRunning(startParameters().analyzerPort);
|
emit processRunning(startParameters().analyzerPort);
|
||||||
@@ -133,7 +132,7 @@ bool QmlProfilerEngine::start()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::stop()
|
void QmlProfilerRunControl::stopEngine()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->m_profilerState, return);
|
QTC_ASSERT(d->m_profilerState, return);
|
||||||
|
|
||||||
@@ -158,7 +157,7 @@ void QmlProfilerEngine::stop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::notifyRemoteFinished(bool success)
|
void QmlProfilerRunControl::notifyRemoteFinished(bool success)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->m_profilerState, return);
|
QTC_ASSERT(d->m_profilerState, return);
|
||||||
|
|
||||||
@@ -170,7 +169,7 @@ void QmlProfilerEngine::notifyRemoteFinished(bool success)
|
|||||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppKilled);
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppKilled);
|
||||||
AnalyzerManager::stopTool();
|
AnalyzerManager::stopTool();
|
||||||
|
|
||||||
engineFinished();
|
runControlFinished();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QmlProfilerStateManager::AppStopped :
|
case QmlProfilerStateManager::AppStopped :
|
||||||
@@ -186,7 +185,7 @@ void QmlProfilerEngine::notifyRemoteFinished(bool success)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::cancelProcess()
|
void QmlProfilerRunControl::cancelProcess()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->m_profilerState, return);
|
QTC_ASSERT(d->m_profilerState, return);
|
||||||
|
|
||||||
@@ -206,16 +205,16 @@ void QmlProfilerEngine::cancelProcess()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
engineFinished();
|
runControlFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::logApplicationMessage(const QString &msg, Utils::OutputFormat format)
|
void QmlProfilerRunControl::logApplicationMessage(const QString &msg, Utils::OutputFormat format)
|
||||||
{
|
{
|
||||||
emit outputReceived(msg, format);
|
appendMessage(msg, format);
|
||||||
d->m_outputParser.processOutput(msg);
|
d->m_outputParser.processOutput(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::wrongSetupMessageBox(const QString &errorMessage)
|
void QmlProfilerRunControl::wrongSetupMessageBox(const QString &errorMessage)
|
||||||
{
|
{
|
||||||
QMessageBox *infoBox = new QMessageBox(Core::ICore::mainWindow());
|
QMessageBox *infoBox = new QMessageBox(Core::ICore::mainWindow());
|
||||||
infoBox->setIcon(QMessageBox::Critical);
|
infoBox->setIcon(QMessageBox::Critical);
|
||||||
@@ -235,10 +234,10 @@ void QmlProfilerEngine::wrongSetupMessageBox(const QString &errorMessage)
|
|||||||
// KILL
|
// KILL
|
||||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
|
||||||
AnalyzerManager::stopTool();
|
AnalyzerManager::stopTool();
|
||||||
engineFinished();
|
runControlFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::wrongSetupMessageBoxFinished(int button)
|
void QmlProfilerRunControl::wrongSetupMessageBoxFinished(int button)
|
||||||
{
|
{
|
||||||
if (button == QMessageBox::Help) {
|
if (button == QMessageBox::Help) {
|
||||||
Core::HelpManager *helpManager = Core::HelpManager::instance();
|
Core::HelpManager *helpManager = Core::HelpManager::instance();
|
||||||
@@ -247,7 +246,7 @@ void QmlProfilerEngine::wrongSetupMessageBoxFinished(int button)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::showNonmodalWarning(const QString &warningMsg)
|
void QmlProfilerRunControl::showNonmodalWarning(const QString &warningMsg)
|
||||||
{
|
{
|
||||||
QMessageBox *noExecWarning = new QMessageBox(Core::ICore::mainWindow());
|
QMessageBox *noExecWarning = new QMessageBox(Core::ICore::mainWindow());
|
||||||
noExecWarning->setIcon(QMessageBox::Warning);
|
noExecWarning->setIcon(QMessageBox::Warning);
|
||||||
@@ -259,13 +258,13 @@ void QmlProfilerEngine::showNonmodalWarning(const QString &warningMsg)
|
|||||||
noExecWarning->show();
|
noExecWarning->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::notifyRemoteSetupDone(quint16 port)
|
void QmlProfilerRunControl::notifyRemoteSetupDone(quint16 port)
|
||||||
{
|
{
|
||||||
d->m_noDebugOutputTimer.stop();
|
d->m_noDebugOutputTimer.stop();
|
||||||
emit processRunning(port);
|
emit processRunning(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::processIsRunning(quint16 port)
|
void QmlProfilerRunControl::processIsRunning(quint16 port)
|
||||||
{
|
{
|
||||||
d->m_noDebugOutputTimer.stop();
|
d->m_noDebugOutputTimer.stop();
|
||||||
|
|
||||||
@@ -273,13 +272,13 @@ void QmlProfilerEngine::processIsRunning(quint16 port)
|
|||||||
emit processRunning(port);
|
emit processRunning(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::engineStarted()
|
void QmlProfilerRunControl::engineStarted()
|
||||||
{
|
{
|
||||||
d->m_running = true;
|
d->m_running = true;
|
||||||
emit starting(this);
|
emit starting(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::engineFinished()
|
void QmlProfilerRunControl::runControlFinished()
|
||||||
{
|
{
|
||||||
d->m_running = false;
|
d->m_running = false;
|
||||||
emit finished();
|
emit finished();
|
||||||
@@ -287,7 +286,7 @@ void QmlProfilerEngine::engineFinished()
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
// Profiler State
|
// Profiler State
|
||||||
void QmlProfilerEngine::registerProfilerStateManager( QmlProfilerStateManager *profilerState )
|
void QmlProfilerRunControl::registerProfilerStateManager( QmlProfilerStateManager *profilerState )
|
||||||
{
|
{
|
||||||
// disconnect old
|
// disconnect old
|
||||||
if (d->m_profilerState)
|
if (d->m_profilerState)
|
||||||
@@ -300,7 +299,7 @@ void QmlProfilerEngine::registerProfilerStateManager( QmlProfilerStateManager *p
|
|||||||
connect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged()));
|
connect(d->m_profilerState, SIGNAL(stateChanged()), this, SLOT(profilerStateChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerEngine::profilerStateChanged()
|
void QmlProfilerRunControl::profilerStateChanged()
|
||||||
{
|
{
|
||||||
switch (d->m_profilerState->currentState()) {
|
switch (d->m_profilerState->currentState()) {
|
||||||
case QmlProfilerStateManager::AppReadyToStop : {
|
case QmlProfilerStateManager::AppReadyToStop : {
|
||||||
|
@@ -32,20 +32,20 @@
|
|||||||
|
|
||||||
#include "qmlprofilerstatemanager.h"
|
#include "qmlprofilerstatemanager.h"
|
||||||
|
|
||||||
#include <analyzerbase/ianalyzerengine.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
#include <utils/outputformat.h>
|
#include <utils/outputformat.h>
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlProfilerEngine : public Analyzer::IAnalyzerEngine
|
class QmlProfilerRunControl : public Analyzer::AnalyzerRunControl
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmlProfilerEngine(const Analyzer::AnalyzerStartParameters &sp,
|
QmlProfilerRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration);
|
||||||
~QmlProfilerEngine();
|
~QmlProfilerRunControl();
|
||||||
|
|
||||||
void registerProfilerStateManager( QmlProfilerStateManager *profilerState );
|
void registerProfilerStateManager( QmlProfilerStateManager *profilerState );
|
||||||
|
|
||||||
@@ -58,8 +58,8 @@ signals:
|
|||||||
void timeUpdate();
|
void timeUpdate();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool start();
|
bool startEngine();
|
||||||
void stop();
|
void stopEngine();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void notifyRemoteFinished(bool success = true);
|
void notifyRemoteFinished(bool success = true);
|
||||||
@@ -70,7 +70,7 @@ private slots:
|
|||||||
void wrongSetupMessageBoxFinished(int);
|
void wrongSetupMessageBoxFinished(int);
|
||||||
void processIsRunning(quint16 port = 0);
|
void processIsRunning(quint16 port = 0);
|
||||||
void engineStarted();
|
void engineStarted();
|
||||||
void engineFinished();
|
void runControlFinished();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void profilerStateChanged();
|
void profilerStateChanged();
|
||||||
|
@@ -131,13 +131,14 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat
|
|||||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||||
|
|
||||||
AnalyzerStartParameters sp = createQmlProfilerStartParameters(runConfiguration);
|
AnalyzerStartParameters sp = createQmlProfilerStartParameters(runConfiguration);
|
||||||
|
sp.runMode = mode;
|
||||||
|
|
||||||
// only desktop device is supported
|
// only desktop device is supported
|
||||||
const IDevice::ConstPtr device = DeviceKitInformation::device(runConfiguration->target()->kit());
|
const IDevice::ConstPtr device = DeviceKitInformation::device(runConfiguration->target()->kit());
|
||||||
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
|
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
|
||||||
|
|
||||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
|
AnalyzerRunControl *rc = tool->createRunControl(sp, runConfiguration);
|
||||||
QmlProfilerEngine *engine = qobject_cast<QmlProfilerEngine *>(rc->engine());
|
QmlProfilerRunControl *engine = qobject_cast<QmlProfilerRunControl *>(rc);
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
delete rc;
|
delete rc;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -148,7 +149,7 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat
|
|||||||
connect(runner, SIGNAL(stopped()), engine, SLOT(notifyRemoteFinished()));
|
connect(runner, SIGNAL(stopped()), engine, SLOT(notifyRemoteFinished()));
|
||||||
connect(runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
connect(runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
||||||
engine, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
|
engine, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
|
||||||
connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)), runner,
|
connect(engine, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)), runner,
|
||||||
SLOT(start()));
|
SLOT(start()));
|
||||||
connect(rc, SIGNAL(finished()), runner, SLOT(stop()));
|
connect(rc, SIGNAL(finished()), runner, SLOT(stop()));
|
||||||
return rc;
|
return rc;
|
||||||
|
@@ -218,10 +218,10 @@ IAnalyzerTool::ToolMode QmlProfilerTool::toolMode() const
|
|||||||
return AnyMode;
|
return AnyMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp,
|
AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration)
|
||||||
{
|
{
|
||||||
QmlProfilerEngine *engine = new QmlProfilerEngine(sp, runConfiguration);
|
QmlProfilerRunControl *engine = new QmlProfilerRunControl(sp, runConfiguration);
|
||||||
|
|
||||||
engine->registerProfilerStateManager(d->m_profilerState);
|
engine->registerProfilerStateManager(d->m_profilerState);
|
||||||
|
|
||||||
@@ -489,7 +489,8 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
|
|||||||
sp.sysroot = SysRootKitInformation::sysRoot(kit).toString();
|
sp.sysroot = SysRootKitInformation::sysRoot(kit).toString();
|
||||||
sp.analyzerPort = port;
|
sp.analyzerPort = port;
|
||||||
|
|
||||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
//AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
||||||
|
AnalyzerRunControl *rc = tool->createRunControl(sp, 0);
|
||||||
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
||||||
|
|
||||||
ProjectExplorerPlugin::instance()->startRunControl(rc, tool->runMode());
|
ProjectExplorerPlugin::instance()->startRunControl(rc, tool->runMode());
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#define QMLPROFILERTOOL_H
|
#define QMLPROFILERTOOL_H
|
||||||
|
|
||||||
#include <analyzerbase/ianalyzertool.h>
|
#include <analyzerbase/ianalyzertool.h>
|
||||||
#include <analyzerbase/ianalyzerengine.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QMessageBox;
|
class QMessageBox;
|
||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
void extensionsInitialized() {}
|
void extensionsInitialized() {}
|
||||||
|
|
||||||
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
|
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||||
|
|
||||||
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
|
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "qnxanalyzesupport.h"
|
#include "qnxanalyzesupport.h"
|
||||||
|
|
||||||
#include <analyzerbase/ianalyzerengine.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
#include <analyzerbase/analyzerstartparameters.h>
|
#include <analyzerbase/analyzerstartparameters.h>
|
||||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||||
|
|
||||||
@@ -41,9 +41,9 @@ using namespace Qnx;
|
|||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
|
|
||||||
QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig,
|
QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig,
|
||||||
Analyzer::IAnalyzerEngine *engine)
|
Analyzer::AnalyzerRunControl *runControl)
|
||||||
: QnxAbstractRunSupport(runConfig, engine)
|
: QnxAbstractRunSupport(runConfig, runControl)
|
||||||
, m_engine(engine)
|
, m_runControl(runControl)
|
||||||
, m_qmlPort(-1)
|
, m_qmlPort(-1)
|
||||||
{
|
{
|
||||||
const DeviceApplicationRunner *runner = appRunner();
|
const DeviceApplicationRunner *runner = appRunner();
|
||||||
@@ -54,7 +54,7 @@ QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig,
|
|||||||
connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
|
connect(runner, SIGNAL(remoteStdout(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
|
||||||
connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
|
connect(runner, SIGNAL(remoteStderr(QByteArray)), SLOT(handleRemoteOutput(QByteArray)));
|
||||||
|
|
||||||
connect(m_engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
|
connect(m_runControl, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)),
|
||||||
SLOT(handleAdapterSetupRequested()));
|
SLOT(handleAdapterSetupRequested()));
|
||||||
connect(&m_outputParser, SIGNAL(waitingForConnectionOnPort(quint16)),
|
connect(&m_outputParser, SIGNAL(waitingForConnectionOnPort(quint16)),
|
||||||
SLOT(remoteIsRunning()));
|
SLOT(remoteIsRunning()));
|
||||||
@@ -78,7 +78,7 @@ void QnxAnalyzeSupport::startExecution()
|
|||||||
|
|
||||||
setState(StartingRemoteProcess);
|
setState(StartingRemoteProcess);
|
||||||
|
|
||||||
const QString args = m_engine->startParameters().debuggeeArgs +
|
const QString args = m_runControl->startParameters().debuggeeArgs +
|
||||||
QString::fromLatin1(" -qmljsdebugger=port:%1,block").arg(m_qmlPort);
|
QString::fromLatin1(" -qmljsdebugger=port:%1,block").arg(m_qmlPort);
|
||||||
const QString command = QString::fromLatin1("%1 %2 %3").arg(commandPrefix(), executable(), args);
|
const QString command = QString::fromLatin1("%1 %2 %3").arg(commandPrefix(), executable(), args);
|
||||||
appRunner()->start(device(), command.toUtf8());
|
appRunner()->start(device(), command.toUtf8());
|
||||||
@@ -86,13 +86,13 @@ void QnxAnalyzeSupport::startExecution()
|
|||||||
|
|
||||||
void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success)
|
void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success)
|
||||||
{
|
{
|
||||||
if (m_engine || state() == Inactive)
|
if (m_runControl || state() == Inactive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
showMessage(tr("The %1 process closed unexpectedly.").arg(executable()),
|
showMessage(tr("The %1 process closed unexpectedly.").arg(executable()),
|
||||||
Utils::NormalMessageFormat);
|
Utils::NormalMessageFormat);
|
||||||
m_engine->notifyRemoteFinished(success);
|
m_runControl->notifyRemoteFinished(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxAnalyzeSupport::handleProfilingFinished()
|
void QnxAnalyzeSupport::handleProfilingFinished()
|
||||||
@@ -124,13 +124,13 @@ void QnxAnalyzeSupport::handleError(const QString &error)
|
|||||||
|
|
||||||
void QnxAnalyzeSupport::remoteIsRunning()
|
void QnxAnalyzeSupport::remoteIsRunning()
|
||||||
{
|
{
|
||||||
if (m_engine)
|
if (m_runControl)
|
||||||
m_engine->notifyRemoteSetupDone(m_qmlPort);
|
m_runControl->notifyRemoteSetupDone(m_qmlPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFormat format)
|
void QnxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFormat format)
|
||||||
{
|
{
|
||||||
if (state() != Inactive && m_engine)
|
if (state() != Inactive && m_runControl)
|
||||||
m_engine->logApplicationMessage(msg, format);
|
m_runControl->logApplicationMessage(msg, format);
|
||||||
m_outputParser.processOutput(msg);
|
m_outputParser.processOutput(msg);
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
#include <utils/outputformat.h>
|
#include <utils/outputformat.h>
|
||||||
#include <qmldebug/qmloutputparser.h>
|
#include <qmldebug/qmloutputparser.h>
|
||||||
|
|
||||||
namespace Analyzer { class IAnalyzerEngine; }
|
namespace Analyzer { class AnalyzerRunControl; }
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -47,7 +47,7 @@ class QnxAnalyzeSupport : public QnxAbstractRunSupport
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QnxAnalyzeSupport(QnxRunConfiguration *runConfig, Analyzer::IAnalyzerEngine *engine);
|
QnxAnalyzeSupport(QnxRunConfiguration *runConfig, Analyzer::AnalyzerRunControl *engine);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void handleProfilingFinished();
|
void handleProfilingFinished();
|
||||||
@@ -66,7 +66,7 @@ private:
|
|||||||
void startExecution();
|
void startExecution();
|
||||||
void showMessage(const QString &, Utils::OutputFormat);
|
void showMessage(const QString &, Utils::OutputFormat);
|
||||||
|
|
||||||
Analyzer::IAnalyzerEngine *m_engine;
|
Analyzer::AnalyzerRunControl *m_runControl;
|
||||||
QmlDebug::QmlOutputParser m_outputParser;
|
QmlDebug::QmlOutputParser m_outputParser;
|
||||||
int m_qmlPort;
|
int m_qmlPort;
|
||||||
};
|
};
|
||||||
|
@@ -48,6 +48,7 @@
|
|||||||
#include <analyzerbase/analyzerstartparameters.h>
|
#include <analyzerbase/analyzerstartparameters.h>
|
||||||
#include <analyzerbase/analyzermanager.h>
|
#include <analyzerbase/analyzermanager.h>
|
||||||
#include <analyzerbase/analyzerruncontrol.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
|
#include <analyzerbase/ianalyzertool.h>
|
||||||
#include <projectexplorer/environmentaspect.h>
|
#include <projectexplorer/environmentaspect.h>
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
@@ -195,8 +196,9 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, RunMode mo
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const AnalyzerStartParameters params = createAnalyzerStartParameters(rc, mode);
|
const AnalyzerStartParameters params = createAnalyzerStartParameters(rc, mode);
|
||||||
AnalyzerRunControl * const runControl = new AnalyzerRunControl(tool, params, runConfig);
|
AnalyzerRunControl *runControl = tool->createRunControl(params, runConfig);
|
||||||
QnxAnalyzeSupport * const analyzeSupport = new QnxAnalyzeSupport(rc, runControl->engine());
|
//AnalyzerRunControl * const runControl = new AnalyzerRunControl(tool, params, runConfig);
|
||||||
|
QnxAnalyzeSupport * const analyzeSupport = new QnxAnalyzeSupport(rc, runControl);
|
||||||
connect(runControl, SIGNAL(finished()), analyzeSupport, SLOT(handleProfilingFinished()));
|
connect(runControl, SIGNAL(finished()), analyzeSupport, SLOT(handleProfilingFinished()));
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include "remotelinuxrunconfiguration.h"
|
#include "remotelinuxrunconfiguration.h"
|
||||||
|
|
||||||
#include <analyzerbase/ianalyzerengine.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
@@ -55,14 +55,14 @@ namespace Internal {
|
|||||||
class RemoteLinuxAnalyzeSupportPrivate
|
class RemoteLinuxAnalyzeSupportPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RemoteLinuxAnalyzeSupportPrivate(IAnalyzerEngine *engine, RunMode runMode)
|
RemoteLinuxAnalyzeSupportPrivate(AnalyzerRunControl *rc, RunMode runMode)
|
||||||
: engine(engine),
|
: runControl(rc),
|
||||||
qmlProfiling(runMode == QmlProfilerRunMode),
|
qmlProfiling(runMode == QmlProfilerRunMode),
|
||||||
qmlPort(-1)
|
qmlPort(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPointer<IAnalyzerEngine> engine;
|
const QPointer<AnalyzerRunControl> runControl;
|
||||||
bool qmlProfiling;
|
bool qmlProfiling;
|
||||||
int qmlPort;
|
int qmlPort;
|
||||||
|
|
||||||
@@ -79,6 +79,7 @@ AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const RemoteL
|
|||||||
AnalyzerStartParameters params;
|
AnalyzerStartParameters params;
|
||||||
if (runMode == QmlProfilerRunMode)
|
if (runMode == QmlProfilerRunMode)
|
||||||
params.startMode = StartQmlRemote;
|
params.startMode = StartQmlRemote;
|
||||||
|
params.runMode = runMode;
|
||||||
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
|
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
|
||||||
params.analyzerCmdPrefix = runConfig->commandPrefix();
|
params.analyzerCmdPrefix = runConfig->commandPrefix();
|
||||||
params.displayName = runConfig->displayName();
|
params.displayName = runConfig->displayName();
|
||||||
@@ -89,11 +90,11 @@ AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const RemoteL
|
|||||||
}
|
}
|
||||||
|
|
||||||
RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration *runConfig,
|
RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration *runConfig,
|
||||||
IAnalyzerEngine *engine, RunMode runMode)
|
AnalyzerRunControl *engine, RunMode runMode)
|
||||||
: AbstractRemoteLinuxRunSupport(runConfig, engine),
|
: AbstractRemoteLinuxRunSupport(runConfig, engine),
|
||||||
d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode))
|
d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode))
|
||||||
{
|
{
|
||||||
connect(d->engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
|
connect(d->runControl, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)),
|
||||||
SLOT(handleRemoteSetupRequested()));
|
SLOT(handleRemoteSetupRequested()));
|
||||||
connect(&d->outputParser, SIGNAL(waitingForConnectionOnPort(quint16)),
|
connect(&d->outputParser, SIGNAL(waitingForConnectionOnPort(quint16)),
|
||||||
SLOT(remoteIsRunning()));
|
SLOT(remoteIsRunning()));
|
||||||
@@ -106,14 +107,14 @@ RemoteLinuxAnalyzeSupport::~RemoteLinuxAnalyzeSupport()
|
|||||||
|
|
||||||
void RemoteLinuxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFormat format)
|
void RemoteLinuxAnalyzeSupport::showMessage(const QString &msg, Utils::OutputFormat format)
|
||||||
{
|
{
|
||||||
if (state() != Inactive && d->engine)
|
if (state() != Inactive && d->runControl)
|
||||||
d->engine->logApplicationMessage(msg, format);
|
d->runControl->logApplicationMessage(msg, format);
|
||||||
d->outputParser.processOutput(msg);
|
d->outputParser.processOutput(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested()
|
void RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested()
|
||||||
{
|
{
|
||||||
if (d->engine->mode() != Analyzer::StartQmlRemote)
|
if (d->runControl->mode() != Analyzer::StartQmlRemote)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QTC_ASSERT(state() == Inactive, return);
|
QTC_ASSERT(state() == Inactive, return);
|
||||||
@@ -163,19 +164,19 @@ void RemoteLinuxAnalyzeSupport::handleAppRunnerFinished(bool success)
|
|||||||
reset();
|
reset();
|
||||||
if (!success)
|
if (!success)
|
||||||
showMessage(tr("Failure running remote process."), Utils::NormalMessageFormat);
|
showMessage(tr("Failure running remote process."), Utils::NormalMessageFormat);
|
||||||
d->engine->notifyRemoteFinished(success);
|
d->runControl->notifyRemoteFinished(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxAnalyzeSupport::handleProfilingFinished()
|
void RemoteLinuxAnalyzeSupport::handleProfilingFinished()
|
||||||
{
|
{
|
||||||
if (d->engine->mode() != Analyzer::StartQmlRemote)
|
if (d->runControl->mode() != Analyzer::StartQmlRemote)
|
||||||
return;
|
return;
|
||||||
setFinished();
|
setFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxAnalyzeSupport::remoteIsRunning()
|
void RemoteLinuxAnalyzeSupport::remoteIsRunning()
|
||||||
{
|
{
|
||||||
d->engine->notifyRemoteSetupDone(d->qmlPort);
|
d->runControl->notifyRemoteSetupDone(d->qmlPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxAnalyzeSupport::handleRemoteOutput(const QByteArray &output)
|
void RemoteLinuxAnalyzeSupport::handleRemoteOutput(const QByteArray &output)
|
||||||
@@ -189,7 +190,7 @@ void RemoteLinuxAnalyzeSupport::handleRemoteErrorOutput(const QByteArray &output
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(state() != GatheringPorts, return);
|
QTC_ASSERT(state() != GatheringPorts, return);
|
||||||
|
|
||||||
if (!d->engine)
|
if (!d->runControl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
showMessage(QString::fromUtf8(output), Utils::StdErrFormat);
|
showMessage(QString::fromUtf8(output), Utils::StdErrFormat);
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
class AnalyzerStartParameters;
|
class AnalyzerStartParameters;
|
||||||
class IAnalyzerEngine;
|
class AnalyzerRunControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
ProjectExplorer::RunMode runMode);
|
ProjectExplorer::RunMode runMode);
|
||||||
|
|
||||||
RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration *runConfig,
|
RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration *runConfig,
|
||||||
Analyzer::IAnalyzerEngine *engine, ProjectExplorer::RunMode runMode);
|
Analyzer::AnalyzerRunControl *engine, ProjectExplorer::RunMode runMode);
|
||||||
~RemoteLinuxAnalyzeSupport();
|
~RemoteLinuxAnalyzeSupport();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include <analyzerbase/analyzerstartparameters.h>
|
#include <analyzerbase/analyzerstartparameters.h>
|
||||||
#include <analyzerbase/analyzermanager.h>
|
#include <analyzerbase/analyzermanager.h>
|
||||||
#include <analyzerbase/analyzerruncontrol.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
|
#include <analyzerbase/ianalyzertool.h>
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <utils/portlist.h>
|
#include <utils/portlist.h>
|
||||||
@@ -113,9 +114,13 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Ru
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
AnalyzerStartParameters params = RemoteLinuxAnalyzeSupport::startParameters(rc, mode);
|
AnalyzerStartParameters params = RemoteLinuxAnalyzeSupport::startParameters(rc, mode);
|
||||||
AnalyzerRunControl * const runControl = new AnalyzerRunControl(tool, params, runConfig);
|
//AnalyzerRunControl * const runControl = new AnalyzerRunControl(tool, params, runConfig);
|
||||||
|
|
||||||
|
AnalyzerRunControl *runControl = tool->createRunControl(params, runConfig);
|
||||||
|
//m_engine->setRunControl(this);
|
||||||
|
|
||||||
RemoteLinuxAnalyzeSupport * const analyzeSupport =
|
RemoteLinuxAnalyzeSupport * const analyzeSupport =
|
||||||
new RemoteLinuxAnalyzeSupport(rc, runControl->engine(), mode);
|
new RemoteLinuxAnalyzeSupport(rc, runControl, mode);
|
||||||
connect(runControl, SIGNAL(finished()), analyzeSupport, SLOT(handleProfilingFinished()));
|
connect(runControl, SIGNAL(finished()), analyzeSupport, SLOT(handleProfilingFinished()));
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
|
@@ -42,9 +42,9 @@ using namespace Analyzer;
|
|||||||
using namespace Valgrind;
|
using namespace Valgrind;
|
||||||
using namespace Valgrind::Internal;
|
using namespace Valgrind::Internal;
|
||||||
|
|
||||||
CallgrindEngine::CallgrindEngine(const AnalyzerStartParameters &sp,
|
CallgrindRunControl::CallgrindRunControl(const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration)
|
ProjectExplorer::RunConfiguration *runConfiguration)
|
||||||
: ValgrindEngine(sp, runConfiguration)
|
: ValgrindRunControl(sp, runConfiguration)
|
||||||
, m_markAsPaused(false)
|
, m_markAsPaused(false)
|
||||||
{
|
{
|
||||||
connect(&m_runner, SIGNAL(finished()), this, SLOT(slotFinished()));
|
connect(&m_runner, SIGNAL(finished()), this, SLOT(slotFinished()));
|
||||||
@@ -55,12 +55,12 @@ CallgrindEngine::CallgrindEngine(const AnalyzerStartParameters &sp,
|
|||||||
m_progress->setProgressRange(0, 2);
|
m_progress->setProgressRange(0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindEngine::showStatusMessage(const QString &msg)
|
void CallgrindRunControl::showStatusMessage(const QString &msg)
|
||||||
{
|
{
|
||||||
AnalyzerManager::showStatusMessage(msg);
|
AnalyzerManager::showStatusMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CallgrindEngine::toolArguments() const
|
QStringList CallgrindRunControl::toolArguments() const
|
||||||
{
|
{
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
|
|
||||||
@@ -89,28 +89,28 @@ QStringList CallgrindEngine::toolArguments() const
|
|||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CallgrindEngine::progressTitle() const
|
QString CallgrindRunControl::progressTitle() const
|
||||||
{
|
{
|
||||||
return tr("Profiling");
|
return tr("Profiling");
|
||||||
}
|
}
|
||||||
|
|
||||||
Valgrind::ValgrindRunner * CallgrindEngine::runner()
|
Valgrind::ValgrindRunner * CallgrindRunControl::runner()
|
||||||
{
|
{
|
||||||
return &m_runner;
|
return &m_runner;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CallgrindEngine::start()
|
bool CallgrindRunControl::startEngine()
|
||||||
{
|
{
|
||||||
emit outputReceived(tr("Profiling %1\n").arg(executable()), Utils::NormalMessageFormat);
|
appendMessage(tr("Profiling %1\n").arg(executable()), Utils::NormalMessageFormat);
|
||||||
return ValgrindEngine::start();
|
return ValgrindRunControl::startEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindEngine::dump()
|
void CallgrindRunControl::dump()
|
||||||
{
|
{
|
||||||
m_runner.controller()->run(Valgrind::Callgrind::CallgrindController::Dump);
|
m_runner.controller()->run(Valgrind::Callgrind::CallgrindController::Dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindEngine::setPaused(bool paused)
|
void CallgrindRunControl::setPaused(bool paused)
|
||||||
{
|
{
|
||||||
if (m_markAsPaused == paused)
|
if (m_markAsPaused == paused)
|
||||||
return;
|
return;
|
||||||
@@ -126,7 +126,7 @@ void CallgrindEngine::setPaused(bool paused)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindEngine::setToggleCollectFunction(const QString &toggleCollectFunction)
|
void CallgrindRunControl::setToggleCollectFunction(const QString &toggleCollectFunction)
|
||||||
{
|
{
|
||||||
if (toggleCollectFunction.isEmpty())
|
if (toggleCollectFunction.isEmpty())
|
||||||
return;
|
return;
|
||||||
@@ -134,32 +134,32 @@ void CallgrindEngine::setToggleCollectFunction(const QString &toggleCollectFunct
|
|||||||
m_argumentForToggleCollect = QLatin1String("--toggle-collect=") + toggleCollectFunction;
|
m_argumentForToggleCollect = QLatin1String("--toggle-collect=") + toggleCollectFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindEngine::reset()
|
void CallgrindRunControl::reset()
|
||||||
{
|
{
|
||||||
m_runner.controller()->run(Valgrind::Callgrind::CallgrindController::ResetEventCounters);
|
m_runner.controller()->run(Valgrind::Callgrind::CallgrindController::ResetEventCounters);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindEngine::pause()
|
void CallgrindRunControl::pause()
|
||||||
{
|
{
|
||||||
m_runner.controller()->run(Valgrind::Callgrind::CallgrindController::Pause);
|
m_runner.controller()->run(Valgrind::Callgrind::CallgrindController::Pause);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindEngine::unpause()
|
void CallgrindRunControl::unpause()
|
||||||
{
|
{
|
||||||
m_runner.controller()->run(Valgrind::Callgrind::CallgrindController::UnPause);
|
m_runner.controller()->run(Valgrind::Callgrind::CallgrindController::UnPause);
|
||||||
}
|
}
|
||||||
|
|
||||||
Valgrind::Callgrind::ParseData *CallgrindEngine::takeParserData()
|
Valgrind::Callgrind::ParseData *CallgrindRunControl::takeParserData()
|
||||||
{
|
{
|
||||||
return m_runner.parser()->takeData();
|
return m_runner.parser()->takeData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindEngine::slotFinished()
|
void CallgrindRunControl::slotFinished()
|
||||||
{
|
{
|
||||||
emit parserDataReady(this);
|
emit parserDataReady(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindEngine::slotStarted()
|
void CallgrindRunControl::slotStarted()
|
||||||
{
|
{
|
||||||
m_progress->setProgressValue(1);;
|
m_progress->setProgressValue(1);;
|
||||||
}
|
}
|
||||||
|
@@ -38,15 +38,15 @@
|
|||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CallgrindEngine : public Valgrind::Internal::ValgrindEngine
|
class CallgrindRunControl : public ValgrindRunControl
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CallgrindEngine(const Analyzer::AnalyzerStartParameters &sp,
|
CallgrindRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration);
|
||||||
|
|
||||||
bool start();
|
bool startEngine();
|
||||||
|
|
||||||
Valgrind::Callgrind::ParseData *takeParserData();
|
Valgrind::Callgrind::ParseData *takeParserData();
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ protected:
|
|||||||
virtual Valgrind::ValgrindRunner *runner();
|
virtual Valgrind::ValgrindRunner *runner();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void parserDataReady(CallgrindEngine *engine);
|
void parserDataReady(CallgrindRunControl *engine);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotFinished();
|
void slotFinished();
|
||||||
|
@@ -118,7 +118,7 @@ public:
|
|||||||
void doClear(bool clearParseData);
|
void doClear(bool clearParseData);
|
||||||
void updateEventCombo();
|
void updateEventCombo();
|
||||||
|
|
||||||
IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp,
|
AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -163,8 +163,8 @@ public slots:
|
|||||||
void visualisationFunctionSelected(const Valgrind::Callgrind::Function *function);
|
void visualisationFunctionSelected(const Valgrind::Callgrind::Function *function);
|
||||||
void showParserResults(const Valgrind::Callgrind::ParseData *data);
|
void showParserResults(const Valgrind::Callgrind::ParseData *data);
|
||||||
|
|
||||||
void takeParserData(CallgrindEngine *engine);
|
void takeParserData(CallgrindRunControl *rc);
|
||||||
void engineStarting(const Analyzer::IAnalyzerEngine *);
|
void engineStarting(const Analyzer::AnalyzerRunControl *);
|
||||||
void engineFinished();
|
void engineFinished();
|
||||||
|
|
||||||
void editorOpened(Core::IEditor *);
|
void editorOpened(Core::IEditor *);
|
||||||
@@ -569,38 +569,38 @@ void CallgrindTool::extensionsInitialized()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IAnalyzerEngine *CallgrindTool::createEngine(const AnalyzerStartParameters &sp,
|
AnalyzerRunControl *CallgrindTool::createRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration)
|
||||||
{
|
{
|
||||||
return d->createEngine(sp, runConfiguration);
|
return d->createRunControl(sp, runConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameters &sp,
|
AnalyzerRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration)
|
||||||
{
|
{
|
||||||
CallgrindEngine *engine = new CallgrindEngine(sp, runConfiguration);
|
CallgrindRunControl *rc = new CallgrindRunControl(sp, runConfiguration);
|
||||||
|
|
||||||
connect(engine, SIGNAL(parserDataReady(CallgrindEngine*)),
|
connect(rc, SIGNAL(parserDataReady(CallgrindRunControl*)),
|
||||||
SLOT(takeParserData(CallgrindEngine*)));
|
SLOT(takeParserData(CallgrindRunControl*)));
|
||||||
connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
|
connect(rc, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)),
|
||||||
SLOT(engineStarting(const Analyzer::IAnalyzerEngine*)));
|
SLOT(engineStarting(const Analyzer::AnalyzerRunControl*)));
|
||||||
connect(engine, SIGNAL(finished()),
|
connect(rc, SIGNAL(finished()),
|
||||||
SLOT(engineFinished()));
|
SLOT(engineFinished()));
|
||||||
|
|
||||||
connect(this, SIGNAL(dumpRequested()), engine, SLOT(dump()));
|
connect(this, SIGNAL(dumpRequested()), rc, SLOT(dump()));
|
||||||
connect(this, SIGNAL(resetRequested()), engine, SLOT(reset()));
|
connect(this, SIGNAL(resetRequested()), rc, SLOT(reset()));
|
||||||
connect(this, SIGNAL(pauseToggled(bool)), engine, SLOT(setPaused(bool)));
|
connect(this, SIGNAL(pauseToggled(bool)), rc, SLOT(setPaused(bool)));
|
||||||
|
|
||||||
// initialize engine
|
// initialize run control
|
||||||
engine->setPaused(m_pauseAction->isChecked());
|
rc->setPaused(m_pauseAction->isChecked());
|
||||||
|
|
||||||
// we may want to toggle collect for one function only in this run
|
// we may want to toggle collect for one function only in this run
|
||||||
engine->setToggleCollectFunction(m_toggleCollectFunction);
|
rc->setToggleCollectFunction(m_toggleCollectFunction);
|
||||||
m_toggleCollectFunction.clear();
|
m_toggleCollectFunction.clear();
|
||||||
|
|
||||||
AnalyzerManager::showStatusMessage(AnalyzerManager::msgToolStarted(q->displayName()));
|
AnalyzerManager::showStatusMessage(AnalyzerManager::msgToolStarted(q->displayName()));
|
||||||
|
|
||||||
QTC_ASSERT(m_visualisation, return engine);
|
QTC_ASSERT(m_visualisation, return rc);
|
||||||
|
|
||||||
// apply project settings
|
// apply project settings
|
||||||
if (runConfiguration) {
|
if (runConfiguration) {
|
||||||
@@ -612,7 +612,7 @@ IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return engine;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindTool::startTool(StartMode mode)
|
void CallgrindTool::startTool(StartMode mode)
|
||||||
@@ -856,7 +856,7 @@ void CallgrindToolPrivate::clearTextMarks()
|
|||||||
m_textMarks.clear();
|
m_textMarks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindToolPrivate::engineStarting(const Analyzer::IAnalyzerEngine *)
|
void CallgrindToolPrivate::engineStarting(const Analyzer::AnalyzerRunControl *)
|
||||||
{
|
{
|
||||||
// enable/disable actions
|
// enable/disable actions
|
||||||
m_resetAction->setEnabled(true);
|
m_resetAction->setEnabled(true);
|
||||||
@@ -964,9 +964,9 @@ void CallgrindToolPrivate::slotRequestDump()
|
|||||||
dumpRequested();
|
dumpRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindToolPrivate::takeParserData(CallgrindEngine *engine)
|
void CallgrindToolPrivate::takeParserData(CallgrindRunControl *rc)
|
||||||
{
|
{
|
||||||
ParseData *data = engine->takeParserData();
|
ParseData *data = rc->takeParserData();
|
||||||
showParserResults(data);
|
showParserResults(data);
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
|
@@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
|
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||||
QWidget *createWidgets();
|
QWidget *createWidgets();
|
||||||
|
|
||||||
|
@@ -34,20 +34,24 @@
|
|||||||
|
|
||||||
#include <analyzerbase/analyzersettings.h>
|
#include <analyzerbase/analyzersettings.h>
|
||||||
|
|
||||||
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
#include <projectexplorer/taskhub.h>
|
||||||
|
|
||||||
#include <valgrind/xmlprotocol/error.h>
|
#include <valgrind/xmlprotocol/error.h>
|
||||||
#include <valgrind/xmlprotocol/status.h>
|
#include <valgrind/xmlprotocol/status.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace Analyzer;
|
using namespace Analyzer;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
using namespace Valgrind::XmlProtocol;
|
using namespace Valgrind::XmlProtocol;
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
MemcheckEngine::MemcheckEngine(const AnalyzerStartParameters &sp,
|
MemcheckRunControl::MemcheckRunControl(const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration)
|
ProjectExplorer::RunConfiguration *runConfiguration)
|
||||||
: ValgrindEngine(sp, runConfiguration)
|
: ValgrindRunControl(sp, runConfiguration)
|
||||||
{
|
{
|
||||||
connect(&m_parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
|
connect(&m_parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
|
||||||
SIGNAL(parserError(Valgrind::XmlProtocol::Error)));
|
SIGNAL(parserError(Valgrind::XmlProtocol::Error)));
|
||||||
@@ -61,33 +65,36 @@ MemcheckEngine::MemcheckEngine(const AnalyzerStartParameters &sp,
|
|||||||
m_progress->setProgressRange(0, XmlProtocol::Status::Finished + 1);
|
m_progress->setProgressRange(0, XmlProtocol::Status::Finished + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MemcheckEngine::progressTitle() const
|
QString MemcheckRunControl::progressTitle() const
|
||||||
{
|
{
|
||||||
return tr("Analyzing Memory");
|
return tr("Analyzing Memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
Valgrind::ValgrindRunner *MemcheckEngine::runner()
|
Valgrind::ValgrindRunner *MemcheckRunControl::runner()
|
||||||
{
|
{
|
||||||
return &m_runner;
|
return &m_runner;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MemcheckEngine::start()
|
bool MemcheckRunControl::startEngine()
|
||||||
{
|
{
|
||||||
m_runner.setParser(&m_parser);
|
m_runner.setParser(&m_parser);
|
||||||
|
|
||||||
emit outputReceived(tr("Analyzing memory of %1\n").arg(executable()),
|
// Clear about-to-be-outdated tasks.
|
||||||
|
ProjectExplorerPlugin::instance()->taskHub()->clearTasks(Analyzer::Constants::ANALYZERTASK_ID);
|
||||||
|
|
||||||
|
appendMessage(tr("Analyzing memory of %1\n").arg(executable()),
|
||||||
Utils::NormalMessageFormat);
|
Utils::NormalMessageFormat);
|
||||||
return ValgrindEngine::start();
|
return ValgrindRunControl::startEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemcheckEngine::stop()
|
void MemcheckRunControl::stopEngine()
|
||||||
{
|
{
|
||||||
disconnect(&m_parser, SIGNAL(internalError(QString)),
|
disconnect(&m_parser, SIGNAL(internalError(QString)),
|
||||||
this, SIGNAL(internalParserError(QString)));
|
this, SIGNAL(internalParserError(QString)));
|
||||||
ValgrindEngine::stop();
|
ValgrindRunControl::stopEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MemcheckEngine::toolArguments() const
|
QStringList MemcheckRunControl::toolArguments() const
|
||||||
{
|
{
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("--gen-suppressions=all");
|
arguments << QLatin1String("--gen-suppressions=all");
|
||||||
@@ -105,17 +112,17 @@ QStringList MemcheckEngine::toolArguments() const
|
|||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MemcheckEngine::suppressionFiles() const
|
QStringList MemcheckRunControl::suppressionFiles() const
|
||||||
{
|
{
|
||||||
return m_settings->subConfig<ValgrindBaseSettings>()->suppressionFiles();
|
return m_settings->subConfig<ValgrindBaseSettings>()->suppressionFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemcheckEngine::status(const Status &status)
|
void MemcheckRunControl::status(const Status &status)
|
||||||
{
|
{
|
||||||
m_progress->setProgressValue(status.state() + 1);
|
m_progress->setProgressValue(status.state() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemcheckEngine::receiveLogMessage(const QByteArray &b)
|
void MemcheckRunControl::receiveLogMessage(const QByteArray &b)
|
||||||
{
|
{
|
||||||
QString error = QString::fromLocal8Bit(b);
|
QString error = QString::fromLocal8Bit(b);
|
||||||
// workaround https://bugs.kde.org/show_bug.cgi?id=255888
|
// workaround https://bugs.kde.org/show_bug.cgi?id=255888
|
||||||
@@ -126,7 +133,7 @@ void MemcheckEngine::receiveLogMessage(const QByteArray &b)
|
|||||||
if (error.isEmpty())
|
if (error.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
stop();
|
stopEngine();
|
||||||
|
|
||||||
QString file;
|
QString file;
|
||||||
int line = -1;
|
int line = -1;
|
||||||
@@ -138,7 +145,10 @@ void MemcheckEngine::receiveLogMessage(const QByteArray &b)
|
|||||||
line = suppressionError.cap(2).toInt();
|
line = suppressionError.cap(2).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit taskToBeAdded(ProjectExplorer::Task::Error, error, file, line);
|
TaskHub *hub = ProjectExplorerPlugin::instance()->taskHub();
|
||||||
|
hub->addTask(Task(Task::Error, error, Utils::FileName::fromUserInput(file), line,
|
||||||
|
Analyzer::Constants::ANALYZERTASK_ID));
|
||||||
|
hub->requestPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -39,16 +39,16 @@
|
|||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class MemcheckEngine : public ValgrindEngine
|
class MemcheckRunControl : public ValgrindRunControl
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MemcheckEngine(const Analyzer::AnalyzerStartParameters &sp,
|
MemcheckRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration);
|
||||||
|
|
||||||
bool start();
|
bool startEngine();
|
||||||
void stop();
|
void stopEngine();
|
||||||
|
|
||||||
QStringList suppressionFiles() const;
|
QStringList suppressionFiles() const;
|
||||||
|
|
||||||
|
@@ -450,16 +450,16 @@ QWidget *MemcheckTool::createWidgets()
|
|||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
IAnalyzerEngine *MemcheckTool::createEngine(const AnalyzerStartParameters &sp,
|
AnalyzerRunControl *MemcheckTool::createRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration)
|
||||||
{
|
{
|
||||||
m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()
|
m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()
|
||||||
->project()->files(Project::AllFiles) : QStringList());
|
->project()->files(Project::AllFiles) : QStringList());
|
||||||
|
|
||||||
MemcheckEngine *engine = new MemcheckEngine(sp, runConfiguration);
|
MemcheckRunControl *engine = new MemcheckRunControl(sp, runConfiguration);
|
||||||
|
|
||||||
connect(engine, SIGNAL(starting(const Analyzer::IAnalyzerEngine*)),
|
connect(engine, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)),
|
||||||
this, SLOT(engineStarting(const Analyzer::IAnalyzerEngine*)));
|
this, SLOT(engineStarting(const Analyzer::AnalyzerRunControl*)));
|
||||||
connect(engine, SIGNAL(parserError(Valgrind::XmlProtocol::Error)),
|
connect(engine, SIGNAL(parserError(Valgrind::XmlProtocol::Error)),
|
||||||
this, SLOT(parserError(Valgrind::XmlProtocol::Error)));
|
this, SLOT(parserError(Valgrind::XmlProtocol::Error)));
|
||||||
connect(engine, SIGNAL(internalParserError(QString)),
|
connect(engine, SIGNAL(internalParserError(QString)),
|
||||||
@@ -474,7 +474,7 @@ void MemcheckTool::startTool(StartMode mode)
|
|||||||
ValgrindPlugin::startValgrindTool(this, mode);
|
ValgrindPlugin::startValgrindTool(this, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
|
void MemcheckTool::engineStarting(const AnalyzerRunControl *engine)
|
||||||
{
|
{
|
||||||
setBusyCursor(true);
|
setBusyCursor(true);
|
||||||
clearErrorView();
|
clearErrorView();
|
||||||
@@ -483,7 +483,7 @@ void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
|
|||||||
if (RunConfiguration *rc = engine->runConfiguration())
|
if (RunConfiguration *rc = engine->runConfiguration())
|
||||||
dir = rc->target()->project()->projectDirectory() + QDir::separator();
|
dir = rc->target()->project()->projectDirectory() + QDir::separator();
|
||||||
|
|
||||||
const MemcheckEngine *mEngine = dynamic_cast<const MemcheckEngine *>(engine);
|
const MemcheckRunControl *mEngine = dynamic_cast<const MemcheckRunControl *>(engine);
|
||||||
QTC_ASSERT(mEngine, return);
|
QTC_ASSERT(mEngine, return);
|
||||||
const QString name = QFileInfo(mEngine->executable()).fileName();
|
const QString name = QFileInfo(mEngine->executable()).fileName();
|
||||||
|
|
||||||
|
@@ -98,7 +98,7 @@ private slots:
|
|||||||
void settingsDestroyed(QObject *settings);
|
void settingsDestroyed(QObject *settings);
|
||||||
void maybeActiveRunConfigurationChanged();
|
void maybeActiveRunConfigurationChanged();
|
||||||
|
|
||||||
void engineStarting(const Analyzer::IAnalyzerEngine *engine);
|
void engineStarting(const Analyzer::AnalyzerRunControl *engine);
|
||||||
void finished();
|
void finished();
|
||||||
|
|
||||||
void parserError(const Valgrind::XmlProtocol::Error &error);
|
void parserError(const Valgrind::XmlProtocol::Error &error);
|
||||||
@@ -112,7 +112,7 @@ private:
|
|||||||
QWidget *createWidgets();
|
QWidget *createWidgets();
|
||||||
void setBusyCursor(bool busy);
|
void setBusyCursor(bool busy);
|
||||||
|
|
||||||
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
|
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||||
void startTool(Analyzer::StartMode mode);
|
void startTool(Analyzer::StartMode mode);
|
||||||
|
|
||||||
|
@@ -53,9 +53,9 @@ namespace Internal {
|
|||||||
|
|
||||||
const int progressMaximum = 1000000;
|
const int progressMaximum = 1000000;
|
||||||
|
|
||||||
ValgrindEngine::ValgrindEngine(const AnalyzerStartParameters &sp,
|
ValgrindRunControl::ValgrindRunControl(const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration)
|
ProjectExplorer::RunConfiguration *runConfiguration)
|
||||||
: IAnalyzerEngine(sp, runConfiguration),
|
: AnalyzerRunControl(sp, runConfiguration),
|
||||||
m_settings(0),
|
m_settings(0),
|
||||||
m_progress(new QFutureInterface<void>()),
|
m_progress(new QFutureInterface<void>()),
|
||||||
m_progressWatcher(new QFutureWatcher<void>()),
|
m_progressWatcher(new QFutureWatcher<void>()),
|
||||||
@@ -73,12 +73,12 @@ ValgrindEngine::ValgrindEngine(const AnalyzerStartParameters &sp,
|
|||||||
this, SLOT(handleProgressFinished()));
|
this, SLOT(handleProgressFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ValgrindEngine::~ValgrindEngine()
|
ValgrindRunControl::~ValgrindRunControl()
|
||||||
{
|
{
|
||||||
delete m_progress;
|
delete m_progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValgrindEngine::start()
|
bool ValgrindRunControl::startEngine()
|
||||||
{
|
{
|
||||||
emit starting(this);
|
emit starting(this);
|
||||||
|
|
||||||
@@ -123,32 +123,32 @@ bool ValgrindEngine::start()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindEngine::stop()
|
void ValgrindRunControl::stopEngine()
|
||||||
{
|
{
|
||||||
m_isStopping = true;
|
m_isStopping = true;
|
||||||
runner()->stop();
|
runner()->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ValgrindEngine::executable() const
|
QString ValgrindRunControl::executable() const
|
||||||
{
|
{
|
||||||
return startParameters().debuggee;
|
return startParameters().debuggee;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindEngine::handleProgressCanceled()
|
void ValgrindRunControl::handleProgressCanceled()
|
||||||
{
|
{
|
||||||
AnalyzerManager::stopTool();
|
AnalyzerManager::stopTool();
|
||||||
m_progress->reportCanceled();
|
m_progress->reportCanceled();
|
||||||
m_progress->reportFinished();
|
m_progress->reportFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindEngine::handleProgressFinished()
|
void ValgrindRunControl::handleProgressFinished()
|
||||||
{
|
{
|
||||||
QApplication::alert(ICore::mainWindow(), 3000);
|
QApplication::alert(ICore::mainWindow(), 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindEngine::runnerFinished()
|
void ValgrindRunControl::runnerFinished()
|
||||||
{
|
{
|
||||||
emit outputReceived(tr("** Analyzing finished **\n"), NormalMessageFormat);
|
appendMessage(tr("** Analyzing finished **\n"), NormalMessageFormat);
|
||||||
emit finished();
|
emit finished();
|
||||||
|
|
||||||
m_progress->reportFinished();
|
m_progress->reportFinished();
|
||||||
@@ -159,7 +159,7 @@ void ValgrindEngine::runnerFinished()
|
|||||||
this, SLOT(runnerFinished()));
|
this, SLOT(runnerFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindEngine::receiveProcessOutput(const QByteArray &output, OutputFormat format)
|
void ValgrindRunControl::receiveProcessOutput(const QByteArray &output, OutputFormat format)
|
||||||
{
|
{
|
||||||
int progress = m_progress->progressValue();
|
int progress = m_progress->progressValue();
|
||||||
if (progress < 5 * progressMaximum / 10)
|
if (progress < 5 * progressMaximum / 10)
|
||||||
@@ -167,21 +167,21 @@ void ValgrindEngine::receiveProcessOutput(const QByteArray &output, OutputFormat
|
|||||||
else if (progress < 9 * progressMaximum / 10)
|
else if (progress < 9 * progressMaximum / 10)
|
||||||
progress += progress / 1000;
|
progress += progress / 1000;
|
||||||
m_progress->setProgressValue(progress);
|
m_progress->setProgressValue(progress);
|
||||||
emit outputReceived(QString::fromLocal8Bit(output), format);
|
appendMessage(QString::fromLocal8Bit(output), format);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValgrindEngine::receiveProcessError(const QString &message, QProcess::ProcessError error)
|
void ValgrindRunControl::receiveProcessError(const QString &message, QProcess::ProcessError error)
|
||||||
{
|
{
|
||||||
if (error == QProcess::FailedToStart) {
|
if (error == QProcess::FailedToStart) {
|
||||||
const QString &valgrind = m_settings->subConfig<ValgrindBaseSettings>()->valgrindExecutable();
|
const QString &valgrind = m_settings->subConfig<ValgrindBaseSettings>()->valgrindExecutable();
|
||||||
if (!valgrind.isEmpty())
|
if (!valgrind.isEmpty())
|
||||||
emit outputReceived(tr("** Error: \"%1\" could not be started: %2 **\n").arg(valgrind).arg(message), ErrorMessageFormat);
|
appendMessage(tr("** Error: \"%1\" could not be started: %2 **\n").arg(valgrind).arg(message), ErrorMessageFormat);
|
||||||
else
|
else
|
||||||
emit outputReceived(tr("** Error: no valgrind executable set **\n"), ErrorMessageFormat);
|
appendMessage(tr("** Error: no valgrind executable set **\n"), ErrorMessageFormat);
|
||||||
} else if (m_isStopping && error == QProcess::Crashed) { // process gets killed on stop
|
} else if (m_isStopping && error == QProcess::Crashed) { // process gets killed on stop
|
||||||
emit outputReceived(tr("** Process Terminated **\n"), ErrorMessageFormat);
|
appendMessage(tr("** Process Terminated **\n"), ErrorMessageFormat);
|
||||||
} else {
|
} else {
|
||||||
emit outputReceived(QString::fromLatin1("** %1 **\n").arg(message), ErrorMessageFormat);
|
appendMessage(QString::fromLatin1("** %1 **\n").arg(message), ErrorMessageFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_isStopping)
|
if (m_isStopping)
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#ifndef VALGRINDENGINE_H
|
#ifndef VALGRINDENGINE_H
|
||||||
#define VALGRINDENGINE_H
|
#define VALGRINDENGINE_H
|
||||||
|
|
||||||
#include <analyzerbase/ianalyzerengine.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <valgrind/valgrindrunner.h>
|
#include <valgrind/valgrindrunner.h>
|
||||||
|
|
||||||
@@ -43,17 +43,17 @@ namespace Analyzer { class AnalyzerSettings; }
|
|||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ValgrindEngine : public Analyzer::IAnalyzerEngine
|
class ValgrindRunControl : public Analyzer::AnalyzerRunControl
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ValgrindEngine(const Analyzer::AnalyzerStartParameters &sp,
|
ValgrindRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration);
|
||||||
~ValgrindEngine();
|
~ValgrindRunControl();
|
||||||
|
|
||||||
bool start();
|
bool startEngine();
|
||||||
void stop();
|
void stopEngine();
|
||||||
|
|
||||||
QString executable() const;
|
QString executable() const;
|
||||||
|
|
||||||
|
@@ -75,7 +75,8 @@ static void startRemoteTool(IAnalyzerTool *tool)
|
|||||||
sp.displayName = dlg.executable();
|
sp.displayName = dlg.executable();
|
||||||
sp.workingDirectory = dlg.workingDirectory();
|
sp.workingDirectory = dlg.workingDirectory();
|
||||||
|
|
||||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
//AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
||||||
|
AnalyzerRunControl *rc = tool->createRunControl(sp, 0);
|
||||||
//m_currentRunControl = rc;
|
//m_currentRunControl = rc;
|
||||||
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
||||||
|
|
||||||
|
@@ -122,8 +122,7 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
|
|||||||
AnalyzerStartParameters sp = createValgrindStartParameters(runConfiguration);
|
AnalyzerStartParameters sp = createValgrindStartParameters(runConfiguration);
|
||||||
sp.toolId = tool->id();
|
sp.toolId = tool->id();
|
||||||
|
|
||||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
|
return tool->createRunControl(sp, runConfiguration);
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IRunConfigurationAspect *ValgrindRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc)
|
IRunConfigurationAspect *ValgrindRunControlFactory::createRunConfigurationAspect(RunConfiguration *rc)
|
||||||
|
Reference in New Issue
Block a user