Use Utils::Port where possible

This solves the ambiguity between 0 and -1 being the "invalid" port.

Change-Id: I3bac11dd4117bb1820fbd58186699925b73df1c5
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2016-04-19 16:43:30 +02:00
parent e14238650c
commit 385237dbbd
62 changed files with 239 additions and 187 deletions

View File

@@ -105,14 +105,14 @@ void QnxAttachDebugSupport::launchPDebug()
{
Utils::PortList portList = m_device->freePorts();
m_pdebugPort = m_portsGatherer->getNextFreePort(&portList);
if (m_pdebugPort == -1) {
if (!m_pdebugPort.isValid()) {
handleError(tr("No free ports for debugging."));
return;
}
StandardRunnable r;
r.executable = QLatin1String("pdebug");
r.commandLineArguments = QString::number(m_pdebugPort);
r.commandLineArguments = QString::number(m_pdebugPort.number());
m_runner->start(m_device, r);
}
@@ -122,9 +122,11 @@ void QnxAttachDebugSupport::attachToProcess()
sp.attachPID = m_process.pid;
sp.startMode = Debugger::AttachToRemoteServer;
sp.closeMode = Debugger::DetachAtClose;
sp.connParams.port = m_pdebugPort;
sp.remoteChannel = m_device->sshParameters().host + QLatin1Char(':') + QString::number(m_pdebugPort);
sp.displayName = tr("Remote: \"%1:%2\" - Process %3").arg(sp.connParams.host).arg(m_pdebugPort).arg(m_process.pid);
sp.connParams.port = m_pdebugPort.number();
sp.remoteChannel = m_device->sshParameters().host + QLatin1Char(':') +
QString::number(m_pdebugPort.number());
sp.displayName = tr("Remote: \"%1:%2\" - Process %3").arg(sp.connParams.host)
.arg(m_pdebugPort.number()).arg(m_process.pid);
sp.inferior.executable = m_localExecutablePath;
sp.useCtrlCStub = true;