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/projectexplorer.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <utils/tcpportsgatherer.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace RemoteLinux;
|
||||
@@ -65,15 +68,23 @@ Analyzer::AnalyzerStartParameters ValgrindTool::createStartParameters(
|
||||
qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration)) {
|
||||
ProjectExplorer::EnvironmentAspect *aspect
|
||||
= runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>();
|
||||
sp.startMode = Analyzer::StartLocal;
|
||||
if (aspect)
|
||||
sp.environment = aspect->environment();
|
||||
sp.workingDirectory = rc1->workingDirectory();
|
||||
sp.debuggee = rc1->executable();
|
||||
sp.debuggeeArgs = rc1->commandLineArguments();
|
||||
sp.connParams.host = QLatin1String("localhost");
|
||||
sp.connParams.port = rc1->extraAspect<Debugger::DebuggerRunConfigurationAspect>()
|
||||
->qmlDebugServerPort();
|
||||
const ProjectExplorer::IDevice::ConstPtr device =
|
||||
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 =
|
||||
qobject_cast<RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
sp.startMode = Analyzer::StartRemote;
|
||||
|
||||
Reference in New Issue
Block a user