forked from qt-creator/qt-creator
RemoteLinux: Improve API for retrieving ports and fifos
Change-Id: I8aa808d5ffe12954a44031ec2f3d1c5ef8185eef Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
@@ -119,24 +119,14 @@ void AbstractRemoteLinuxRunSupport::setFinished()
|
||||
d->state = Inactive;
|
||||
}
|
||||
|
||||
bool AbstractRemoteLinuxRunSupport::setPort(Utils::Port &port)
|
||||
Utils::Port AbstractRemoteLinuxRunSupport::findPort() const
|
||||
{
|
||||
port = d->portsGatherer.getNextFreePort(&d->portList);
|
||||
if (!port.isValid()) {
|
||||
handleAdapterSetupFailed(tr("Not enough free ports on device for debugging."));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return d->portsGatherer.getNextFreePort(&d->portList);
|
||||
}
|
||||
|
||||
bool AbstractRemoteLinuxRunSupport::setFifo(QString &fifo)
|
||||
QString AbstractRemoteLinuxRunSupport::fifo() const
|
||||
{
|
||||
if (d->fifo.isEmpty()) {
|
||||
handleAdapterSetupFailed(tr("FIFO for profiling data could not be created."));
|
||||
return false;
|
||||
}
|
||||
fifo = d->fifo;
|
||||
return true;
|
||||
return d->fifo;
|
||||
}
|
||||
|
||||
void AbstractRemoteLinuxRunSupport::startPortsGathering()
|
||||
|
||||
@@ -69,11 +69,12 @@ protected:
|
||||
virtual void handleAdapterSetupDone();
|
||||
|
||||
void setFinished();
|
||||
bool setPort(Utils::Port &port);
|
||||
bool setFifo(QString &fifo);
|
||||
|
||||
void startPortsGathering();
|
||||
Utils::Port findPort() const;
|
||||
|
||||
void createRemoteFifo();
|
||||
QString fifo() const;
|
||||
|
||||
const ProjectExplorer::IDevice::ConstPtr device() const;
|
||||
const ProjectExplorer::StandardRunnable &runnable() const;
|
||||
|
||||
@@ -128,10 +128,19 @@ void RemoteLinuxAnalyzeSupport::startExecution()
|
||||
{
|
||||
QTC_ASSERT(state() == GatheringResources, return);
|
||||
|
||||
if (d->runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE && !setPort(d->qmlPort))
|
||||
if (d->runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
|
||||
d->qmlPort = findPort();
|
||||
if (!d->qmlPort.isValid()) {
|
||||
handleAdapterSetupFailed(tr("Not enough free ports on device for profiling."));
|
||||
return;
|
||||
if (d->runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE && !setFifo(d->remoteFifo))
|
||||
}
|
||||
} else if (d->runMode == ProjectExplorer::Constants::PERFPROFILER_RUN_MODE) {
|
||||
d->remoteFifo = fifo();
|
||||
if (d->remoteFifo.isEmpty()) {
|
||||
handleAdapterSetupFailed(tr("FIFO for profiling data could not be created."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setState(StartingRunner);
|
||||
|
||||
|
||||
@@ -110,10 +110,20 @@ void LinuxDeviceDebugSupport::startExecution()
|
||||
{
|
||||
QTC_ASSERT(state() == GatheringResources, return);
|
||||
|
||||
if (d->cppDebugging && !setPort(d->gdbServerPort))
|
||||
if (d->cppDebugging) {
|
||||
d->gdbServerPort = findPort();
|
||||
if (!d->gdbServerPort.isValid()) {
|
||||
handleAdapterSetupFailed(tr("Not enough free ports on device for C++ debugging."));
|
||||
return;
|
||||
if (d->qmlDebugging && !setPort(d->qmlPort))
|
||||
}
|
||||
}
|
||||
if (d->qmlDebugging) {
|
||||
d->qmlPort = findPort();
|
||||
if (!d->qmlPort.isValid()) {
|
||||
handleAdapterSetupFailed(tr("Not enough free ports on device for QML debugging."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setState(StartingRunner);
|
||||
d->gdbserverOutput.clear();
|
||||
|
||||
Reference in New Issue
Block a user