forked from qt-creator/qt-creator
Analyzer: Slim down AnalyzerStartParameters
* SysRoot can always be determined from kit. * Pass around RunMode as extra parameter not as part of AnalyzerStartParameters. That's closer to the pattern used elsewhere. * Environment was always initialized from the runconfig's EnvironmentAspect. The tools can do that directly. * Provide setter for display name for cases where it is not equal to RunConfiguration::displayName Change-Id: I811a0d7cdeb55cc37a16a593b3942abb567a2150 Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
This commit is contained in:
@@ -715,12 +715,11 @@ void AnalyzerManager::handleToolFinished()
|
|||||||
d->handleToolFinished();
|
d->handleToolFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerRunControl *AnalyzerManager::createRunControl(
|
AnalyzerRunControl *AnalyzerManager::createRunControl(const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration, Id runMode)
|
||||||
const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
|
|
||||||
{
|
{
|
||||||
foreach (AnalyzerAction *action, d->m_actions) {
|
foreach (AnalyzerAction *action, d->m_actions) {
|
||||||
if (action->runMode() == sp.runMode)
|
if (action->runMode() == runMode)
|
||||||
return action->runControlCreator()(sp, runConfiguration);
|
return action->runControlCreator()(sp, runConfiguration, runMode);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -34,9 +34,7 @@
|
|||||||
|
|
||||||
#include "analyzerbase_global.h"
|
#include "analyzerbase_global.h"
|
||||||
|
|
||||||
#include <coreplugin/id.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
@@ -44,7 +42,6 @@ class QAction;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Utils { class FancyMainWindow; }
|
namespace Utils { class FancyMainWindow; }
|
||||||
namespace ProjectExplorer { class RunConfiguration; }
|
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
@@ -86,7 +83,7 @@ public:
|
|||||||
static QAction *stopAction();
|
static QAction *stopAction();
|
||||||
|
|
||||||
static AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp,
|
static AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration, Core::Id runMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
@@ -35,6 +35,10 @@
|
|||||||
#include "analyzermanager.h"
|
#include "analyzermanager.h"
|
||||||
#include "analyzerstartparameters.h"
|
#include "analyzerstartparameters.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/project.h>
|
||||||
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
@@ -49,11 +53,18 @@ using namespace ProjectExplorer;
|
|||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
|
AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration, Core::Id runMode)
|
||||||
: RunControl(runConfiguration, sp.runMode)
|
: RunControl(runConfiguration, runMode)
|
||||||
{
|
{
|
||||||
setIcon(Icons::ANALYZER_CONTROL_START);
|
setIcon(Icons::ANALYZER_CONTROL_START);
|
||||||
|
|
||||||
|
if (runConfiguration) {
|
||||||
|
m_displayName = runConfiguration->displayName();
|
||||||
|
if (auto aspect = runConfiguration->extraAspect<WorkingDirectoryAspect>())
|
||||||
|
m_workingDirectory = aspect->workingDirectory().toString();
|
||||||
|
if (m_workingDirectory.isEmpty())
|
||||||
|
m_workingDirectory = runConfiguration->target()->project()->projectDirectory().toString();
|
||||||
|
}
|
||||||
m_sp = sp;
|
m_sp = sp;
|
||||||
|
|
||||||
connect(this, &AnalyzerRunControl::finished,
|
connect(this, &AnalyzerRunControl::finished,
|
||||||
@@ -74,6 +85,11 @@ void AnalyzerRunControl::runControlFinished()
|
|||||||
AnalyzerManager::handleToolFinished();
|
AnalyzerManager::handleToolFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AnalyzerRunControl::workingDirectory() const
|
||||||
|
{
|
||||||
|
return m_workingDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
void AnalyzerRunControl::start()
|
void AnalyzerRunControl::start()
|
||||||
{
|
{
|
||||||
AnalyzerManager::handleToolStarted();
|
AnalyzerManager::handleToolStarted();
|
||||||
@@ -101,7 +117,17 @@ bool AnalyzerRunControl::isRunning() const
|
|||||||
|
|
||||||
QString AnalyzerRunControl::displayName() const
|
QString AnalyzerRunControl::displayName() const
|
||||||
{
|
{
|
||||||
return m_sp.displayName;
|
return m_displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalyzerRunControl::setDisplayName(const QString &displayName)
|
||||||
|
{
|
||||||
|
m_displayName = displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalyzerRunControl::setWorkingDirectory(const QString &workingDirectory)
|
||||||
|
{
|
||||||
|
m_workingDirectory = workingDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
@@ -32,16 +32,12 @@
|
|||||||
#ifndef ANALYZERRUNCONTROL_H
|
#ifndef ANALYZERRUNCONTROL_H
|
||||||
#define ANALYZERRUNCONTROL_H
|
#define ANALYZERRUNCONTROL_H
|
||||||
|
|
||||||
#include "analyzerbase_global.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
|
||||||
|
|
||||||
#include "analyzerstartparameters.h"
|
#include "analyzerstartparameters.h"
|
||||||
|
|
||||||
#include <utils/outputformat.h>
|
#include <projectexplorer/applicationlauncher.h>
|
||||||
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <utils/outputformat.h>
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
@@ -56,7 +52,8 @@ class ANALYZER_EXPORT AnalyzerRunControl : public ProjectExplorer::RunControl
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
AnalyzerRunControl(const AnalyzerStartParameters &sp,
|
AnalyzerRunControl(const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration,
|
||||||
|
Core::Id runMode);
|
||||||
|
|
||||||
/// Start analyzation process.
|
/// Start analyzation process.
|
||||||
virtual bool startEngine() = 0;
|
virtual bool startEngine() = 0;
|
||||||
@@ -74,14 +71,16 @@ public:
|
|||||||
virtual void notifyRemoteSetupDone(quint16) {}
|
virtual void notifyRemoteSetupDone(quint16) {}
|
||||||
virtual void notifyRemoteFinished() {}
|
virtual void notifyRemoteFinished() {}
|
||||||
|
|
||||||
bool m_isRunning;
|
|
||||||
|
|
||||||
// ProjectExplorer::RunControl
|
// ProjectExplorer::RunControl
|
||||||
void start();
|
void start();
|
||||||
StopResult stop();
|
StopResult stop();
|
||||||
bool isRunning() const;
|
bool isRunning() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
|
|
||||||
|
void setDisplayName(const QString &displayName);
|
||||||
|
QString workingDirectory() const;
|
||||||
|
void setWorkingDirectory(const QString &workingDirectory);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void logApplicationMessage(const QString &, Utils::OutputFormat) {}
|
virtual void logApplicationMessage(const QString &, Utils::OutputFormat) {}
|
||||||
|
|
||||||
@@ -95,6 +94,13 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool supportsReRunning() const { return false; }
|
bool supportsReRunning() const { return false; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool m_isRunning;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_displayName; // Default to runConfig->displayName, unless overridden by setDisplayName
|
||||||
|
QString m_workingDirectory;
|
||||||
AnalyzerStartParameters m_sp;
|
AnalyzerStartParameters m_sp;
|
||||||
};
|
};
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
@@ -34,33 +34,21 @@
|
|||||||
#include "analyzerbase_global.h"
|
#include "analyzerbase_global.h"
|
||||||
#include "analyzerconstants.h"
|
#include "analyzerconstants.h"
|
||||||
|
|
||||||
#include <QMetaType>
|
|
||||||
|
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <ssh/sshconnection.h>
|
#include <ssh/sshconnection.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <projectexplorer/applicationlauncher.h>
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <QMetaType>
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
// Note: This is part of the "soft interface" of the analyzer plugin.
|
|
||||||
// Do not add anything that needs implementation in a .cpp file.
|
|
||||||
|
|
||||||
class ANALYZER_EXPORT AnalyzerStartParameters
|
class ANALYZER_EXPORT AnalyzerStartParameters
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Core::Id runMode = ProjectExplorer::Constants::NO_RUN_MODE;
|
|
||||||
QSsh::SshConnectionParameters connParams;
|
QSsh::SshConnectionParameters connParams;
|
||||||
ProjectExplorer::ApplicationLauncher::Mode localRunMode
|
|
||||||
= ProjectExplorer::ApplicationLauncher::Gui;
|
|
||||||
|
|
||||||
QString debuggee;
|
QString debuggee;
|
||||||
QString debuggeeArgs;
|
QString debuggeeArgs;
|
||||||
QString displayName;
|
|
||||||
Utils::Environment environment;
|
|
||||||
QString workingDirectory;
|
|
||||||
QString sysroot;
|
|
||||||
QString analyzerHost;
|
QString analyzerHost;
|
||||||
QString analyzerSocket;
|
QString analyzerSocket;
|
||||||
quint16 analyzerPort = 0;
|
quint16 analyzerPort = 0;
|
||||||
@@ -68,6 +56,4 @@ public:
|
|||||||
|
|
||||||
} // namespace Analyzer
|
} // namespace Analyzer
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Analyzer::AnalyzerStartParameters)
|
|
||||||
|
|
||||||
#endif // ANALYZERSTARTPARAMETERS_H
|
#endif // ANALYZERSTARTPARAMETERS_H
|
||||||
|
@@ -104,8 +104,8 @@ 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.
|
||||||
typedef std::function<AnalyzerRunControl *(const AnalyzerStartParameters &sp,
|
typedef std::function<AnalyzerRunControl *(const AnalyzerStartParameters &,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration)> RunControlCreator;
|
ProjectExplorer::RunConfiguration *runConfiguration, Core::Id runMode)> RunControlCreator;
|
||||||
RunControlCreator runControlCreator() const { return m_runControlCreator; }
|
RunControlCreator runControlCreator() const { return m_runControlCreator; }
|
||||||
void setRunControlCreator(const RunControlCreator &creator) { m_runControlCreator = creator; }
|
void setRunControlCreator(const RunControlCreator &creator) { m_runControlCreator = creator; }
|
||||||
|
|
||||||
|
@@ -56,11 +56,6 @@ RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfigurati
|
|||||||
{
|
{
|
||||||
Target *target = runConfig->target();
|
Target *target = runConfig->target();
|
||||||
AnalyzerStartParameters params;
|
AnalyzerStartParameters params;
|
||||||
params.runMode = runMode;
|
|
||||||
params.displayName = AndroidManager::packageName(target);
|
|
||||||
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
|
|
||||||
// TODO: Not sure if these are the right paths.
|
|
||||||
params.workingDirectory = target->project()->projectDirectory().toString();
|
|
||||||
if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
|
if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
|
||||||
QTcpServer server;
|
QTcpServer server;
|
||||||
QTC_ASSERT(server.listen(QHostAddress::LocalHost)
|
QTC_ASSERT(server.listen(QHostAddress::LocalHost)
|
||||||
@@ -68,8 +63,11 @@ RunControl *AndroidAnalyzeSupport::createAnalyzeRunControl(AndroidRunConfigurati
|
|||||||
params.analyzerHost = server.serverAddress().toString();
|
params.analyzerHost = server.serverAddress().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerRunControl *analyzerRunControl = AnalyzerManager::createRunControl(params, runConfig);
|
AnalyzerRunControl *analyzerRunControl = AnalyzerManager::createRunControl(params, runConfig, runMode);
|
||||||
|
if (analyzerRunControl) {
|
||||||
|
analyzerRunControl->setDisplayName(AndroidManager::packageName(target));
|
||||||
(void) new AndroidAnalyzeSupport(runConfig, analyzerRunControl);
|
(void) new AndroidAnalyzeSupport(runConfig, analyzerRunControl);
|
||||||
|
}
|
||||||
return analyzerRunControl;
|
return analyzerRunControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,8 +41,8 @@
|
|||||||
#include <projectexplorer/runconfigurationaspects.h>
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <utils/pathchooser.h>
|
|
||||||
#include <utils/detailswidget.h>
|
#include <utils/detailswidget.h>
|
||||||
|
#include <utils/pathchooser.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
|
@@ -80,8 +80,6 @@ RunControl *IosAnalyzeSupport::createAnalyzeRunControl(IosRunConfiguration *runC
|
|||||||
if (device.isNull())
|
if (device.isNull())
|
||||||
return 0;
|
return 0;
|
||||||
AnalyzerStartParameters params;
|
AnalyzerStartParameters params;
|
||||||
params.runMode = ProjectExplorer::Constants::QML_PROFILER_RUN_MODE;
|
|
||||||
params.sysroot = SysRootKitInformation::sysRoot(target->kit()).toString();
|
|
||||||
params.debuggee = runConfig->localExecutable().toUserOutput();
|
params.debuggee = runConfig->localExecutable().toUserOutput();
|
||||||
params.debuggeeArgs = Utils::QtcProcess::joinArgs(runConfig->commandLineArguments());
|
params.debuggeeArgs = Utils::QtcProcess::joinArgs(runConfig->commandLineArguments());
|
||||||
params.analyzerHost = QLatin1String("localhost");
|
params.analyzerHost = QLatin1String("localhost");
|
||||||
@@ -90,9 +88,10 @@ RunControl *IosAnalyzeSupport::createAnalyzeRunControl(IosRunConfiguration *runC
|
|||||||
if (iosDevice.isNull())
|
if (iosDevice.isNull())
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
params.displayName = runConfig->applicationName();
|
AnalyzerRunControl *analyzerRunControl =
|
||||||
|
AnalyzerManager::createRunControl(params, runConfig, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
AnalyzerRunControl *analyzerRunControl = AnalyzerManager::createRunControl(params, runConfig);
|
if (analyzerRunControl)
|
||||||
|
analyzerRunControl->setDisplayName(runConfig->applicationName());
|
||||||
(void) new IosAnalyzeSupport(runConfig, analyzerRunControl, false, true);
|
(void) new IosAnalyzeSupport(runConfig, analyzerRunControl, false, true);
|
||||||
return analyzerRunControl;
|
return analyzerRunControl;
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ Analyzer::AnalyzerRunControl *LocalQmlProfilerRunner::createLocalRunControl(
|
|||||||
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
|
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
|
||||||
|
|
||||||
Analyzer::AnalyzerRunControl *rc = Analyzer::AnalyzerManager::createRunControl(
|
Analyzer::AnalyzerRunControl *rc = Analyzer::AnalyzerManager::createRunControl(
|
||||||
sp, runConfiguration);
|
sp, runConfiguration, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
QmlProfilerRunControl *engine = qobject_cast<QmlProfilerRunControl *>(rc);
|
QmlProfilerRunControl *engine = qobject_cast<QmlProfilerRunControl *>(rc);
|
||||||
if (!engine) {
|
if (!engine) {
|
||||||
delete rc;
|
delete rc;
|
||||||
@@ -70,9 +70,10 @@ Analyzer::AnalyzerRunControl *LocalQmlProfilerRunner::createLocalRunControl(
|
|||||||
Configuration conf;
|
Configuration conf;
|
||||||
conf.executable = sp.debuggee;
|
conf.executable = sp.debuggee;
|
||||||
conf.executableArguments = sp.debuggeeArgs;
|
conf.executableArguments = sp.debuggeeArgs;
|
||||||
conf.workingDirectory = sp.workingDirectory;
|
conf.workingDirectory = rc->workingDirectory();
|
||||||
conf.environment = sp.environment;
|
|
||||||
conf.socket = sp.analyzerSocket;
|
conf.socket = sp.analyzerSocket;
|
||||||
|
if (EnvironmentAspect *environment = runConfiguration->extraAspect<EnvironmentAspect>())
|
||||||
|
conf.environment = environment->environment();
|
||||||
conf.port = sp.analyzerPort;
|
conf.port = sp.analyzerPort;
|
||||||
|
|
||||||
if (conf.executable.isEmpty()) {
|
if (conf.executable.isEmpty()) {
|
||||||
|
@@ -60,7 +60,7 @@ bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorS
|
|||||||
auto tool = new QmlProfilerTool(this);
|
auto tool = new QmlProfilerTool(this);
|
||||||
auto widgetCreator = [tool] { return tool->createWidgets(); };
|
auto widgetCreator = [tool] { return tool->createWidgets(); };
|
||||||
auto runControlCreator = [tool](const AnalyzerStartParameters &sp,
|
auto runControlCreator = [tool](const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration) {
|
ProjectExplorer::RunConfiguration *runConfiguration, Core::Id) {
|
||||||
return tool->createRunControl(sp, runConfiguration);
|
return tool->createRunControl(sp, runConfiguration);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -66,12 +66,10 @@ namespace QmlProfiler {
|
|||||||
class QmlProfilerRunControl::QmlProfilerRunControlPrivate
|
class QmlProfilerRunControl::QmlProfilerRunControlPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlProfilerRunControlPrivate() : m_running(false) {}
|
QmlProfilerStateManager *m_profilerState = 0;
|
||||||
|
|
||||||
QmlProfilerStateManager *m_profilerState;
|
|
||||||
QTimer m_noDebugOutputTimer;
|
QTimer m_noDebugOutputTimer;
|
||||||
QmlDebug::QmlOutputParser m_outputParser;
|
QmlDebug::QmlOutputParser m_outputParser;
|
||||||
bool m_running;
|
bool m_running = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -79,11 +77,10 @@ public:
|
|||||||
//
|
//
|
||||||
|
|
||||||
QmlProfilerRunControl::QmlProfilerRunControl(const AnalyzerStartParameters &sp,
|
QmlProfilerRunControl::QmlProfilerRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration) :
|
RunConfiguration *runConfiguration)
|
||||||
AnalyzerRunControl(sp, runConfiguration), d(new QmlProfilerRunControlPrivate)
|
: AnalyzerRunControl(sp, runConfiguration, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
|
||||||
|
, d(new QmlProfilerRunControlPrivate)
|
||||||
{
|
{
|
||||||
d->m_profilerState = 0;
|
|
||||||
|
|
||||||
// Only wait 4 seconds for the 'Waiting for connection' on application output, then just try to connect
|
// Only wait 4 seconds for the 'Waiting for connection' on application output, then just try to connect
|
||||||
// (application output might be redirected / blocked)
|
// (application output might be redirected / blocked)
|
||||||
d->m_noDebugOutputTimer.setSingleShot(true);
|
d->m_noDebugOutputTimer.setSingleShot(true);
|
||||||
|
@@ -69,18 +69,12 @@ bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, Co
|
|||||||
static AnalyzerStartParameters createQmlProfilerStartParameters(RunConfiguration *runConfiguration)
|
static AnalyzerStartParameters createQmlProfilerStartParameters(RunConfiguration *runConfiguration)
|
||||||
{
|
{
|
||||||
AnalyzerStartParameters sp;
|
AnalyzerStartParameters sp;
|
||||||
EnvironmentAspect *environment = runConfiguration->extraAspect<EnvironmentAspect>();
|
|
||||||
|
|
||||||
// FIXME: This is only used to communicate the connParams settings.
|
// FIXME: This is only used to communicate the connParams settings.
|
||||||
LocalApplicationRunConfiguration *rc =
|
auto rc = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
||||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration);
|
|
||||||
QTC_ASSERT(rc, return sp);
|
QTC_ASSERT(rc, return sp);
|
||||||
if (environment)
|
|
||||||
sp.environment = environment->environment();
|
|
||||||
sp.workingDirectory = rc->workingDirectory();
|
|
||||||
sp.debuggee = rc->executable();
|
sp.debuggee = rc->executable();
|
||||||
sp.debuggeeArgs = rc->commandLineArguments();
|
sp.debuggeeArgs = rc->commandLineArguments();
|
||||||
sp.displayName = rc->displayName();
|
|
||||||
|
|
||||||
const QtSupport::BaseQtVersion *version =
|
const QtSupport::BaseQtVersion *version =
|
||||||
QtSupport::QtKitInformation::qtVersion(runConfiguration->target()->kit());
|
QtSupport::QtKitInformation::qtVersion(runConfiguration->target()->kit());
|
||||||
@@ -103,7 +97,6 @@ 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;
|
|
||||||
return LocalQmlProfilerRunner::createLocalRunControl(runConfiguration, sp, errorMessage);
|
return LocalQmlProfilerRunner::createLocalRunControl(runConfiguration, sp, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -197,6 +197,15 @@ QmlProfilerTool::~QmlProfilerTool()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString sysroot(RunConfiguration *runConfig)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(runConfig, return QString());
|
||||||
|
Kit *k = runConfig->target()->kit();
|
||||||
|
if (k && SysRootKitInformation::hasSysRoot(k))
|
||||||
|
return SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParameters &sp,
|
AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration)
|
||||||
{
|
{
|
||||||
@@ -231,7 +240,7 @@ AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParamet
|
|||||||
projectDirectory = project->projectDirectory().toString();
|
projectDirectory = project->projectDirectory().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
populateFileFinder(projectDirectory, sp.sysroot);
|
populateFileFinder(projectDirectory, sysroot(runConfiguration));
|
||||||
|
|
||||||
if (sp.analyzerSocket.isEmpty())
|
if (sp.analyzerSocket.isEmpty())
|
||||||
connect(engine, &QmlProfilerRunControl::processRunning,
|
connect(engine, &QmlProfilerRunControl::processRunning,
|
||||||
@@ -242,15 +251,6 @@ AnalyzerRunControl *QmlProfilerTool::createRunControl(const AnalyzerStartParamet
|
|||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString sysroot(RunConfiguration *runConfig)
|
|
||||||
{
|
|
||||||
QTC_ASSERT(runConfig, return QString());
|
|
||||||
Kit *k = runConfig->target()->kit();
|
|
||||||
if (k && SysRootKitInformation::hasSysRoot(k))
|
|
||||||
return SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *QmlProfilerTool::createWidgets()
|
QWidget *QmlProfilerTool::createWidgets()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!d->m_viewContainer, return 0);
|
QTC_ASSERT(!d->m_viewContainer, return 0);
|
||||||
@@ -526,7 +526,6 @@ void QmlProfilerTool::startRemoteTool()
|
|||||||
sp.connParams = device->sshParameters();
|
sp.connParams = device->sshParameters();
|
||||||
sp.analyzerHost = device->qmlProfilerHost();
|
sp.analyzerHost = device->qmlProfilerHost();
|
||||||
}
|
}
|
||||||
sp.sysroot = SysRootKitInformation::sysRoot(kit).toString();
|
|
||||||
sp.analyzerPort = port;
|
sp.analyzerPort = port;
|
||||||
|
|
||||||
AnalyzerRunControl *rc = createRunControl(sp, 0);
|
AnalyzerRunControl *rc = createRunControl(sp, 0);
|
||||||
|
@@ -95,7 +95,7 @@ static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration
|
|||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
static AnalyzerStartParameters createAnalyzerStartParameters(const QnxRunConfiguration *runConfig, Core::Id mode)
|
static AnalyzerStartParameters createAnalyzerStartParameters(const QnxRunConfiguration *runConfig)
|
||||||
{
|
{
|
||||||
AnalyzerStartParameters params;
|
AnalyzerStartParameters params;
|
||||||
Target *target = runConfig->target();
|
Target *target = runConfig->target();
|
||||||
@@ -105,18 +105,12 @@ static AnalyzerStartParameters createAnalyzerStartParameters(const QnxRunConfigu
|
|||||||
if (device.isNull())
|
if (device.isNull())
|
||||||
return params;
|
return params;
|
||||||
|
|
||||||
params.runMode = mode;
|
|
||||||
params.debuggee = runConfig->remoteExecutableFilePath();
|
params.debuggee = runConfig->remoteExecutableFilePath();
|
||||||
params.debuggeeArgs = runConfig->arguments().join(QLatin1Char(' '));
|
params.debuggeeArgs = runConfig->arguments().join(QLatin1Char(' '));
|
||||||
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
|
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
|
||||||
params.displayName = runConfig->displayName();
|
|
||||||
params.sysroot = SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
|
|
||||||
params.analyzerHost = params.connParams.host;
|
params.analyzerHost = params.connParams.host;
|
||||||
params.analyzerPort = params.connParams.port;
|
params.analyzerPort = params.connParams.port;
|
||||||
|
|
||||||
if (EnvironmentAspect *environment = runConfig->extraAspect<EnvironmentAspect>())
|
|
||||||
params.environment = environment->environment();
|
|
||||||
|
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,10 +164,9 @@ RunControl *QnxRunControlFactory::create(RunConfiguration *runConfig, Core::Id m
|
|||||||
|
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
|
if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
|
||||||
const AnalyzerStartParameters params = createAnalyzerStartParameters(rc, mode);
|
const AnalyzerStartParameters params = createAnalyzerStartParameters(rc);
|
||||||
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig);
|
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig, mode);
|
||||||
QnxAnalyzeSupport * const analyzeSupport = new QnxAnalyzeSupport(rc, runControl);
|
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;
|
||||||
|
@@ -76,34 +76,13 @@ public:
|
|||||||
|
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const RunConfiguration *runConfig,
|
|
||||||
Core::Id runMode)
|
|
||||||
{
|
|
||||||
AnalyzerStartParameters params;
|
|
||||||
params.runMode = runMode;
|
|
||||||
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
|
|
||||||
params.displayName = runConfig->displayName();
|
|
||||||
params.sysroot = SysRootKitInformation::sysRoot(runConfig->target()->kit()).toString();
|
|
||||||
params.analyzerHost = params.connParams.host;
|
|
||||||
|
|
||||||
auto rc = qobject_cast<const AbstractRemoteLinuxRunConfiguration *>(runConfig);
|
|
||||||
QTC_ASSERT(rc, return params);
|
|
||||||
|
|
||||||
params.debuggee = rc->remoteExecutableFilePath();
|
|
||||||
params.debuggeeArgs = Utils::QtcProcess::Arguments::createUnixArgs(rc->arguments()).toString();
|
|
||||||
params.workingDirectory = rc->workingDirectory();
|
|
||||||
params.environment = rc->environment();
|
|
||||||
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
|
RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
|
||||||
AnalyzerRunControl *engine, Core::Id runMode)
|
AnalyzerRunControl *engine, Core::Id runMode)
|
||||||
: AbstractRemoteLinuxRunSupport(runConfig, engine),
|
: AbstractRemoteLinuxRunSupport(runConfig, engine),
|
||||||
d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode))
|
d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode))
|
||||||
{
|
{
|
||||||
connect(d->runControl, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)),
|
connect(d->runControl.data(), &AnalyzerRunControl::starting,
|
||||||
SLOT(handleRemoteSetupRequested()));
|
this, &RemoteLinuxAnalyzeSupport::handleRemoteSetupRequested);
|
||||||
connect(&d->outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
|
connect(&d->outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
|
||||||
this, &RemoteLinuxAnalyzeSupport::remoteIsRunning);
|
this, &RemoteLinuxAnalyzeSupport::remoteIsRunning);
|
||||||
connect(engine, &RunControl::finished,
|
connect(engine, &RunControl::finished,
|
||||||
|
@@ -52,9 +52,6 @@ class REMOTELINUX_EXPORT RemoteLinuxAnalyzeSupport : public AbstractRemoteLinuxR
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static Analyzer::AnalyzerStartParameters startParameters(const ProjectExplorer::RunConfiguration *runConfig,
|
|
||||||
Core::Id runMode);
|
|
||||||
|
|
||||||
RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
|
RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
|
||||||
Analyzer::AnalyzerRunControl *engine, Core::Id runMode);
|
Analyzer::AnalyzerRunControl *engine, Core::Id runMode);
|
||||||
~RemoteLinuxAnalyzeSupport();
|
~RemoteLinuxAnalyzeSupport();
|
||||||
|
@@ -116,10 +116,12 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
|
if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
|
||||||
AnalyzerStartParameters params = RemoteLinuxAnalyzeSupport::startParameters(runConfig, mode);
|
AnalyzerStartParameters params;
|
||||||
|
params.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
|
||||||
|
params.analyzerHost = params.connParams.host;
|
||||||
auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
|
auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
|
||||||
QTC_ASSERT(rc, return 0);
|
QTC_ASSERT(rc, return 0);
|
||||||
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig);
|
AnalyzerRunControl *runControl = AnalyzerManager::createRunControl(params, runConfig, mode);
|
||||||
(void) new RemoteLinuxAnalyzeSupport(rc, runControl, mode);
|
(void) new RemoteLinuxAnalyzeSupport(rc, runControl, mode);
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ using namespace Valgrind::Internal;
|
|||||||
|
|
||||||
CallgrindRunControl::CallgrindRunControl(const AnalyzerStartParameters &sp,
|
CallgrindRunControl::CallgrindRunControl(const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration)
|
ProjectExplorer::RunConfiguration *runConfiguration)
|
||||||
: ValgrindRunControl(sp, runConfiguration)
|
: ValgrindRunControl(sp, runConfiguration, CALLGRIND_RUN_MODE)
|
||||||
, m_markAsPaused(false)
|
, m_markAsPaused(false)
|
||||||
{
|
{
|
||||||
connect(&m_runner, &Callgrind::CallgrindRunner::finished,
|
connect(&m_runner, &Callgrind::CallgrindRunner::finished,
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "memcheckengine.h"
|
#include "memcheckengine.h"
|
||||||
|
#include "memchecktool.h"
|
||||||
#include "valgrindprocess.h"
|
#include "valgrindprocess.h"
|
||||||
#include "valgrindsettings.h"
|
#include "valgrindsettings.h"
|
||||||
#include "xmlprotocol/error.h"
|
#include "xmlprotocol/error.h"
|
||||||
@@ -56,8 +57,8 @@ namespace Valgrind {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
MemcheckRunControl::MemcheckRunControl(const AnalyzerStartParameters &sp,
|
MemcheckRunControl::MemcheckRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration, Core::Id runMode)
|
||||||
: ValgrindRunControl(sp, runConfiguration)
|
: ValgrindRunControl(sp, runConfiguration, runMode)
|
||||||
{
|
{
|
||||||
connect(&m_parser, &XmlProtocol::ThreadedParser::error,
|
connect(&m_parser, &XmlProtocol::ThreadedParser::error,
|
||||||
this, &MemcheckRunControl::parserError);
|
this, &MemcheckRunControl::parserError);
|
||||||
@@ -135,7 +136,7 @@ QStringList MemcheckRunControl::suppressionFiles() const
|
|||||||
|
|
||||||
MemcheckWithGdbRunControl::MemcheckWithGdbRunControl(const AnalyzerStartParameters &sp,
|
MemcheckWithGdbRunControl::MemcheckWithGdbRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration)
|
||||||
: MemcheckRunControl(sp, runConfiguration)
|
: MemcheckRunControl(sp, runConfiguration, MEMCHECK_WITH_GDB_RUN_MODE)
|
||||||
{
|
{
|
||||||
connect(&m_runner, &Memcheck::MemcheckRunner::started,
|
connect(&m_runner, &Memcheck::MemcheckRunner::started,
|
||||||
this, &MemcheckWithGdbRunControl::startDebugger);
|
this, &MemcheckWithGdbRunControl::startDebugger);
|
||||||
|
@@ -46,7 +46,8 @@ class MemcheckRunControl : public ValgrindRunControl
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
MemcheckRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
MemcheckRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration,
|
||||||
|
Core::Id runMode);
|
||||||
|
|
||||||
bool startEngine() override;
|
bool startEngine() override;
|
||||||
void stopEngine() override;
|
void stopEngine() override;
|
||||||
|
@@ -429,13 +429,17 @@ QWidget *MemcheckTool::createWidgets()
|
|||||||
}
|
}
|
||||||
|
|
||||||
MemcheckRunControl *MemcheckTool::createRunControl(const AnalyzerStartParameters &sp,
|
MemcheckRunControl *MemcheckTool::createRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration,
|
||||||
|
Core::Id runMode)
|
||||||
{
|
{
|
||||||
m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()
|
m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()
|
||||||
->project()->files(Project::AllFiles) : QStringList());
|
->project()->files(Project::AllFiles) : QStringList());
|
||||||
|
|
||||||
MemcheckRunControl *engine = createMemcheckRunControl(sp, runConfiguration);
|
MemcheckRunControl *engine = 0;
|
||||||
|
if (runMode == MEMCHECK_RUN_MODE)
|
||||||
|
engine = new MemcheckRunControl(sp, runConfiguration, runMode);
|
||||||
|
else
|
||||||
|
engine = new MemcheckWithGdbRunControl(sp, runConfiguration);
|
||||||
connect(engine, &MemcheckRunControl::starting, this, &MemcheckTool::engineStarting);
|
connect(engine, &MemcheckRunControl::starting, this, &MemcheckTool::engineStarting);
|
||||||
connect(engine, &MemcheckRunControl::parserError, this, &MemcheckTool::parserError);
|
connect(engine, &MemcheckRunControl::parserError, this, &MemcheckTool::parserError);
|
||||||
connect(engine, &MemcheckRunControl::internalParserError, this, &MemcheckTool::internalParserError);
|
connect(engine, &MemcheckRunControl::internalParserError, this, &MemcheckTool::internalParserError);
|
||||||
@@ -567,12 +571,6 @@ int MemcheckTool::updateUiAfterFinishedHelper()
|
|||||||
return issuesFound;
|
return issuesFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemcheckRunControl *MemcheckTool::createMemcheckRunControl(const AnalyzerStartParameters &sp,
|
|
||||||
RunConfiguration *runConfiguration)
|
|
||||||
{
|
|
||||||
return new MemcheckRunControl(sp, runConfiguration);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemcheckTool::engineFinished()
|
void MemcheckTool::engineFinished()
|
||||||
{
|
{
|
||||||
const int issuesFound = updateUiAfterFinishedHelper();
|
const int issuesFound = updateUiAfterFinishedHelper();
|
||||||
@@ -595,17 +593,5 @@ void MemcheckTool::setBusyCursor(bool busy)
|
|||||||
m_errorView->setCursor(cursor);
|
m_errorView->setCursor(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemcheckWithGdbTool::MemcheckWithGdbTool(QObject *parent) :
|
|
||||||
MemcheckTool(parent)
|
|
||||||
{
|
|
||||||
setObjectName(QLatin1String("MemcheckWithGdbTool"));
|
|
||||||
}
|
|
||||||
|
|
||||||
MemcheckRunControl *MemcheckWithGdbTool::createMemcheckRunControl(const AnalyzerStartParameters &sp,
|
|
||||||
RunConfiguration *runConfiguration)
|
|
||||||
{
|
|
||||||
return new MemcheckWithGdbRunControl(sp, runConfiguration);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Valgrind
|
} // namespace Valgrind
|
||||||
|
@@ -91,7 +91,8 @@ public:
|
|||||||
QWidget *createWidgets();
|
QWidget *createWidgets();
|
||||||
|
|
||||||
MemcheckRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
MemcheckRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration,
|
||||||
|
Core::Id runMode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void settingsDestroyed(QObject *settings);
|
void settingsDestroyed(QObject *settings);
|
||||||
@@ -115,11 +116,6 @@ private:
|
|||||||
void updateFromSettings();
|
void updateFromSettings();
|
||||||
int updateUiAfterFinishedHelper();
|
int updateUiAfterFinishedHelper();
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual MemcheckRunControl *createMemcheckRunControl(
|
|
||||||
const Analyzer::AnalyzerStartParameters &sp,
|
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ValgrindBaseSettings *m_settings;
|
ValgrindBaseSettings *m_settings;
|
||||||
QMenu *m_filterMenu;
|
QMenu *m_filterMenu;
|
||||||
@@ -138,16 +134,6 @@ private:
|
|||||||
QAction *m_goNext;
|
QAction *m_goNext;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MemcheckWithGdbTool : public MemcheckTool
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MemcheckWithGdbTool(QObject *parent);
|
|
||||||
|
|
||||||
MemcheckRunControl *createMemcheckRunControl(
|
|
||||||
const Analyzer::AnalyzerStartParameters &sp,
|
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Valgrind
|
} // namespace Valgrind
|
||||||
|
|
||||||
|
@@ -55,12 +55,13 @@ namespace Valgrind {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ValgrindRunControl::ValgrindRunControl(const AnalyzerStartParameters &sp,
|
ValgrindRunControl::ValgrindRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration, Core::Id runMode)
|
||||||
: AnalyzerRunControl(sp, runConfiguration),
|
: AnalyzerRunControl(sp, runConfiguration, runMode),
|
||||||
m_settings(0),
|
m_settings(0),
|
||||||
m_isStopping(false)
|
m_isStopping(false)
|
||||||
{
|
{
|
||||||
m_isCustomStart = false;
|
m_isCustomStart = false;
|
||||||
|
m_localRunMode = ApplicationLauncher::Gui;
|
||||||
|
|
||||||
if (runConfiguration)
|
if (runConfiguration)
|
||||||
if (IRunConfigurationAspect *aspect = runConfiguration->extraAspect(ANALYZER_VALGRIND_SETTINGS))
|
if (IRunConfigurationAspect *aspect = runConfiguration->extraAspect(ANALYZER_VALGRIND_SETTINGS))
|
||||||
@@ -94,15 +95,15 @@ bool ValgrindRunControl::startEngine()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ValgrindRunner *run = runner();
|
ValgrindRunner *run = runner();
|
||||||
run->setWorkingDirectory(sp.workingDirectory);
|
run->setWorkingDirectory(workingDirectory());
|
||||||
run->setValgrindExecutable(m_settings->valgrindExecutable());
|
run->setValgrindExecutable(m_settings->valgrindExecutable());
|
||||||
run->setValgrindArguments(genericToolArguments() + toolArguments());
|
run->setValgrindArguments(genericToolArguments() + toolArguments());
|
||||||
run->setDebuggeeExecutable(sp.debuggee);
|
run->setDebuggeeExecutable(sp.debuggee);
|
||||||
run->setDebuggeeArguments(sp.debuggeeArgs);
|
run->setDebuggeeArguments(sp.debuggeeArgs);
|
||||||
run->setEnvironment(sp.environment);
|
run->setEnvironment(m_environment);
|
||||||
run->setConnectionParameters(sp.connParams);
|
run->setConnectionParameters(sp.connParams);
|
||||||
run->setUseStartupProject(!m_isCustomStart);
|
run->setUseStartupProject(!m_isCustomStart);
|
||||||
run->setLocalRunMode(sp.localRunMode);
|
run->setLocalRunMode(m_localRunMode);
|
||||||
|
|
||||||
connect(run, &ValgrindRunner::processOutputReceived,
|
connect(run, &ValgrindRunner::processOutputReceived,
|
||||||
this, &ValgrindRunControl::receiveProcessOutput);
|
this, &ValgrindRunControl::receiveProcessOutput);
|
||||||
@@ -129,6 +130,16 @@ QString ValgrindRunControl::executable() const
|
|||||||
return startParameters().debuggee;
|
return startParameters().debuggee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ValgrindRunControl::setEnvironment(const Utils::Environment &environment)
|
||||||
|
{
|
||||||
|
m_environment = environment;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ValgrindRunControl::setLocalRunMode(ApplicationLauncher::Mode localRunMode)
|
||||||
|
{
|
||||||
|
m_localRunMode = localRunMode;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList ValgrindRunControl::genericToolArguments() const
|
QStringList ValgrindRunControl::genericToolArguments() const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_settings, return QStringList());
|
QTC_ASSERT(m_settings, return QStringList());
|
||||||
|
@@ -49,14 +49,18 @@ class ValgrindRunControl : public Analyzer::AnalyzerRunControl
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ValgrindRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
ValgrindRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration,
|
||||||
|
Core::Id runMode);
|
||||||
~ValgrindRunControl();
|
~ValgrindRunControl();
|
||||||
|
|
||||||
bool startEngine();
|
bool startEngine();
|
||||||
void stopEngine();
|
void stopEngine();
|
||||||
|
|
||||||
QString executable() const;
|
QString executable() const;
|
||||||
|
|
||||||
void setCustomStart() { m_isCustomStart = true; }
|
void setCustomStart() { m_isCustomStart = true; }
|
||||||
|
void setEnvironment(const Utils::Environment &environment);
|
||||||
|
void setLocalRunMode(ProjectExplorer::ApplicationLauncher::Mode localRunMode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QString progressTitle() const = 0;
|
virtual QString progressTitle() const = 0;
|
||||||
@@ -66,6 +70,8 @@ protected:
|
|||||||
ValgrindBaseSettings *m_settings;
|
ValgrindBaseSettings *m_settings;
|
||||||
QFutureInterface<void> m_progress;
|
QFutureInterface<void> m_progress;
|
||||||
bool m_isCustomStart;
|
bool m_isCustomStart;
|
||||||
|
Utils::Environment m_environment;
|
||||||
|
ProjectExplorer::ApplicationLauncher::Mode m_localRunMode;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleProgressCanceled();
|
void handleProgressCanceled();
|
||||||
|
@@ -110,20 +110,6 @@ ValgrindPlugin::~ValgrindPlugin()
|
|||||||
theGlobalSettings = 0;
|
theGlobalSettings = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool fillParameters(AnalyzerStartParameters *sp)
|
|
||||||
{
|
|
||||||
StartRemoteDialog dlg;
|
|
||||||
if (dlg.exec() != QDialog::Accepted)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
sp->connParams = dlg.sshParams();
|
|
||||||
sp->debuggee = dlg.executable();
|
|
||||||
sp->debuggeeArgs = dlg.arguments();
|
|
||||||
sp->displayName = dlg.executable();
|
|
||||||
sp->workingDirectory = dlg.workingDirectory();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||||
{
|
{
|
||||||
theGlobalSettings = new ValgrindGlobalSettings();
|
theGlobalSettings = new ValgrindGlobalSettings();
|
||||||
@@ -137,6 +123,7 @@ bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
|||||||
|
|
||||||
void ValgrindPlugin::extensionsInitialized()
|
void ValgrindPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
|
using namespace std::placeholders;
|
||||||
AnalyzerAction *action = 0;
|
AnalyzerAction *action = 0;
|
||||||
|
|
||||||
QString callgrindToolTip = tr("Valgrind Function Profile uses the "
|
QString callgrindToolTip = tr("Valgrind Function Profile uses the "
|
||||||
@@ -147,15 +134,10 @@ void ValgrindPlugin::extensionsInitialized()
|
|||||||
|
|
||||||
auto mcTool = new MemcheckTool(this);
|
auto mcTool = new MemcheckTool(this);
|
||||||
auto mcWidgetCreator = [mcTool] { return mcTool->createWidgets(); };
|
auto mcWidgetCreator = [mcTool] { return mcTool->createWidgets(); };
|
||||||
auto mcRunControlCreator = [mcTool](const AnalyzerStartParameters &sp,
|
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration) -> AnalyzerRunControl * {
|
|
||||||
return mcTool->createRunControl(sp, runConfiguration);
|
|
||||||
};
|
|
||||||
|
|
||||||
auto cgTool = new CallgrindTool(this);
|
auto cgTool = new CallgrindTool(this);
|
||||||
auto cgWidgetCreator = [cgTool] { return cgTool->createWidgets(); };
|
auto cgWidgetCreator = [cgTool] { return cgTool->createWidgets(); };
|
||||||
auto cgRunControlCreator = [cgTool](const AnalyzerStartParameters &sp,
|
auto cgRunControlCreator = [cgTool](const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration) {
|
RunConfiguration *runConfiguration, Core::Id) {
|
||||||
return cgTool->createRunControl(sp, runConfiguration);
|
return cgTool->createRunControl(sp, runConfiguration);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -164,8 +146,9 @@ void ValgrindPlugin::extensionsInitialized()
|
|||||||
action->setActionId("Memcheck.Local");
|
action->setActionId("Memcheck.Local");
|
||||||
action->setToolId("Memcheck");
|
action->setToolId("Memcheck");
|
||||||
action->setWidgetCreator(mcWidgetCreator);
|
action->setWidgetCreator(mcWidgetCreator);
|
||||||
action->setRunControlCreator(mcRunControlCreator);
|
action->setRunControlCreator(std::bind(&MemcheckTool::createRunControl,
|
||||||
action->setToolMode(SymbolsMode);
|
mcTool, _1, _2, MEMCHECK_RUN_MODE));
|
||||||
|
action->setToolMode(DebugMode);
|
||||||
action->setRunMode(MEMCHECK_RUN_MODE);
|
action->setRunMode(MEMCHECK_RUN_MODE);
|
||||||
action->setText(tr("Valgrind Memory Analyzer"));
|
action->setText(tr("Valgrind Memory Analyzer"));
|
||||||
action->setToolTip(memcheckToolTip);
|
action->setToolTip(memcheckToolTip);
|
||||||
@@ -173,15 +156,14 @@ void ValgrindPlugin::extensionsInitialized()
|
|||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
AnalyzerManager::addAction(action);
|
AnalyzerManager::addAction(action);
|
||||||
|
|
||||||
using namespace std::placeholders;
|
auto mcgTool = new MemcheckTool(this);
|
||||||
auto mcgTool = new MemcheckWithGdbTool(this);
|
|
||||||
action = new AnalyzerAction(this);
|
action = new AnalyzerAction(this);
|
||||||
action->setActionId("MemcheckWithGdb.Local");
|
action->setActionId("MemcheckWithGdb.Local");
|
||||||
action->setToolId("MemcheckWithGdb");
|
action->setToolId("MemcheckWithGdb");
|
||||||
action->setWidgetCreator([mcgTool] { return mcgTool->createWidgets(); });
|
action->setWidgetCreator([mcgTool] { return mcgTool->createWidgets(); });
|
||||||
action->setRunControlCreator(std::bind(&MemcheckWithGdbTool::createRunControl,
|
action->setRunControlCreator(std::bind(&MemcheckTool::createRunControl,
|
||||||
mcgTool, _1, _2));
|
mcgTool, _1, _2, MEMCHECK_WITH_GDB_RUN_MODE));
|
||||||
action->setToolMode(SymbolsMode);
|
action->setToolMode(DebugMode);
|
||||||
action->setRunMode(MEMCHECK_WITH_GDB_RUN_MODE);
|
action->setRunMode(MEMCHECK_WITH_GDB_RUN_MODE);
|
||||||
action->setText(tr("Valgrind Memory Analyzer with GDB"));
|
action->setText(tr("Valgrind Memory Analyzer with GDB"));
|
||||||
action->setToolTip(tr("Valgrind Analyze Memory with GDB uses the "
|
action->setToolTip(tr("Valgrind Analyze Memory with GDB uses the "
|
||||||
@@ -210,11 +192,17 @@ void ValgrindPlugin::extensionsInitialized()
|
|||||||
action->setToolId("Memcheck");
|
action->setToolId("Memcheck");
|
||||||
action->setWidgetCreator(mcWidgetCreator);
|
action->setWidgetCreator(mcWidgetCreator);
|
||||||
action->setCustomToolStarter([mcTool] {
|
action->setCustomToolStarter([mcTool] {
|
||||||
AnalyzerStartParameters sp;
|
StartRemoteDialog dlg;
|
||||||
if (!fillParameters(&sp))
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
ValgrindRunControl *rc = mcTool->createRunControl(sp, 0);
|
AnalyzerStartParameters sp;
|
||||||
|
sp.connParams = dlg.sshParams();
|
||||||
|
sp.debuggee = dlg.executable();
|
||||||
|
sp.debuggeeArgs = dlg.arguments();
|
||||||
|
ValgrindRunControl *rc = mcTool->createRunControl(sp, 0, MEMCHECK_RUN_MODE);
|
||||||
QTC_ASSERT(rc, return);
|
QTC_ASSERT(rc, return);
|
||||||
|
rc->setDisplayName(dlg.executable());
|
||||||
|
rc->setWorkingDirectory(dlg.workingDirectory());
|
||||||
rc->setCustomStart();
|
rc->setCustomStart();
|
||||||
ProjectExplorerPlugin::startRunControl(rc, MEMCHECK_RUN_MODE);
|
ProjectExplorerPlugin::startRunControl(rc, MEMCHECK_RUN_MODE);
|
||||||
});
|
});
|
||||||
@@ -228,11 +216,17 @@ void ValgrindPlugin::extensionsInitialized()
|
|||||||
action->setToolId(CallgrindToolId);
|
action->setToolId(CallgrindToolId);
|
||||||
action->setWidgetCreator(cgWidgetCreator);
|
action->setWidgetCreator(cgWidgetCreator);
|
||||||
action->setCustomToolStarter([cgTool] {
|
action->setCustomToolStarter([cgTool] {
|
||||||
AnalyzerStartParameters sp;
|
StartRemoteDialog dlg;
|
||||||
if (!fillParameters(&sp))
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
|
AnalyzerStartParameters sp;
|
||||||
|
sp.connParams = dlg.sshParams();
|
||||||
|
sp.debuggee = dlg.executable();
|
||||||
|
sp.debuggeeArgs = dlg.arguments();
|
||||||
ValgrindRunControl *rc = cgTool->createRunControl(sp, 0);
|
ValgrindRunControl *rc = cgTool->createRunControl(sp, 0);
|
||||||
QTC_ASSERT(rc, return);
|
QTC_ASSERT(rc, return);
|
||||||
|
rc->setDisplayName(dlg.executable());
|
||||||
|
rc->setWorkingDirectory(dlg.workingDirectory());
|
||||||
rc->setCustomStart();
|
rc->setCustomStart();
|
||||||
ProjectExplorerPlugin::startRunControl(rc, CALLGRIND_RUN_MODE);
|
ProjectExplorerPlugin::startRunControl(rc, CALLGRIND_RUN_MODE);
|
||||||
});
|
});
|
||||||
|
@@ -29,6 +29,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "valgrindruncontrolfactory.h"
|
#include "valgrindruncontrolfactory.h"
|
||||||
|
|
||||||
|
#include "valgrindengine.h"
|
||||||
#include "valgrindsettings.h"
|
#include "valgrindsettings.h"
|
||||||
#include "valgrindplugin.h"
|
#include "valgrindplugin.h"
|
||||||
#include "callgrindtool.h"
|
#include "callgrindtool.h"
|
||||||
@@ -55,6 +57,7 @@
|
|||||||
|
|
||||||
using namespace Analyzer;
|
using namespace Analyzer;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -74,15 +77,15 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
|
|||||||
{
|
{
|
||||||
Q_UNUSED(errorMessage);
|
Q_UNUSED(errorMessage);
|
||||||
|
|
||||||
|
ApplicationLauncher::Mode localRunMode = ApplicationLauncher::Gui;
|
||||||
|
Utils::Environment environment;
|
||||||
AnalyzerStartParameters sp;
|
AnalyzerStartParameters sp;
|
||||||
sp.displayName = runConfiguration->displayName();
|
QString workingDirectory;
|
||||||
sp.runMode = mode;
|
if (auto rc1 = qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||||
if (LocalApplicationRunConfiguration *rc1 =
|
|
||||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
|
||||||
EnvironmentAspect *aspect = runConfiguration->extraAspect<EnvironmentAspect>();
|
EnvironmentAspect *aspect = runConfiguration->extraAspect<EnvironmentAspect>();
|
||||||
if (aspect)
|
if (aspect)
|
||||||
sp.environment = aspect->environment();
|
environment = aspect->environment();
|
||||||
sp.workingDirectory = rc1->workingDirectory();
|
workingDirectory = rc1->workingDirectory();
|
||||||
sp.debuggee = rc1->executable();
|
sp.debuggee = rc1->executable();
|
||||||
sp.debuggeeArgs = rc1->commandLineArguments();
|
sp.debuggeeArgs = rc1->commandLineArguments();
|
||||||
const IDevice::ConstPtr device =
|
const IDevice::ConstPtr device =
|
||||||
@@ -96,19 +99,23 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
|
|||||||
}
|
}
|
||||||
sp.connParams.host = server.serverAddress().toString();
|
sp.connParams.host = server.serverAddress().toString();
|
||||||
sp.connParams.port = server.serverPort();
|
sp.connParams.port = server.serverPort();
|
||||||
sp.localRunMode = static_cast<ApplicationLauncher::Mode>(rc1->runMode());
|
localRunMode = rc1->runMode();
|
||||||
} else if (RemoteLinux::AbstractRemoteLinuxRunConfiguration *rc2 =
|
} else if (RemoteLinux::AbstractRemoteLinuxRunConfiguration *rc2 =
|
||||||
qobject_cast<RemoteLinux::AbstractRemoteLinuxRunConfiguration *>(runConfiguration)) {
|
qobject_cast<RemoteLinux::AbstractRemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||||
sp.debuggee = rc2->remoteExecutableFilePath();
|
sp.debuggee = rc2->remoteExecutableFilePath();
|
||||||
sp.connParams = DeviceKitInformation::device(rc2->target()->kit())->sshParameters();
|
sp.connParams = DeviceKitInformation::device(rc2->target()->kit())->sshParameters();
|
||||||
sp.debuggeeArgs = rc2->arguments().join(QLatin1Char(' '));
|
sp.debuggeeArgs = rc2->arguments().join(QLatin1Char(' '));
|
||||||
sp.workingDirectory = rc2->workingDirectory();
|
|
||||||
sp.environment = rc2->environment();
|
|
||||||
} else {
|
} else {
|
||||||
QTC_ASSERT(false, return 0);
|
QTC_ASSERT(false, return 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnalyzerManager::createRunControl(sp, runConfiguration);
|
auto analyzerRunControl = AnalyzerManager::createRunControl(sp, runConfiguration, mode);
|
||||||
|
if (auto valgrindRunControl = qobject_cast<ValgrindRunControl *>(analyzerRunControl)) {
|
||||||
|
valgrindRunControl->setLocalRunMode(localRunMode);
|
||||||
|
valgrindRunControl->setEnvironment(environment);
|
||||||
|
valgrindRunControl->setWorkingDirectory(workingDirectory);
|
||||||
|
}
|
||||||
|
return analyzerRunControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -183,11 +183,6 @@ void ValgrindRunner::setLocalRunMode(ProjectExplorer::ApplicationLauncher::Mode
|
|||||||
d->localRunMode = localRunMode;
|
d->localRunMode = localRunMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::ApplicationLauncher::Mode ValgrindRunner::localRunMode() const
|
|
||||||
{
|
|
||||||
return d->localRunMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QSsh::SshConnectionParameters &ValgrindRunner::connectionParameters() const
|
const QSsh::SshConnectionParameters &ValgrindRunner::connectionParameters() const
|
||||||
{
|
{
|
||||||
return d->connParams;
|
return d->connParams;
|
||||||
|
@@ -76,7 +76,6 @@ public:
|
|||||||
bool useStartupProject() const;
|
bool useStartupProject() const;
|
||||||
|
|
||||||
void setLocalRunMode(ProjectExplorer::ApplicationLauncher::Mode localRunMode);
|
void setLocalRunMode(ProjectExplorer::ApplicationLauncher::Mode localRunMode);
|
||||||
ProjectExplorer::ApplicationLauncher::Mode localRunMode() const;
|
|
||||||
|
|
||||||
void setConnectionParameters(const QSsh::SshConnectionParameters &connParams);
|
void setConnectionParameters(const QSsh::SshConnectionParameters &connParams);
|
||||||
const QSsh::SshConnectionParameters &connectionParameters() const;
|
const QSsh::SshConnectionParameters &connectionParameters() const;
|
||||||
|
Reference in New Issue
Block a user