forked from qt-creator/qt-creator
Qnx: use dedicated classes to create run worker
Change-Id: I43178d543509dcb561fffb25741b0e3dd8d95cb1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "qnxanalyzesupport.h"
|
||||
|
||||
#include "qnxconstants.h"
|
||||
#include "qnxtr.h"
|
||||
#include "slog2inforunner.h"
|
||||
|
||||
@@ -18,30 +19,41 @@ using namespace Utils;
|
||||
|
||||
namespace Qnx::Internal {
|
||||
|
||||
QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl)
|
||||
: SimpleTargetRunner(runControl)
|
||||
class QnxQmlProfilerSupport final : public SimpleTargetRunner
|
||||
{
|
||||
setId("QnxQmlProfilerSupport");
|
||||
appendMessage(Tr::tr("Preparing remote side..."), Utils::LogMessageFormat);
|
||||
public:
|
||||
explicit QnxQmlProfilerSupport(RunControl *runControl)
|
||||
: SimpleTargetRunner(runControl)
|
||||
{
|
||||
setId("QnxQmlProfilerSupport");
|
||||
appendMessage(Tr::tr("Preparing remote side..."), LogMessageFormat);
|
||||
|
||||
auto portsGatherer = new PortsGatherer(runControl);
|
||||
addStartDependency(portsGatherer);
|
||||
auto portsGatherer = new PortsGatherer(runControl);
|
||||
addStartDependency(portsGatherer);
|
||||
|
||||
auto slog2InfoRunner = new Slog2InfoRunner(runControl);
|
||||
addStartDependency(slog2InfoRunner);
|
||||
auto slog2InfoRunner = new Slog2InfoRunner(runControl);
|
||||
addStartDependency(slog2InfoRunner);
|
||||
|
||||
auto profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER);
|
||||
profiler->addStartDependency(this);
|
||||
addStopDependency(profiler);
|
||||
auto profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER);
|
||||
profiler->addStartDependency(this);
|
||||
addStopDependency(profiler);
|
||||
|
||||
setStartModifier([this, portsGatherer, profiler] {
|
||||
const QUrl serverUrl = portsGatherer->findEndPoint();
|
||||
profiler->recordData("QmlServerUrl", serverUrl);
|
||||
setStartModifier([this, portsGatherer, profiler] {
|
||||
const QUrl serverUrl = portsGatherer->findEndPoint();
|
||||
profiler->recordData("QmlServerUrl", serverUrl);
|
||||
|
||||
CommandLine cmd = commandLine();
|
||||
cmd.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl));
|
||||
setCommandLine(cmd);
|
||||
});
|
||||
CommandLine cmd = commandLine();
|
||||
cmd.addArg(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, serverUrl));
|
||||
setCommandLine(cmd);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
QnxQmlProfilerWorkerFactory::QnxQmlProfilerWorkerFactory()
|
||||
{
|
||||
setProduct<QnxQmlProfilerSupport>();
|
||||
// FIXME: Shouldn't this use the run mode id somehow?
|
||||
addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID);
|
||||
}
|
||||
|
||||
} // Qnx::Internal
|
||||
|
@@ -7,10 +7,10 @@
|
||||
|
||||
namespace Qnx::Internal {
|
||||
|
||||
class QnxQmlProfilerSupport : public ProjectExplorer::SimpleTargetRunner
|
||||
class QnxQmlProfilerWorkerFactory final : public ProjectExplorer::RunWorkerFactory
|
||||
{
|
||||
public:
|
||||
explicit QnxQmlProfilerSupport(ProjectExplorer::RunControl *runControl);
|
||||
QnxQmlProfilerWorkerFactory();
|
||||
};
|
||||
|
||||
} // Qnx::Internal
|
||||
|
@@ -5,18 +5,13 @@
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Constants {
|
||||
namespace Qnx::Constants {
|
||||
|
||||
const char QNX_QNX_QT[] = "Qt4ProjectManager.QtVersion.QNX.QNX";
|
||||
|
||||
const char QNX_QNX_FEATURE[] = "QtSupport.Wizards.FeatureQNX";
|
||||
|
||||
const char QNX_QNX_DEPLOYCONFIGURATION_ID[] = "Qt4ProjectManager.QNX.QNXDeployConfiguration";
|
||||
|
||||
const char QNX_RUNCONFIG_ID[] = "Qt4ProjectManager.QNX.QNXRunConfiguration.";
|
||||
const char QNX_QNX_OS_TYPE[] = "QnxOsType"; // Also used for device type.
|
||||
|
||||
const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain";
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace Qnx
|
||||
} // Qnx::Constants
|
||||
|
@@ -102,33 +102,37 @@ public:
|
||||
|
||||
// QnxDebugSupport
|
||||
|
||||
QnxDebugSupport::QnxDebugSupport(RunControl *runControl)
|
||||
: DebuggerRunTool(runControl)
|
||||
class QnxDebugSupport : public Debugger::DebuggerRunTool
|
||||
{
|
||||
setId("QnxDebugSupport");
|
||||
appendMessage(Tr::tr("Preparing remote side..."), LogMessageFormat);
|
||||
public:
|
||||
explicit QnxDebugSupport(ProjectExplorer::RunControl *runControl)
|
||||
: DebuggerRunTool(runControl)
|
||||
{
|
||||
setId("QnxDebugSupport");
|
||||
appendMessage(Tr::tr("Preparing remote side..."), LogMessageFormat);
|
||||
|
||||
setUsePortsGatherer(isCppDebugging(), isQmlDebugging());
|
||||
setUsePortsGatherer(isCppDebugging(), isQmlDebugging());
|
||||
|
||||
auto debuggeeRunner = new QnxDebuggeeRunner(runControl, portsGatherer());
|
||||
debuggeeRunner->addStartDependency(portsGatherer());
|
||||
auto debuggeeRunner = new QnxDebuggeeRunner(runControl, portsGatherer());
|
||||
debuggeeRunner->addStartDependency(portsGatherer());
|
||||
|
||||
auto slog2InfoRunner = new Slog2InfoRunner(runControl);
|
||||
debuggeeRunner->addStartDependency(slog2InfoRunner);
|
||||
auto slog2InfoRunner = new Slog2InfoRunner(runControl);
|
||||
debuggeeRunner->addStartDependency(slog2InfoRunner);
|
||||
|
||||
addStartDependency(debuggeeRunner);
|
||||
addStartDependency(debuggeeRunner);
|
||||
|
||||
Kit *k = runControl->kit();
|
||||
Kit *k = runControl->kit();
|
||||
|
||||
setStartMode(AttachToRemoteServer);
|
||||
setCloseMode(KillAtClose);
|
||||
setUseCtrlCStub(true);
|
||||
setSolibSearchPath(FileUtils::toFilePathList(searchPaths(k)));
|
||||
if (auto qtVersion = dynamic_cast<QnxQtVersion *>(QtSupport::QtKitAspect::qtVersion(k))) {
|
||||
setSysRoot(qtVersion->qnxTarget());
|
||||
modifyDebuggerEnvironment(qtVersion->environment());
|
||||
setStartMode(AttachToRemoteServer);
|
||||
setCloseMode(KillAtClose);
|
||||
setUseCtrlCStub(true);
|
||||
setSolibSearchPath(FileUtils::toFilePathList(searchPaths(k)));
|
||||
if (auto qtVersion = dynamic_cast<QnxQtVersion *>(QtSupport::QtKitAspect::qtVersion(k))) {
|
||||
setSysRoot(qtVersion->qnxTarget());
|
||||
modifyDebuggerEnvironment(qtVersion->environment());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// QnxAttachDebugDialog
|
||||
@@ -183,20 +187,24 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
QnxAttachDebugSupport::QnxAttachDebugSupport(RunControl *runControl)
|
||||
: DebuggerRunTool(runControl)
|
||||
class QnxAttachDebugSupport : public Debugger::DebuggerRunTool
|
||||
{
|
||||
setId("QnxAttachDebugSupport");
|
||||
public:
|
||||
explicit QnxAttachDebugSupport(ProjectExplorer::RunControl *runControl)
|
||||
: DebuggerRunTool(runControl)
|
||||
{
|
||||
setId("QnxAttachDebugSupport");
|
||||
|
||||
setUsePortsGatherer(isCppDebugging(), isQmlDebugging());
|
||||
setUsePortsGatherer(isCppDebugging(), isQmlDebugging());
|
||||
|
||||
if (isCppDebugging()) {
|
||||
auto pdebugRunner = new PDebugRunner(runControl, portsGatherer());
|
||||
addStartDependency(pdebugRunner);
|
||||
if (isCppDebugging()) {
|
||||
auto pdebugRunner = new PDebugRunner(runControl, portsGatherer());
|
||||
addStartDependency(pdebugRunner);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void QnxAttachDebugSupport::showProcessesDialog()
|
||||
void showAttachToProcessDialog()
|
||||
{
|
||||
auto kitChooser = new KitChooser;
|
||||
kitChooser->setKitPredicate([](const Kit *k) {
|
||||
@@ -242,4 +250,13 @@ void QnxAttachDebugSupport::showProcessesDialog()
|
||||
ProjectExplorerPlugin::startRunControl(runControl);
|
||||
}
|
||||
|
||||
// QnxDebugWorkerFactory
|
||||
|
||||
QnxDebugWorkerFactory::QnxDebugWorkerFactory()
|
||||
{
|
||||
setProduct<QnxDebugSupport>();
|
||||
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||
addSupportedRunConfig(Constants::QNX_RUNCONFIG_ID);
|
||||
}
|
||||
|
||||
} // Qnx::Internal
|
||||
|
@@ -7,18 +7,12 @@
|
||||
|
||||
namespace Qnx::Internal {
|
||||
|
||||
class QnxDebugSupport : public Debugger::DebuggerRunTool
|
||||
void showAttachToProcessDialog();
|
||||
|
||||
class QnxDebugWorkerFactory final : public ProjectExplorer::RunWorkerFactory
|
||||
{
|
||||
public:
|
||||
explicit QnxDebugSupport(ProjectExplorer::RunControl *runControl);
|
||||
};
|
||||
|
||||
class QnxAttachDebugSupport : public Debugger::DebuggerRunTool
|
||||
{
|
||||
public:
|
||||
explicit QnxAttachDebugSupport(ProjectExplorer::RunControl *runControl);
|
||||
|
||||
static void showProcessesDialog();
|
||||
QnxDebugWorkerFactory();
|
||||
};
|
||||
|
||||
} // Qnx::Internal
|
||||
|
@@ -103,17 +103,8 @@ public:
|
||||
QnxSettingsPage settingsPage;
|
||||
QnxToolChainFactory toolChainFactory;
|
||||
SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}};
|
||||
|
||||
RunWorkerFactory debugWorkerFactory{
|
||||
RunWorkerFactory::make<QnxDebugSupport>(),
|
||||
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
RunWorkerFactory qmlProfilerWorkerFactory{
|
||||
RunWorkerFactory::make<QnxQmlProfilerSupport>(),
|
||||
{}, // FIXME: Shouldn't this use the run mode id somehow?
|
||||
{runConfigFactory.runConfigurationId()}
|
||||
};
|
||||
QnxDebugWorkerFactory debugWorkerFactory;
|
||||
QnxQmlProfilerWorkerFactory qmlProfilerWorkerFactory;
|
||||
};
|
||||
|
||||
static QnxPluginPrivate *dd = nullptr;
|
||||
@@ -136,8 +127,7 @@ bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
void QnxPlugin::extensionsInitialized()
|
||||
{
|
||||
// Attach support
|
||||
connect(&dd->m_attachToQnxApplication, &QAction::triggered,
|
||||
this, [] { QnxAttachDebugSupport::showProcessesDialog(); });
|
||||
connect(&dd->m_attachToQnxApplication, &QAction::triggered, this, &showAttachToProcessDialog);
|
||||
|
||||
const char QNX_DEBUGGING_GROUP[] = "Debugger.Group.Qnx";
|
||||
|
||||
|
@@ -80,7 +80,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Id id)
|
||||
|
||||
QnxRunConfigurationFactory::QnxRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<QnxRunConfiguration>("Qt4ProjectManager.QNX.QNXRunConfiguration.");
|
||||
registerRunConfiguration<QnxRunConfiguration>(Constants::QNX_RUNCONFIG_ID);
|
||||
addSupportedTargetDeviceType(Constants::QNX_QNX_OS_TYPE);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user