forked from qt-creator/qt-creator
Valgrind: Start custom actions more directly
This does not need to go through the PE machinery. Change-Id: If0b2fde5309d7e119e8ac27245a22939b68d847d Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -120,7 +120,7 @@ public:
|
|||||||
void doClear(bool clearParseData);
|
void doClear(bool clearParseData);
|
||||||
void updateEventCombo();
|
void updateEventCombo();
|
||||||
|
|
||||||
AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp,
|
ValgrindRunControl *createRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration = 0);
|
RunConfiguration *runConfiguration = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -514,13 +514,13 @@ CallgrindTool::~CallgrindTool()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerRunControl *CallgrindTool::createRunControl(const AnalyzerStartParameters &sp,
|
ValgrindRunControl *CallgrindTool::createRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration)
|
||||||
{
|
{
|
||||||
return d->createRunControl(sp, runConfiguration);
|
return d->createRunControl(sp, runConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartParameters &sp,
|
ValgrindRunControl *CallgrindToolPrivate::createRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration)
|
||||||
{
|
{
|
||||||
CallgrindRunControl *rc = new CallgrindRunControl(sp, runConfiguration);
|
CallgrindRunControl *rc = new CallgrindRunControl(sp, runConfiguration);
|
||||||
|
@@ -40,6 +40,7 @@ const char CallgrindToolId[] = "Callgrind";
|
|||||||
const char CallgrindLocalActionId[] = "Callgrind.Local";
|
const char CallgrindLocalActionId[] = "Callgrind.Local";
|
||||||
const char CallgrindRemoteActionId[] = "Callgrind.Remote";
|
const char CallgrindRemoteActionId[] = "Callgrind.Remote";
|
||||||
|
|
||||||
|
class ValgrindRunControl;
|
||||||
class CallgrindToolPrivate;
|
class CallgrindToolPrivate;
|
||||||
|
|
||||||
class CallgrindTool : public QObject
|
class CallgrindTool : public QObject
|
||||||
@@ -50,7 +51,7 @@ public:
|
|||||||
CallgrindTool(QObject *parent);
|
CallgrindTool(QObject *parent);
|
||||||
~CallgrindTool();
|
~CallgrindTool();
|
||||||
|
|
||||||
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
ValgrindRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||||
QWidget *createWidgets();
|
QWidget *createWidgets();
|
||||||
|
|
||||||
|
@@ -427,7 +427,7 @@ QWidget *MemcheckTool::createWidgets()
|
|||||||
return widget;
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalyzerRunControl *MemcheckTool::createRunControl(const AnalyzerStartParameters &sp,
|
MemcheckRunControl *MemcheckTool::createRunControl(const AnalyzerStartParameters &sp,
|
||||||
RunConfiguration *runConfiguration)
|
RunConfiguration *runConfiguration)
|
||||||
{
|
{
|
||||||
m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()
|
m_frameFinder->setFiles(runConfiguration ? runConfiguration->target()
|
||||||
|
@@ -85,8 +85,8 @@ public:
|
|||||||
|
|
||||||
QWidget *createWidgets();
|
QWidget *createWidgets();
|
||||||
|
|
||||||
Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
MemcheckRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration);
|
ProjectExplorer::RunConfiguration *runConfiguration);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void settingsDestroyed(QObject *settings);
|
void settingsDestroyed(QObject *settings);
|
||||||
|
@@ -60,13 +60,14 @@ ValgrindRunControl::ValgrindRunControl(const AnalyzerStartParameters &sp,
|
|||||||
m_settings(0),
|
m_settings(0),
|
||||||
m_isStopping(false)
|
m_isStopping(false)
|
||||||
{
|
{
|
||||||
|
m_isCustomStart = false;
|
||||||
|
|
||||||
if (runConfiguration)
|
if (runConfiguration)
|
||||||
if (IRunConfigurationAspect *aspect = runConfiguration->extraAspect(ANALYZER_VALGRIND_SETTINGS))
|
if (IRunConfigurationAspect *aspect = runConfiguration->extraAspect(ANALYZER_VALGRIND_SETTINGS))
|
||||||
m_settings = qobject_cast<ValgrindBaseSettings *>(aspect->currentSettings());
|
m_settings = qobject_cast<ValgrindBaseSettings *>(aspect->currentSettings());
|
||||||
|
|
||||||
if (!m_settings)
|
if (!m_settings)
|
||||||
m_settings = ValgrindPlugin::globalSettings();
|
m_settings = ValgrindPlugin::globalSettings();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ValgrindRunControl::~ValgrindRunControl()
|
ValgrindRunControl::~ValgrindRunControl()
|
||||||
@@ -100,7 +101,7 @@ bool ValgrindRunControl::startEngine()
|
|||||||
run->setDebuggeeArguments(sp.debuggeeArgs);
|
run->setDebuggeeArguments(sp.debuggeeArgs);
|
||||||
run->setEnvironment(sp.environment);
|
run->setEnvironment(sp.environment);
|
||||||
run->setConnectionParameters(sp.connParams);
|
run->setConnectionParameters(sp.connParams);
|
||||||
run->setUseStartupProject(sp.useStartupProject);
|
run->setUseStartupProject(!m_isCustomStart);
|
||||||
run->setLocalRunMode(sp.localRunMode);
|
run->setLocalRunMode(sp.localRunMode);
|
||||||
|
|
||||||
connect(run, &ValgrindRunner::processOutputReceived,
|
connect(run, &ValgrindRunner::processOutputReceived,
|
||||||
|
@@ -56,6 +56,7 @@ public:
|
|||||||
void stopEngine();
|
void stopEngine();
|
||||||
|
|
||||||
QString executable() const;
|
QString executable() const;
|
||||||
|
void setCustomStart() { m_isCustomStart = true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QString progressTitle() const = 0;
|
virtual QString progressTitle() const = 0;
|
||||||
@@ -64,6 +65,7 @@ protected:
|
|||||||
|
|
||||||
ValgrindBaseSettings *m_settings;
|
ValgrindBaseSettings *m_settings;
|
||||||
QFutureInterface<void> m_progress;
|
QFutureInterface<void> m_progress;
|
||||||
|
bool m_isCustomStart;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleProgressCanceled();
|
void handleProgressCanceled();
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "callgrindtool.h"
|
#include "callgrindtool.h"
|
||||||
#include "memchecktool.h"
|
#include "memchecktool.h"
|
||||||
|
#include "memcheckengine.h"
|
||||||
#include "valgrindruncontrolfactory.h"
|
#include "valgrindruncontrolfactory.h"
|
||||||
#include "valgrindsettings.h"
|
#include "valgrindsettings.h"
|
||||||
#include "valgrindconfigwidget.h"
|
#include "valgrindconfigwidget.h"
|
||||||
@@ -109,22 +110,18 @@ ValgrindPlugin::~ValgrindPlugin()
|
|||||||
theGlobalSettings = 0;
|
theGlobalSettings = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void customStart(ProjectExplorer::RunMode runMode)
|
static bool fillParameters(AnalyzerStartParameters *sp)
|
||||||
{
|
{
|
||||||
StartRemoteDialog dlg;
|
StartRemoteDialog dlg;
|
||||||
if (dlg.exec() != QDialog::Accepted)
|
if (dlg.exec() != QDialog::Accepted)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
AnalyzerStartParameters sp;
|
sp->connParams = dlg.sshParams();
|
||||||
sp.useStartupProject = false;
|
sp->debuggee = dlg.executable();
|
||||||
sp.connParams = dlg.sshParams();
|
sp->debuggeeArgs = dlg.arguments();
|
||||||
sp.debuggee = dlg.executable();
|
sp->displayName = dlg.executable();
|
||||||
sp.debuggeeArgs = dlg.arguments();
|
sp->workingDirectory = dlg.workingDirectory();
|
||||||
sp.displayName = dlg.executable();
|
return false;
|
||||||
sp.workingDirectory = dlg.workingDirectory();
|
|
||||||
|
|
||||||
AnalyzerRunControl *rc = AnalyzerManager::createRunControl(sp, 0);
|
|
||||||
ProjectExplorerPlugin::startRunControl(rc, runMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
bool ValgrindPlugin::initialize(const QStringList &, QString *)
|
||||||
@@ -151,7 +148,7 @@ 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,
|
auto mcRunControlCreator = [mcTool](const AnalyzerStartParameters &sp,
|
||||||
ProjectExplorer::RunConfiguration *runConfiguration) {
|
ProjectExplorer::RunConfiguration *runConfiguration) -> AnalyzerRunControl * {
|
||||||
return mcTool->createRunControl(sp, runConfiguration);
|
return mcTool->createRunControl(sp, runConfiguration);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -212,9 +209,15 @@ void ValgrindPlugin::extensionsInitialized()
|
|||||||
action->setActionId("Memcheck.Remote");
|
action->setActionId("Memcheck.Remote");
|
||||||
action->setToolId("Memcheck");
|
action->setToolId("Memcheck");
|
||||||
action->setWidgetCreator(mcWidgetCreator);
|
action->setWidgetCreator(mcWidgetCreator);
|
||||||
action->setRunControlCreator(mcRunControlCreator);
|
action->setCustomToolStarter([mcTool] {
|
||||||
action->setCustomToolStarter([] { customStart(MemcheckRunMode); });
|
AnalyzerStartParameters sp;
|
||||||
action->setRunMode(MemcheckRunMode);
|
if (!fillParameters(&sp))
|
||||||
|
return;
|
||||||
|
ValgrindRunControl *rc = mcTool->createRunControl(sp, 0);
|
||||||
|
QTC_ASSERT(rc, return);
|
||||||
|
rc->setCustomStart();
|
||||||
|
ProjectExplorerPlugin::startRunControl(rc, MemcheckRunMode);
|
||||||
|
});
|
||||||
action->setText(tr("Valgrind Memory Analyzer (External Remote Application)"));
|
action->setText(tr("Valgrind Memory Analyzer (External Remote Application)"));
|
||||||
action->setToolTip(memcheckToolTip);
|
action->setToolTip(memcheckToolTip);
|
||||||
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS);
|
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||||
@@ -224,9 +227,16 @@ void ValgrindPlugin::extensionsInitialized()
|
|||||||
action->setActionId(CallgrindRemoteActionId);
|
action->setActionId(CallgrindRemoteActionId);
|
||||||
action->setToolId(CallgrindToolId);
|
action->setToolId(CallgrindToolId);
|
||||||
action->setWidgetCreator(cgWidgetCreator);
|
action->setWidgetCreator(cgWidgetCreator);
|
||||||
action->setRunControlCreator(cgRunControlCreator);
|
action->setCustomToolStarter([cgTool] {
|
||||||
action->setCustomToolStarter([] { customStart(CallgrindRunMode); });
|
AnalyzerStartParameters sp;
|
||||||
action->setRunMode(CallgrindRunMode);
|
if (!fillParameters(&sp))
|
||||||
|
return;
|
||||||
|
ValgrindRunControl *rc = cgTool->createRunControl(sp, 0);
|
||||||
|
QTC_ASSERT(rc, return);
|
||||||
|
rc->setCustomStart();
|
||||||
|
ProjectExplorerPlugin::startRunControl(rc, CallgrindRunMode);
|
||||||
|
});
|
||||||
|
|
||||||
action->setText(tr("Valgrind Function Profiler (External Remote Application)"));
|
action->setText(tr("Valgrind Function Profiler (External Remote Application)"));
|
||||||
action->setToolTip(callgrindToolTip);
|
action->setToolTip(callgrindToolTip);
|
||||||
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS);
|
action->setMenuGroup(Analyzer::Constants::G_ANALYZER_REMOTE_TOOLS);
|
||||||
|
Reference in New Issue
Block a user