forked from qt-creator/qt-creator
RemoteLinux: Move portsUsedByDebugger() to DebuggerRunConfigurationAspect
Change-Id: I0add29c3c69c4ba59cea159f32ca74be58bcee59 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -292,6 +292,16 @@ bool DebuggerRunConfigurationAspect::isQmlDebuggingSpinboxSuppressed() const
|
|||||||
return dev->canAutoDetectPorts();
|
return dev->canAutoDetectPorts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DebuggerRunConfigurationAspect::portsUsedByDebugger() const
|
||||||
|
{
|
||||||
|
int ports = 0;
|
||||||
|
if (useQmlDebugger())
|
||||||
|
++ports;
|
||||||
|
if (useCppDebugger())
|
||||||
|
++ports;
|
||||||
|
return ports;
|
||||||
|
}
|
||||||
|
|
||||||
void DebuggerRunConfigurationAspect::toMap(QVariantMap &map) const
|
void DebuggerRunConfigurationAspect::toMap(QVariantMap &map) const
|
||||||
{
|
{
|
||||||
map.insert(QLatin1String(USE_CPP_DEBUGGER_KEY), d.useCppDebugger == EnabledLanguage);
|
map.insert(QLatin1String(USE_CPP_DEBUGGER_KEY), d.useCppDebugger == EnabledLanguage);
|
||||||
|
@@ -74,6 +74,8 @@ public:
|
|||||||
void setUseMultiProcess(bool on);
|
void setUseMultiProcess(bool on);
|
||||||
bool isQmlDebuggingSpinboxSuppressed() const;
|
bool isQmlDebuggingSpinboxSuppressed() const;
|
||||||
|
|
||||||
|
int portsUsedByDebugger() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Internal::DebuggerRunConfigWidget;
|
friend class Internal::DebuggerRunConfigWidget;
|
||||||
DebuggerRunConfigurationAspectData d;
|
DebuggerRunConfigurationAspectData d;
|
||||||
|
@@ -105,14 +105,17 @@ bool QnxRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id m
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QnxRunConfiguration * const rc = qobject_cast<QnxRunConfiguration *>(runConfiguration);
|
|
||||||
const QnxDeviceConfiguration::ConstPtr dev = DeviceKitInformation::device(runConfiguration->target()->kit())
|
const QnxDeviceConfiguration::ConstPtr dev = DeviceKitInformation::device(runConfiguration->target()->kit())
|
||||||
.dynamicCast<const QnxDeviceConfiguration>();
|
.dynamicCast<const QnxDeviceConfiguration>();
|
||||||
if (dev.isNull())
|
if (dev.isNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE || mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
|
if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE
|
||||||
return rc->portsUsedByDebuggers() <= dev->freePorts().count();
|
|| mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
|
||||||
|
auto aspect = runConfiguration->extraAspect<DebuggerRunConfigurationAspect>();
|
||||||
|
int portsUsed = aspect ? aspect->portsUsedByDebugger() : 0;
|
||||||
|
return portsUsed <= dev->freePorts().count();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -41,17 +41,4 @@ AbstractRemoteLinuxRunConfiguration::AbstractRemoteLinuxRunConfiguration(Project
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int AbstractRemoteLinuxRunConfiguration::portsUsedByDebuggers() const
|
|
||||||
{
|
|
||||||
int ports = 0;
|
|
||||||
Debugger::DebuggerRunConfigurationAspect *aspect
|
|
||||||
= extraAspect<Debugger::DebuggerRunConfigurationAspect>();
|
|
||||||
if (aspect->useQmlDebugger())
|
|
||||||
++ports;
|
|
||||||
if (aspect->useCppDebugger())
|
|
||||||
++ports;
|
|
||||||
|
|
||||||
return ports;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
@@ -48,8 +48,6 @@ public:
|
|||||||
virtual QString workingDirectory() const = 0;
|
virtual QString workingDirectory() const = 0;
|
||||||
virtual Utils::Environment environment() const = 0;
|
virtual Utils::Environment environment() const = 0;
|
||||||
|
|
||||||
int portsUsedByDebuggers() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AbstractRemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
|
AbstractRemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
|
||||||
AbstractRemoteLinuxRunConfiguration *source);
|
AbstractRemoteLinuxRunConfiguration *source);
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#include "remotelinuxruncontrol.h"
|
#include "remotelinuxruncontrol.h"
|
||||||
|
|
||||||
#include <debugger/debuggerruncontrol.h>
|
#include <debugger/debuggerruncontrol.h>
|
||||||
|
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||||
#include <debugger/debuggerstartparameters.h>
|
#include <debugger/debuggerstartparameters.h>
|
||||||
#include <analyzerbase/analyzermanager.h>
|
#include <analyzerbase/analyzermanager.h>
|
||||||
#include <analyzerbase/analyzerruncontrol.h>
|
#include <analyzerbase/analyzerruncontrol.h>
|
||||||
@@ -89,7 +90,10 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
|
|||||||
}
|
}
|
||||||
auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
|
auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
|
||||||
QTC_ASSERT(rc, return 0);
|
QTC_ASSERT(rc, return 0);
|
||||||
if (rc->portsUsedByDebuggers() > dev->freePorts().count()) {
|
|
||||||
|
auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
|
||||||
|
int portsUsed = aspect ? aspect->portsUsedByDebugger() : 0;
|
||||||
|
if (portsUsed > dev->freePorts().count()) {
|
||||||
*errorMessage = tr("Cannot debug: Not enough free ports available.");
|
*errorMessage = tr("Cannot debug: Not enough free ports available.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user