Skip to content
Snippets Groups Projects
Commit 4e832deb authored by Aurindam Jana's avatar Aurindam Jana
Browse files

Valgrind: Use a port from the device port range


Change-Id: I046e536dfca0c84dd0dba4901aa316a31d4c4b43
Reviewed-by: default avatarChristiaan Janssen <christiaan.janssen@digia.com>
parent ae7bf03b
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment