From fd90cf0a827931a08e80279ced8748ba6b3864d6 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 13 Jun 2022 17:10:03 +0200 Subject: [PATCH] Fix debugging on iOS The RunControl nowadays asks DeviceManager::deviceForPath(runnable.command.executable) to get the device, instead of passing that through the runnable. Since the runnable's command executable is set via IDevice::filePath(pathOnDevice), where "pathOnDevice" by default is from the executableAspect, IDevice::filePath should actually return a "global" path in the form of "device:///". Since we do not want "device:...." paths for the desktop, return the simple path in that case only instead. Fixes: QTCREATORBUG-27709 Change-Id: I75f9406cf3254980e1fee203275b0e72202b7b6d Reviewed-by: Jarek Kobus Reviewed-by: hjk --- .../devicesupport/desktopdevice.cpp | 6 ++++++ .../projectexplorer/devicesupport/desktopdevice.h | 1 + .../projectexplorer/devicesupport/idevice.cpp | 15 +++++++++++++-- src/plugins/remotelinux/linuxdevice.cpp | 14 -------------- src/plugins/remotelinux/linuxdevice.h | 1 - 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index 1ffbdba5f71..64e9556995d 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -179,6 +179,12 @@ bool DesktopDevice::setPermissions(const FilePath &filePath, QFile::Permissions return filePath.setPermissions(permissions); } +FilePath DesktopDevice::mapToGlobalPath(const Utils::FilePath &pathOnDevice) const +{ + QTC_CHECK(!pathOnDevice.needsDevice()); + return pathOnDevice; +} + Environment DesktopDevice::systemEnvironment() const { return Environment::systemEnvironment(); diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.h b/src/plugins/projectexplorer/devicesupport/desktopdevice.h index 391bf53997f..37dc326a989 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.h +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.h @@ -79,6 +79,7 @@ public: qint64 fileSize(const Utils::FilePath &filePath) const override; QFile::Permissions permissions(const Utils::FilePath &filePath) const override; bool setPermissions(const Utils::FilePath &filePath, QFile::Permissions) const override; + Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const override; protected: DesktopDevice(); diff --git a/src/plugins/projectexplorer/devicesupport/idevice.cpp b/src/plugins/projectexplorer/devicesupport/idevice.cpp index 69344b44a2c..f7ca5633bb7 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/idevice.cpp @@ -212,7 +212,17 @@ bool IDevice::isAnyUnixDevice() const FilePath IDevice::mapToGlobalPath(const FilePath &pathOnDevice) const { - return pathOnDevice; + if (pathOnDevice.needsDevice()) { + // Already correct form, only sanity check it's ours... + QTC_CHECK(handlesFile(pathOnDevice)); + return pathOnDevice; + } + // match DeviceManager::deviceForPath + FilePath result; + result.setPath(pathOnDevice.path()); + result.setScheme("device"); + result.setHost(id().toString()); + return result; } QString IDevice::mapToDevicePath(const FilePath &globalPath) const @@ -227,7 +237,8 @@ FilePath IDevice::filePath(const QString &pathOnDevice) const bool IDevice::handlesFile(const FilePath &filePath) const { - Q_UNUSED(filePath); + if (filePath.scheme() == "device" && filePath.host() == id().toString()) + return true; return false; } diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 9f68025c688..edc6a624562 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -1104,20 +1104,6 @@ QString LinuxDevice::userAtHost() const return sshParameters().userAtHost(); } -FilePath LinuxDevice::mapToGlobalPath(const FilePath &pathOnDevice) const -{ - if (pathOnDevice.needsDevice()) { - // Already correct form, only sanity check it's ours... - QTC_CHECK(handlesFile(pathOnDevice)); - return pathOnDevice; - } - FilePath result; - result.setScheme("device"); - result.setHost(id().toString()); - result.setPath(pathOnDevice.path()); - return result; -} - bool LinuxDevice::handlesFile(const FilePath &filePath) const { if (filePath.scheme() == "device" && filePath.host() == id().toString()) diff --git a/src/plugins/remotelinux/linuxdevice.h b/src/plugins/remotelinux/linuxdevice.h index 1b286ac1080..2e7000a09dd 100644 --- a/src/plugins/remotelinux/linuxdevice.h +++ b/src/plugins/remotelinux/linuxdevice.h @@ -56,7 +56,6 @@ public: ProjectExplorer::DeviceEnvironmentFetcher::Ptr environmentFetcher() const override; QString userAtHost() const; - Utils::FilePath mapToGlobalPath(const Utils::FilePath &pathOnDevice) const override; bool handlesFile(const Utils::FilePath &filePath) const override; bool isExecutableFile(const Utils::FilePath &filePath) const override;