forked from qt-creator/qt-creator
Valgrind: Use a port from the device port range
Change-Id: I046e536dfca0c84dd0dba4901aa316a31d4c4b43 Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
This commit is contained in:
@@ -37,6 +37,9 @@
|
|||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
#include <utils/tcpportsgatherer.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace RemoteLinux;
|
using namespace RemoteLinux;
|
||||||
@@ -65,15 +68,23 @@ Analyzer::AnalyzerStartParameters ValgrindTool::createStartParameters(
|
|||||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||||
ProjectExplorer::EnvironmentAspect *aspect
|
ProjectExplorer::EnvironmentAspect *aspect
|
||||||
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||||
sp.startMode = Analyzer::StartLocal;
|
|
||||||
if (aspect)
|
if (aspect)
|
||||||
sp.environment = aspect->environment();
|
sp.environment = aspect->environment();
|
||||||
sp.workingDirectory = rc1->workingDirectory();
|
sp.workingDirectory = rc1->workingDirectory();
|
||||||
sp.debuggee = rc1->executable();
|
sp.debuggee = rc1->executable();
|
||||||
sp.debuggeeArgs = rc1->commandLineArguments();
|
sp.debuggeeArgs = rc1->commandLineArguments();
|
||||||
sp.connParams.host = QLatin1String("localhost");
|
sp.connParams.host = QLatin1String("localhost");
|
||||||
sp.connParams.port = rc1->extraAspect<Debugger::DebuggerRunConfigurationAspect>()
|
const ProjectExplorer::IDevice::ConstPtr device =
|
||||||
->qmlDebugServerPort();
|
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
|
||||||
|
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return sp);
|
||||||
|
Utils::TcpPortsGatherer portsGatherer;
|
||||||
|
portsGatherer.update(QAbstractSocket::UnknownNetworkLayerProtocol);
|
||||||
|
Utils::PortList portList = device->freePorts();
|
||||||
|
int freePort = portsGatherer.getNextFreePort(&portList);
|
||||||
|
if (freePort == -1)
|
||||||
|
return sp;
|
||||||
|
sp.connParams.port = freePort;
|
||||||
|
sp.startMode = Analyzer::StartLocal;
|
||||||
} else if (RemoteLinuxRunConfiguration *rc2 =
|
} else if (RemoteLinuxRunConfiguration *rc2 =
|
||||||
qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||||
sp.startMode = Analyzer::StartRemote;
|
sp.startMode = Analyzer::StartRemote;
|
||||||
|
|||||||
Reference in New Issue
Block a user