debugger: simpler handling of the ipv6 case

Change-Id: If1d5bdd5afd2aeebfcf39e72045ef4327cb84c0c
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
hjk
2012-02-29 17:14:03 +01:00
committed by hjk
parent dd2309fa45
commit 59594ad297
3 changed files with 19 additions and 17 deletions

View File

@@ -247,14 +247,24 @@ void RemoteGdbServerAdapter::callTargetRemote()
// (1) connects to the gdb server // (1) connects to the gdb server
// (2) starts the remote application // (2) starts the remote application
// (3) stops the remote application (early, e.g. in the dynamic linker) // (3) stops the remote application (early, e.g. in the dynamic linker)
QString channel = startParameters().remoteChannel; QByteArray channel = startParameters().remoteChannel.toLatin1();
if (m_engine->m_isQnxGdb) {
m_engine->postCommand("target qnx " + channel.toLatin1(), // Don't touch channels with explicitly set protocols.
CB(handleTargetQnx)); if (!channel.startsWith("tcp:") && !channel.startsWith("udp:")
} else { && !channel.startsWith("file:") && channel.contains(':'))
m_engine->postCommand("target remote " + channel.toLatin1(), {
CB(handleTargetRemote)); // "Fix" the IPv6 case with host names without '['...']'
if (!channel.startsWith('[') && channel.count(':') >= 2) {
channel.insert(0, '[');
channel.insert(channel.lastIndexOf(':'), ']');
} }
channel = "tcp:" + channel;
}
if (m_engine->m_isQnxGdb)
m_engine->postCommand("target qnx " + channel, CB(handleTargetQnx));
else
m_engine->postCommand("target remote " + channel, CB(handleTargetRemote));
} }
void RemoteGdbServerAdapter::handleTargetRemote(const GdbResponse &record) void RemoteGdbServerAdapter::handleTargetRemote(const GdbResponse &record)

View File

@@ -110,10 +110,7 @@ DebuggerStartParameters AbstractRemoteLinuxDebugSupport::startParameters(const R
params.startMode = AttachToRemoteServer; params.startMode = AttachToRemoteServer;
params.executable = runConfig->localExecutableFilePath(); params.executable = runConfig->localExecutableFilePath();
params.debuggerCommand = runConfig->gdbCmd(); params.debuggerCommand = runConfig->gdbCmd();
QString host = devConf->sshParameters().host; params.remoteChannel = devConf->sshParameters().host + QLatin1String(":-1");
params.remoteChannel = host.contains(QLatin1Char(':'))
? QString::fromLatin1("[%1]:-1").arg(host)
: host + QLatin1String(":-1");
// TODO: This functionality should be inside the debugger. // TODO: This functionality should be inside the debugger.
const ProjectExplorer::Abi &abi = runConfig->target() const ProjectExplorer::Abi &abi = runConfig->target()

View File

@@ -359,12 +359,7 @@ void StartGdbServerDialog::reportOpenPort(int port)
return; return;
LinuxDeviceConfiguration::ConstPtr device = d->currentDevice(); LinuxDeviceConfiguration::ConstPtr device = d->currentDevice();
QString host = device->sshParameters().host; QString channel = QString("%1:%2").arg(device->sshParameters().host).arg(port);
QString channel;
if (host.contains(QLatin1Char(':')))
channel = QString::fromLatin1("[%1]:%2").arg(host).arg(port);
else
channel = QString::fromLatin1("%1:%2").arg(host).arg(port);
logMessage(tr("Server started on %1").arg(channel)); logMessage(tr("Server started on %1").arg(channel));
QMetaObject::invokeMethod(ob, "gdbServerStarted", Qt::QueuedConnection, QMetaObject::invokeMethod(ob, "gdbServerStarted", Qt::QueuedConnection,