forked from qt-creator/qt-creator
iOS: Fix slow debugging with recent Xcode and iOS < 17
When starting the debugger, we need to pass it the location of the downloaded device symbols, or otherwise debugger startup is very slow. Xcode changes the location where it saves this information once in a while, and it must have again. The location with Xcode 15.2 at least is in the style "iPhone8,1 15.7.3 (19H307)", i.e. it starts with the "product type" now. Retrieve the product type of the device and add another candidate directory for device symbols. Fixes: QTCREATORBUG-31044 Change-Id: I1a65305fc84c1af8cd48c4ebb249167e1dbe6ae1 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -73,6 +73,7 @@ expected_str<QMap<QString, QString>> parseDeviceInfo(const QByteArray &rawOutput
|
||||
info[kOsVersion] = QLatin1String("%1 (%2)")
|
||||
.arg(device["deviceProperties"]["osVersionNumber"].toString(),
|
||||
device["deviceProperties"]["osBuildUpdate"].toString());
|
||||
info[kProductType] = device["hardwareProperties"]["productType"].toString();
|
||||
info[kCpuArchitecture] = device["hardwareProperties"]["cpuType"]["name"].toString();
|
||||
info[kUniqueDeviceId] = udid;
|
||||
return info;
|
||||
|
@@ -13,6 +13,7 @@ const char kDeviceName[] = "deviceName";
|
||||
const char kDeveloperStatus[] = "developerStatus";
|
||||
const char kDeviceConnected[] = "deviceConnected";
|
||||
const char kOsVersion[] = "osVersion";
|
||||
const char kProductType[] = "productType";
|
||||
const char kCpuArchitecture[] = "cpuArchitecture";
|
||||
const char kUniqueDeviceId[] = "uniqueDeviceId";
|
||||
const char vOff[] = "*off*";
|
||||
|
@@ -92,8 +92,9 @@ public:
|
||||
Form {
|
||||
Tr::tr("Device name:"), iosDevice->deviceName(), br,
|
||||
Tr::tr("Identifier:"), iosDevice->uniqueInternalDeviceId(), br,
|
||||
Tr::tr("Product type:"), iosDevice->productType(), br,
|
||||
Tr::tr("CPU Architecture:"), iosDevice->cpuArchitecture(), br,
|
||||
Tr::tr("OS Version:"), iosDevice->osVersion(), br,
|
||||
Tr::tr("CPU Architecture:"), iosDevice->cpuArchitecture(),
|
||||
noMargin
|
||||
}.attachTo(this);
|
||||
// clang-format on
|
||||
@@ -193,6 +194,11 @@ QString IosDevice::osVersion() const
|
||||
return m_extraInfo.value(kOsVersion);
|
||||
}
|
||||
|
||||
QString IosDevice::productType() const
|
||||
{
|
||||
return m_extraInfo.value(kProductType);
|
||||
}
|
||||
|
||||
QString IosDevice::cpuArchitecture() const
|
||||
{
|
||||
return m_extraInfo.value(kCpuArchitecture);
|
||||
@@ -227,6 +233,7 @@ IosDeviceManager::TranslationMap IosDeviceManager::translationMap()
|
||||
tMap[QLatin1String("NO")] = Tr::tr("no");
|
||||
tMap[QLatin1String("*unknown*")] = Tr::tr("unknown");
|
||||
tMap[kOsVersion] = Tr::tr("OS version");
|
||||
tMap[kProductType] = Tr::tr("Product type");
|
||||
translationMap = &tMap;
|
||||
return tMap;
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ public:
|
||||
QString uniqueDeviceID() const;
|
||||
QString uniqueInternalDeviceId() const;
|
||||
QString osVersion() const;
|
||||
QString productType() const;
|
||||
QString cpuArchitecture() const;
|
||||
Utils::Port nextPort() const;
|
||||
Handler handler() const;
|
||||
|
@@ -813,14 +813,17 @@ void IosDebugSupport::start()
|
||||
setStartMode(AttachToRemoteProcess);
|
||||
setIosPlatform("remote-ios");
|
||||
const QString osVersion = dev->osVersion();
|
||||
const QString productType = dev->productType();
|
||||
const QString cpuArchitecture = dev->cpuArchitecture();
|
||||
const FilePaths symbolsPathCandidates = {
|
||||
FilePath::fromString(QDir::homePath() + "/Library/Developer/Xcode/iOS DeviceSupport/"
|
||||
+ osVersion + " " + cpuArchitecture + "/Symbols"),
|
||||
FilePath::fromString(QDir::homePath() + "/Library/Developer/Xcode/iOS DeviceSupport/"
|
||||
+ osVersion + "/Symbols"),
|
||||
IosConfigurations::developerPath().pathAppended(
|
||||
"Platforms/iPhoneOS.platform/DeviceSupport/" + osVersion + "/Symbols")};
|
||||
const FilePath home = FilePath::fromString(QDir::homePath());
|
||||
const FilePaths symbolsPathCandidates
|
||||
= {home / "Library/Developer/Xcode/iOS DeviceSupport" / (productType + " " + osVersion)
|
||||
/ "Symbols",
|
||||
home / "Library/Developer/Xcode/iOS DeviceSupport"
|
||||
/ (osVersion + " " + cpuArchitecture) / "Symbols",
|
||||
home / "Library/Developer/Xcode/iOS DeviceSupport" / osVersion / "Symbols",
|
||||
IosConfigurations::developerPath() / "Platforms/iPhoneOS.platform/DeviceSupport"
|
||||
/ osVersion / "Symbols"};
|
||||
const FilePath deviceSdk = Utils::findOrDefault(symbolsPathCandidates, &FilePath::isDir);
|
||||
|
||||
if (deviceSdk.isEmpty()) {
|
||||
|
@@ -1662,6 +1662,7 @@ void DevInfoSession::deviceCallbackReturned()
|
||||
const QString osVersionKey = "osVersion";
|
||||
const QString cpuArchitectureKey = "cpuArchitecture";
|
||||
const QString uniqueDeviceId = "uniqueDeviceId";
|
||||
const QString productType = "productType";
|
||||
bool failure = !device;
|
||||
if (!failure) {
|
||||
failure = !connectDevice();
|
||||
@@ -1669,6 +1670,7 @@ void DevInfoSession::deviceCallbackReturned()
|
||||
res[deviceConnectedKey] = QLatin1String("YES");
|
||||
res[deviceNameKey] = getStringValue(device, nullptr, CFSTR("DeviceName"));
|
||||
res[uniqueDeviceId] = getStringValue(device, nullptr, CFSTR("UniqueDeviceID"));
|
||||
res[productType] = getStringValue(device, nullptr, CFSTR("ProductType"));
|
||||
const QString productVersion = getStringValue(device, nullptr, CFSTR("ProductVersion"));
|
||||
res[developerStatusKey] = getStringValue(device,
|
||||
CFSTR("com.apple.xcode.developerdomain"),
|
||||
|
@@ -287,6 +287,7 @@ void tst_Devicectlutils::parseDeviceInfo_data()
|
||||
{"deviceConnected", "YES"},
|
||||
{"deviceName", "Some iOS device"},
|
||||
{"osVersion", "17.3 (21D50)"},
|
||||
{"productType", "iPad11,2"},
|
||||
{"uniqueDeviceId", "00000000-0000000000000000"}});
|
||||
QTest::addRow("unhandled device")
|
||||
<< data << QString("000000000000000000000001")
|
||||
|
Reference in New Issue
Block a user