Use SSH port forwarding for debugging

This feature is needed to enable debugging on remote targes which can
not expose gdbserver ports on the wild, and we must use ssh tunneling
for that job.

Change-Id: I6df712fd3b40790e89c79a7617a24430fde6805a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
BogDan Vatra
2024-03-26 14:42:17 +02:00
committed by BogDan Vatra
parent 4b29ad78e3
commit 3e4f50aeb9
8 changed files with 60 additions and 4 deletions

View File

@@ -30,6 +30,8 @@
#include <projectexplorer/taskhub.h>
#include <projectexplorer/toolchain.h>
#include <remotelinux/remotelinux_constants.h>
#include <utils/algorithm.h>
#include <utils/checkablemessagebox.h>
#include <utils/environment.h>
@@ -1060,7 +1062,15 @@ DebugServerRunner::DebugServerRunner(RunControl *runControl, DebugServerPortsGat
cmd.addArg("--multi");
if (m_pid.isValid())
cmd.addArg("--attach");
cmd.addArg(QString(":%1").arg(portsGatherer->gdbServer().port()));
const auto port = portsGatherer->gdbServer().port();
cmd.addArg(QString(":%1").arg(port));
if (runControl->device()->extraData(RemoteLinux::Constants::SshForwardDebugServerPort).toBool()) {
addExtraData(RemoteLinux::Constants::SshForwardPort, port);
addExtraData(RemoteLinux::Constants::DisableSharing, true);
}
if (m_pid.isValid())
cmd.addArg(QString::number(m_pid.pid()));
}