Debugger: Start debugserver for remote macOS

Change-Id: I5f713892dfbaaaecb7459c288df109bfe337f891
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-04-06 06:58:39 +02:00
parent 522de9bfd7
commit 3cd5e32e9c

View File

@@ -1039,14 +1039,37 @@ DebugServerRunner::DebugServerRunner(RunControl *runControl, DebugServerPortsGat
cmd.setExecutable(commandLine().executable()); // FIXME: Case should not happen?
} else {
cmd.setExecutable(runControl->device()->debugServerPath());
if (cmd.isEmpty())
if (cmd.isEmpty()) {
if (runControl->device()->osType() == Utils::OsTypeMac) {
const FilePath debugServerLocation = runControl->device()->filePath(
"/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/"
"Resources/debugserver");
if (debugServerLocation.isExecutableFile()) {
cmd.setExecutable(debugServerLocation);
} else {
// TODO: In the future it is expected that the debugserver will be
// replaced by lldb-server. Remove the check for debug server at that point.
const FilePath lldbserver
= runControl->device()->filePath("lldb-server").searchInPath();
if (lldbserver.isExecutableFile())
cmd.setExecutable(lldbserver);
}
} else {
cmd.setExecutable(runControl->device()->filePath("gdbserver"));
}
}
args.clear();
if (cmd.executable().toString().contains("lldb-server")) {
if (cmd.executable().baseName().contains("lldb-server")) {
args.append("platform");
args.append("--listen");
args.append(QString("*:%1").arg(portsGatherer->gdbServer().port()));
args.append("--server");
} else if (cmd.executable().baseName() == "debugserver") {
args.append(QString("*:%1").arg(portsGatherer->gdbServer().port()));
args.append("--attach");
args.append(QString::number(m_pid.pid()));
} else {
// Something resembling gdbserver
if (m_useMulti)