forked from qt-creator/qt-creator
analyzer: move convenience factory back to base plugin
Change-Id: Ife82b74ce4b457dd9e6a6cc3749cb629aeeacf58 Reviewed-on: http://codereview.qt.nokia.com/1086 Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
This commit is contained in:
@@ -42,6 +42,8 @@
|
|||||||
#include "analyzerutils.h"
|
#include "analyzerutils.h"
|
||||||
#include "ianalyzertool.h"
|
#include "ianalyzertool.h"
|
||||||
|
|
||||||
|
#include "startremotedialog.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/findplaceholder.h>
|
#include <coreplugin/findplaceholder.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -846,11 +848,6 @@ void AnalyzerManager::stopTool()
|
|||||||
stopAction()->trigger();
|
stopAction()->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnalyzerManager::startLocalTool(IAnalyzerTool *tool, StartMode mode)
|
|
||||||
{
|
|
||||||
m_instance->d->startLocalTool(tool, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
QAction *AnalyzerManager::stopAction()
|
QAction *AnalyzerManager::stopAction()
|
||||||
{
|
{
|
||||||
return m_instance->d->m_stopAction;
|
return m_instance->d->m_stopAction;
|
||||||
@@ -870,6 +867,36 @@ IAnalyzerTool *AnalyzerManager::toolFromId(const QByteArray &id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
|
||||||
|
{
|
||||||
|
StartRemoteDialog dlg;
|
||||||
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AnalyzerStartParameters sp;
|
||||||
|
sp.toolId = tool->id();
|
||||||
|
sp.startMode = mode;
|
||||||
|
sp.connParams = dlg.sshParams();
|
||||||
|
sp.debuggee = dlg.executable();
|
||||||
|
sp.debuggeeArgs = dlg.arguments();
|
||||||
|
sp.displayName = dlg.executable();
|
||||||
|
sp.workingDirectory = dlg.workingDirectory();
|
||||||
|
|
||||||
|
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
||||||
|
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
||||||
|
|
||||||
|
ProjectExplorer::ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalyzerManager::defaultStartTool(IAnalyzerTool *tool, StartMode mode)
|
||||||
|
{
|
||||||
|
if (mode == StartLocal)
|
||||||
|
m_instance->d->startLocalTool(tool, mode);
|
||||||
|
if (mode == StartRemote)
|
||||||
|
startRemoteTool(tool, mode);
|
||||||
|
// m_instance->d->startRemoteTool(tool, mode);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
|
||||||
#include "analyzermanager.moc"
|
#include "analyzermanager.moc"
|
||||||
|
@@ -84,7 +84,8 @@ public:
|
|||||||
static void stopTool();
|
static void stopTool();
|
||||||
|
|
||||||
// Convenience functions.
|
// Convenience functions.
|
||||||
static void startLocalTool(IAnalyzerTool *tool, StartMode mode);
|
//static void startLocalTool(IAnalyzerTool *tool, StartMode mode);
|
||||||
|
static void defaultStartTool(IAnalyzerTool *tool, StartMode mode);
|
||||||
|
|
||||||
static QString msgToolStarted(const QString &name);
|
static QString msgToolStarted(const QString &name);
|
||||||
static QString msgToolFinished(const QString &name, int issuesFound);
|
static QString msgToolFinished(const QString &name, int issuesFound);
|
||||||
|
@@ -33,8 +33,14 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "analyzerplugin.h"
|
#include "analyzerplugin.h"
|
||||||
|
|
||||||
#include "analyzerconstants.h"
|
#include "analyzerconstants.h"
|
||||||
#include "analyzermanager.h"
|
#include "analyzermanager.h"
|
||||||
|
#include "analyzerruncontrol.h"
|
||||||
|
#include "analyzersettings.h"
|
||||||
|
#include "analyzerstartparameters.h"
|
||||||
|
#include "analyzerrunconfigwidget.h"
|
||||||
|
#include "startremotedialog.h"
|
||||||
#include "ianalyzertool.h"
|
#include "ianalyzertool.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -43,19 +49,152 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
|
#include <projectexplorer/applicationrunconfiguration.h>
|
||||||
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/task.h>
|
#include <projectexplorer/task.h>
|
||||||
#include <projectexplorer/taskhub.h>
|
#include <projectexplorer/taskhub.h>
|
||||||
|
|
||||||
|
#include <remotelinux/linuxdeviceconfiguration.h>
|
||||||
|
#include <remotelinux/remotelinuxrunconfiguration.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QtPlugin>
|
#include <QtCore/QtPlugin>
|
||||||
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
|
||||||
using namespace Analyzer;
|
using namespace Analyzer;
|
||||||
using namespace Analyzer::Internal;
|
using namespace Analyzer::Internal;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
static AnalyzerPlugin *m_instance = 0;
|
static AnalyzerPlugin *m_instance = 0;
|
||||||
|
|
||||||
|
namespace Analyzer {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// AnalyzerRunControlFactory
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static AnalyzerStartParameters localStartParameters(RunConfiguration *runConfiguration)
|
||||||
|
{
|
||||||
|
AnalyzerStartParameters sp;
|
||||||
|
QTC_ASSERT(runConfiguration, return sp);
|
||||||
|
LocalApplicationRunConfiguration *rc =
|
||||||
|
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
||||||
|
QTC_ASSERT(rc, return sp);
|
||||||
|
|
||||||
|
sp.startMode = StartLocal;
|
||||||
|
sp.environment = rc->environment();
|
||||||
|
sp.workingDirectory = rc->workingDirectory();
|
||||||
|
sp.debuggee = rc->executable();
|
||||||
|
sp.debuggeeArgs = rc->commandLineArguments();
|
||||||
|
sp.displayName = rc->displayName();
|
||||||
|
sp.connParams.host = QLatin1String("localhost");
|
||||||
|
sp.connParams.port = rc->qmlDebugServerPort();
|
||||||
|
return sp;
|
||||||
|
}
|
||||||
|
|
||||||
|
static AnalyzerStartParameters remoteLinuxStartParameters(RunConfiguration *runConfiguration)
|
||||||
|
{
|
||||||
|
AnalyzerStartParameters sp;
|
||||||
|
RemoteLinux::RemoteLinuxRunConfiguration * const rc
|
||||||
|
= qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration);
|
||||||
|
QTC_ASSERT(rc, return sp);
|
||||||
|
|
||||||
|
sp.startMode = StartRemote;
|
||||||
|
sp.debuggee = rc->remoteExecutableFilePath();
|
||||||
|
sp.debuggeeArgs = rc->arguments();
|
||||||
|
sp.connParams = rc->deviceConfig()->sshParameters();
|
||||||
|
sp.analyzerCmdPrefix = rc->commandPrefix();
|
||||||
|
sp.displayName = rc->displayName();
|
||||||
|
return sp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class AnalyzerRunControlFactory : public ProjectExplorer::IRunControlFactory
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
AnalyzerRunControlFactory(QObject *parent = 0);
|
||||||
|
|
||||||
|
typedef ProjectExplorer::RunConfiguration RunConfiguration;
|
||||||
|
typedef ProjectExplorer::RunControl RunControl;
|
||||||
|
|
||||||
|
// IRunControlFactory
|
||||||
|
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
|
||||||
|
RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
|
||||||
|
QString displayName() const;
|
||||||
|
|
||||||
|
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
|
||||||
|
ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
|
||||||
|
};
|
||||||
|
|
||||||
|
AnalyzerRunControlFactory::AnalyzerRunControlFactory(QObject *parent)
|
||||||
|
: IRunControlFactory(parent)
|
||||||
|
{
|
||||||
|
setObjectName(QLatin1String("AnalyzerRunControlFactory"));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(runConfiguration);
|
||||||
|
// FIXME: This is not generic.
|
||||||
|
return mode.startsWith("Callgrind") || mode.startsWith("Memcheck") || mode == "QmlProfiler";
|
||||||
|
}
|
||||||
|
|
||||||
|
RunControl *AnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||||
|
|
||||||
|
AnalyzerStartParameters sp;
|
||||||
|
if (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||||
|
sp = localStartParameters(runConfiguration);
|
||||||
|
} else if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||||
|
sp = remoteLinuxStartParameters(runConfiguration);
|
||||||
|
} else {
|
||||||
|
// Might be S60DeviceRunfiguration, or something else ...
|
||||||
|
//sp.startMode = StartRemote;
|
||||||
|
sp.startMode = StartRemote;
|
||||||
|
}
|
||||||
|
|
||||||
|
IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1());
|
||||||
|
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
|
||||||
|
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
||||||
|
//m_isRunning = true;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AnalyzerRunControlFactory::displayName() const
|
||||||
|
{
|
||||||
|
return tr("Analyzer");
|
||||||
|
}
|
||||||
|
|
||||||
|
IRunConfigurationAspect *AnalyzerRunControlFactory::createRunConfigurationAspect()
|
||||||
|
{
|
||||||
|
return new AnalyzerProjectSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
RunConfigWidget *AnalyzerRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
|
||||||
|
{
|
||||||
|
LocalApplicationRunConfiguration *localRc =
|
||||||
|
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
||||||
|
if (!localRc)
|
||||||
|
return 0;
|
||||||
|
AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
|
||||||
|
if (!settings)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget;
|
||||||
|
ret->setRunConfiguration(runConfiguration);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -106,6 +245,9 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri
|
|||||||
//: Category under which Analyzer tasks are listed in build issues view
|
//: Category under which Analyzer tasks are listed in build issues view
|
||||||
hub->addCategory(QLatin1String(Constants::ANALYZERTASK_ID), tr("Analyzer"));
|
hub->addCategory(QLatin1String(Constants::ANALYZERTASK_ID), tr("Analyzer"));
|
||||||
|
|
||||||
|
AnalyzerRunControlFactory *factory = new AnalyzerRunControlFactory();
|
||||||
|
addAutoReleasedObject(factory);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,4 +267,9 @@ AnalyzerPlugin *AnalyzerPlugin::instance()
|
|||||||
return m_instance;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Analyzer
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(AnalyzerPlugin)
|
Q_EXPORT_PLUGIN(AnalyzerPlugin)
|
||||||
|
|
||||||
|
#include "analyzerplugin.moc"
|
||||||
|
@@ -64,4 +64,9 @@ QString IAnalyzerTool::defaultActionName(const IAnalyzerTool *tool, StartMode mo
|
|||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IAnalyzerTool::defaultStartTool(IAnalyzerTool *tool, StartMode mode)
|
||||||
|
{
|
||||||
|
AnalyzerManager::defaultStartTool(tool, mode);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
@@ -105,6 +105,7 @@ public:
|
|||||||
static QByteArray defaultMenuGroup(StartMode mode);
|
static QByteArray defaultMenuGroup(StartMode mode);
|
||||||
static QByteArray defaultActionId(const IAnalyzerTool *tool, StartMode mode);
|
static QByteArray defaultActionId(const IAnalyzerTool *tool, StartMode mode);
|
||||||
static QString defaultActionName(const IAnalyzerTool *tool, StartMode mode);
|
static QString defaultActionName(const IAnalyzerTool *tool, StartMode mode);
|
||||||
|
static void defaultStartTool(IAnalyzerTool *tool, StartMode mode);
|
||||||
|
|
||||||
/// This gets called after all analyzation tools where initialized.
|
/// This gets called after all analyzation tools where initialized.
|
||||||
virtual void extensionsInitialized() = 0;
|
virtual void extensionsInitialized() = 0;
|
||||||
@@ -124,7 +125,7 @@ public:
|
|||||||
virtual IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp,
|
virtual IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0;
|
ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0;
|
||||||
|
|
||||||
virtual void startTool(StartMode mode) = 0;
|
virtual void startTool(StartMode mode) { defaultStartTool(this, mode); }
|
||||||
|
|
||||||
/// Called when tools gets selected.
|
/// Called when tools gets selected.
|
||||||
virtual void toolSelected() const {}
|
virtual void toolSelected() const {}
|
||||||
|
@@ -537,11 +537,3 @@ void QmlProfilerTool::updateRecordingState()
|
|||||||
if (d->m_traceWindow->isRecording())
|
if (d->m_traceWindow->isRecording())
|
||||||
clearDisplay();
|
clearDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerTool::startTool(StartMode mode)
|
|
||||||
{
|
|
||||||
if (mode == StartLocal)
|
|
||||||
AnalyzerManager::startLocalTool(this, mode);
|
|
||||||
if (mode == StartRemote)
|
|
||||||
AnalyzerManager::startLocalTool(this, mode);
|
|
||||||
}
|
|
||||||
|
@@ -62,7 +62,6 @@ public:
|
|||||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||||
|
|
||||||
QWidget *createControlWidget();
|
QWidget *createControlWidget();
|
||||||
void startTool(Analyzer::StartMode mode);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void connectClient(int port);
|
void connectClient(int port);
|
||||||
|
@@ -680,11 +680,6 @@ IAnalyzerEngine *CallgrindToolPrivate::createEngine(const AnalyzerStartParameter
|
|||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallgrindTool::startTool(StartMode mode)
|
|
||||||
{
|
|
||||||
ValgrindPlugin::startValgrindTool(this, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *CallgrindTool::createControlWidget()
|
QWidget *CallgrindTool::createControlWidget()
|
||||||
{
|
{
|
||||||
return d->createControlWidget();
|
return d->createControlWidget();
|
||||||
|
@@ -60,8 +60,6 @@ public:
|
|||||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||||
QWidget *createControlWidget();
|
QWidget *createControlWidget();
|
||||||
|
|
||||||
void startTool(Analyzer::StartMode mode);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CallgrindToolPrivate *d;
|
CallgrindToolPrivate *d;
|
||||||
};
|
};
|
||||||
|
@@ -467,11 +467,6 @@ IAnalyzerEngine *MemcheckTool::createEngine(const AnalyzerStartParameters &sp,
|
|||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemcheckTool::startTool(StartMode mode)
|
|
||||||
{
|
|
||||||
ValgrindPlugin::startValgrindTool(this, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
|
void MemcheckTool::engineStarting(const IAnalyzerEngine *engine)
|
||||||
{
|
{
|
||||||
clearErrorView();
|
clearErrorView();
|
||||||
|
@@ -118,7 +118,6 @@ private:
|
|||||||
|
|
||||||
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
|
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||||
void startTool(Analyzer::StartMode mode);
|
|
||||||
|
|
||||||
void clearErrorView();
|
void clearErrorView();
|
||||||
|
|
||||||
|
@@ -42,17 +42,6 @@
|
|||||||
|
|
||||||
#include <analyzerbase/analyzerconstants.h>
|
#include <analyzerbase/analyzerconstants.h>
|
||||||
#include <analyzerbase/analyzermanager.h>
|
#include <analyzerbase/analyzermanager.h>
|
||||||
#include <analyzerbase/analyzerrunconfigwidget.h>
|
|
||||||
#include <analyzerbase/analyzerruncontrol.h>
|
|
||||||
#include <analyzerbase/analyzersettings.h>
|
|
||||||
#include <analyzerbase/analyzerstartparameters.h>
|
|
||||||
#include <analyzerbase/startremotedialog.h>
|
|
||||||
|
|
||||||
#include <projectexplorer/applicationrunconfiguration.h>
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
|
||||||
|
|
||||||
#include <remotelinux/linuxdeviceconfiguration.h>
|
|
||||||
#include <remotelinux/remotelinuxrunconfiguration.h>
|
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -62,168 +51,16 @@
|
|||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
|
|
||||||
using namespace Analyzer;
|
using namespace Analyzer;
|
||||||
using namespace Valgrind::Internal;
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// ValgrindRunControlFactory
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static AnalyzerStartParameters localStartParameters(RunConfiguration *runConfiguration)
|
|
||||||
{
|
|
||||||
AnalyzerStartParameters sp;
|
|
||||||
QTC_ASSERT(runConfiguration, return sp);
|
|
||||||
LocalApplicationRunConfiguration *rc =
|
|
||||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
|
||||||
QTC_ASSERT(rc, return sp);
|
|
||||||
|
|
||||||
sp.startMode = StartLocal;
|
|
||||||
sp.environment = rc->environment();
|
|
||||||
sp.workingDirectory = rc->workingDirectory();
|
|
||||||
sp.debuggee = rc->executable();
|
|
||||||
sp.debuggeeArgs = rc->commandLineArguments();
|
|
||||||
sp.displayName = rc->displayName();
|
|
||||||
sp.connParams.host = QLatin1String("localhost");
|
|
||||||
sp.connParams.port = rc->qmlDebugServerPort();
|
|
||||||
return sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static AnalyzerStartParameters remoteLinuxStartParameters(RunConfiguration *runConfiguration)
|
|
||||||
{
|
|
||||||
AnalyzerStartParameters sp;
|
|
||||||
RemoteLinux::RemoteLinuxRunConfiguration * const rc
|
|
||||||
= qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration);
|
|
||||||
QTC_ASSERT(rc, return sp);
|
|
||||||
|
|
||||||
sp.startMode = StartRemote;
|
|
||||||
sp.debuggee = rc->remoteExecutableFilePath();
|
|
||||||
sp.debuggeeArgs = rc->arguments();
|
|
||||||
sp.connParams = rc->deviceConfig()->sshParameters();
|
|
||||||
sp.analyzerCmdPrefix = rc->commandPrefix();
|
|
||||||
sp.displayName = rc->displayName();
|
|
||||||
return sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ValgrindRunControlFactory: public ProjectExplorer::IRunControlFactory
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ValgrindRunControlFactory(QObject *parent = 0);
|
|
||||||
|
|
||||||
typedef ProjectExplorer::RunConfiguration RunConfiguration;
|
|
||||||
typedef ProjectExplorer::RunControl RunControl;
|
|
||||||
|
|
||||||
// IRunControlFactory
|
|
||||||
bool canRun(RunConfiguration *runConfiguration, const QString &mode) const;
|
|
||||||
RunControl *create(RunConfiguration *runConfiguration, const QString &mode);
|
|
||||||
QString displayName() const;
|
|
||||||
|
|
||||||
ProjectExplorer::IRunConfigurationAspect *createRunConfigurationAspect();
|
|
||||||
ProjectExplorer::RunConfigWidget *createConfigurationWidget(RunConfiguration *runConfiguration);
|
|
||||||
};
|
|
||||||
|
|
||||||
ValgrindRunControlFactory::ValgrindRunControlFactory(QObject *parent)
|
|
||||||
: IRunControlFactory(parent)
|
|
||||||
{
|
|
||||||
setObjectName(QLatin1String("ValgrindRunControlFactory"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ValgrindRunControlFactory::canRun(RunConfiguration *runConfiguration, const QString &mode) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(runConfiguration);
|
|
||||||
return mode.startsWith("Callgrind") || mode.startsWith("Memcheck");
|
|
||||||
}
|
|
||||||
|
|
||||||
RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration, const QString &mode)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
|
||||||
|
|
||||||
AnalyzerStartParameters sp;
|
|
||||||
if (qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(runConfiguration)) {
|
|
||||||
sp = localStartParameters(runConfiguration);
|
|
||||||
} else if (qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
|
||||||
sp = remoteLinuxStartParameters(runConfiguration);
|
|
||||||
} else {
|
|
||||||
// Might be S60DeviceRunfiguration, or something else ...
|
|
||||||
//sp.startMode = StartRemote;
|
|
||||||
sp.startMode = StartRemote;
|
|
||||||
}
|
|
||||||
|
|
||||||
IAnalyzerTool *tool = AnalyzerManager::toolFromId(mode.toLatin1());
|
|
||||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, runConfiguration);
|
|
||||||
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
|
||||||
//m_isRunning = true;
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ValgrindRunControlFactory::displayName() const
|
|
||||||
{
|
|
||||||
return tr("Analyzer");
|
|
||||||
}
|
|
||||||
|
|
||||||
IRunConfigurationAspect *ValgrindRunControlFactory::createRunConfigurationAspect()
|
|
||||||
{
|
|
||||||
return new AnalyzerProjectSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
RunConfigWidget *ValgrindRunControlFactory::createConfigurationWidget(RunConfiguration *runConfiguration)
|
|
||||||
{
|
|
||||||
LocalApplicationRunConfiguration *localRc =
|
|
||||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
|
||||||
if (!localRc)
|
|
||||||
return 0;
|
|
||||||
AnalyzerProjectSettings *settings = runConfiguration->extraAspect<AnalyzerProjectSettings>();
|
|
||||||
if (!settings)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
AnalyzerRunConfigWidget *ret = new AnalyzerRunConfigWidget;
|
|
||||||
ret->setRunConfiguration(runConfiguration);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// ValgrindPlugin
|
// ValgrindPlugin
|
||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
|
|
||||||
{
|
|
||||||
Q_UNUSED(tool);
|
|
||||||
StartRemoteDialog dlg;
|
|
||||||
if (dlg.exec() != QDialog::Accepted)
|
|
||||||
return;
|
|
||||||
|
|
||||||
AnalyzerStartParameters sp;
|
|
||||||
sp.toolId = tool->id();
|
|
||||||
sp.startMode = mode;
|
|
||||||
sp.connParams = dlg.sshParams();
|
|
||||||
sp.debuggee = dlg.executable();
|
|
||||||
sp.debuggeeArgs = dlg.arguments();
|
|
||||||
sp.displayName = dlg.executable();
|
|
||||||
sp.workingDirectory = dlg.workingDirectory();
|
|
||||||
|
|
||||||
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
|
|
||||||
//m_currentRunControl = rc;
|
|
||||||
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
|
|
||||||
|
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->startRunControl(rc, tool->id());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ValgrindPlugin::startValgrindTool(IAnalyzerTool *tool, StartMode mode)
|
|
||||||
{
|
|
||||||
if (mode == StartLocal)
|
|
||||||
AnalyzerManager::startLocalTool(tool, mode);
|
|
||||||
if (mode == StartRemote)
|
|
||||||
startRemoteTool(tool, mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
static AbstractAnalyzerSubConfig *valgrindConfigFactory()
|
static AbstractAnalyzerSubConfig *valgrindConfigFactory()
|
||||||
{
|
{
|
||||||
@@ -265,9 +102,6 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
|||||||
AnalyzerManager::addTool(new MemcheckTool(this), modes);
|
AnalyzerManager::addTool(new MemcheckTool(this), modes);
|
||||||
AnalyzerManager::addTool(new CallgrindTool(this), modes);
|
AnalyzerManager::addTool(new CallgrindTool(this), modes);
|
||||||
|
|
||||||
ValgrindRunControlFactory *factory = new ValgrindRunControlFactory();
|
|
||||||
addAutoReleasedObject(factory);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +51,6 @@ public:
|
|||||||
virtual bool initialize(const QStringList &arguments, QString *errorString);
|
virtual bool initialize(const QStringList &arguments, QString *errorString);
|
||||||
virtual void extensionsInitialized() {}
|
virtual void extensionsInitialized() {}
|
||||||
|
|
||||||
static void startValgrindTool(Analyzer::IAnalyzerTool *tool, Analyzer::StartMode mode);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user