summaryrefslogtreecommitdiff
path: root/src/plugins/qnx/qnxdebugsupport.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-09-02 18:22:35 +0200
committerhjk <hjk@qt.io>2019-09-04 11:08:34 +0000
commit4028a41d2eb00649fb97c1f78be90a2cf42c7adf (patch)
tree2544a317c15722b849e5f4513f65160eced8b8fc /src/plugins/qnx/qnxdebugsupport.cpp
parent8d85a7c2bc011a06dff3a85e47b6ecfa5cdaed24 (diff)
downloadqt-creator-4028a41d2eb00649fb97c1f78be90a2cf42c7adf.tar.gz
ProjectExplorer: Use std::function for SimpleTargetRunner::start()
This spares us the typical r = runnable(); modify(r); setRunnable(r) roundtrip and the m_runnable storage that might or might not be the same as runControl->runnable. Similar for m_device. Change-Id: I8300260dd8dd7cd395e40bcd3d2ae45089085008 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/qnx/qnxdebugsupport.cpp')
-rw-r--r--src/plugins/qnx/qnxdebugsupport.cpp66
1 files changed, 27 insertions, 39 deletions
diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp
index 8b5cde356a..54a0c5c223 100644
--- a/src/plugins/qnx/qnxdebugsupport.cpp
+++ b/src/plugins/qnx/qnxdebugsupport.cpp
@@ -97,34 +97,28 @@ class QnxDebuggeeRunner : public ProjectExplorer::SimpleTargetRunner
{
public:
QnxDebuggeeRunner(RunControl *runControl, GdbServerPortsGatherer *portsGatherer)
- : SimpleTargetRunner(runControl), m_portsGatherer(portsGatherer)
+ : SimpleTargetRunner(runControl)
{
setId("QnxDebuggeeRunner");
- }
-private:
- void start() final
- {
- Runnable r = runnable();
- QStringList arguments;
- if (m_portsGatherer->useGdbServer()) {
- int pdebugPort = m_portsGatherer->gdbServer().port();
- r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE);
- arguments.append(QString::number(pdebugPort));
- }
- if (m_portsGatherer->useQmlServer()) {
- arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices,
- m_portsGatherer->qmlServer()));
- }
- arguments.append(QtcProcess::splitArgs(r.commandLineArguments));
- r.commandLineArguments = QtcProcess::joinArgs(arguments);
-
- setRunnable(r);
-
- SimpleTargetRunner::start();
+ setStarter([this, runControl, portsGatherer] {
+ Runnable r = runControl->runnable();
+ QStringList arguments;
+ if (portsGatherer->useGdbServer()) {
+ int pdebugPort = portsGatherer->gdbServer().port();
+ r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE);
+ arguments.append(QString::number(pdebugPort));
+ }
+ if (portsGatherer->useQmlServer()) {
+ arguments.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices,
+ portsGatherer->qmlServer()));
+ }
+ arguments.append(QtcProcess::splitArgs(r.commandLineArguments));
+ r.commandLineArguments = QtcProcess::joinArgs(arguments);
+
+ doStart(r, runControl->device());
+ });
}
-
- GdbServerPortsGatherer *m_portsGatherer;
};
@@ -197,26 +191,20 @@ class PDebugRunner : public ProjectExplorer::SimpleTargetRunner
{
public:
PDebugRunner(RunControl *runControl, GdbServerPortsGatherer *portsGatherer)
- : SimpleTargetRunner(runControl), m_portsGatherer(portsGatherer)
+ : SimpleTargetRunner(runControl)
{
setId("PDebugRunner");
- addStartDependency(m_portsGatherer);
- }
+ addStartDependency(portsGatherer);
-private:
- void start() final
- {
- const int pdebugPort = m_portsGatherer->gdbServer().port();
-
- Runnable r;
- r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE);
- r.commandLineArguments = QString::number(pdebugPort);
- setRunnable(r);
+ setStarter([this, runControl, portsGatherer] {
+ const int pdebugPort = portsGatherer->gdbServer().port();
- SimpleTargetRunner::start();
+ Runnable r;
+ r.executable = FilePath::fromString(Constants::QNX_DEBUG_EXECUTABLE);
+ r.commandLineArguments = QString::number(pdebugPort);
+ doStart(r, runControl->device());
+ });
}
-
- GdbServerPortsGatherer *m_portsGatherer;
};
QnxAttachDebugSupport::QnxAttachDebugSupport(RunControl *runControl)