Commit 323a0c62 authored by Fawzi Mohamed's avatar Fawzi Mohamed
Browse files

ios: speed up device debugging



Correctly use the device specific cached symbols to avoid downloading
them from the device (big slowdown).

Task-number: QTCREATORBUG-10884
Change-Id: Ic82482e4b1dadf55f695a67fd420ac1b095a3ca1
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 55ec629e
......@@ -594,10 +594,11 @@ class Dumper(DumperBase):
self.remoteChannel_ = args.get('remoteChannel', '')
self.platform_ = args.get('platform', '')
if self.sysRoot_:
self.debugger.SetCurrentPlatformSDKRoot(self.sysRoot_)
if self.platform_:
self.debugger.SetCurrentPlatform(self.platform_)
# sysroot has to be set *after* the platform
if self.sysRoot_:
self.debugger.SetCurrentPlatformSDKRoot(self.sysRoot_)
self.target = self.debugger.CreateTarget(self.executable_, None, None, True, error)
self.importDumpers()
......
......@@ -86,6 +86,7 @@ public:
DebuggerEngineType secondSlaveEngineType;
DebuggerEngineType cppEngineType;
QString sysRoot;
QString deviceSymbolsRoot;
QString debuggerCommand;
ProjectExplorer::Abi toolChainAbi;
ProjectExplorer::IDevice::ConstPtr device;
......
......@@ -203,7 +203,7 @@ void LldbEngine::setupInferior()
QTC_CHECK(sp.attachPID <= 0 || (sp.startMode == AttachCrashedExternal
|| sp.startMode == AttachExternal));
cmd.arg("attachPid", sp.attachPID);
cmd.arg("sysRoot", sp.sysRoot);
cmd.arg("sysRoot", sp.deviceSymbolsRoot.isEmpty() ? sp.sysRoot : sp.deviceSymbolsRoot);
cmd.arg("remoteChannel", ((sp.startMode == AttachToRemoteProcess
|| sp.startMode == AttachToRemoteServer)
? sp.remoteChannel : QString()));
......
......@@ -31,6 +31,7 @@
#include "iosrunner.h"
#include "iosmanager.h"
#include "iosdevice.h"
#include <debugger/debuggerengine.h>
#include <debugger/debuggerplugin.h>
......@@ -40,10 +41,12 @@
#include <debugger/debuggerrunconfigurationaspect.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
#include <qmakeprojectmanager/qmakenodes.h>
#include <qmakeprojectmanager/qmakeproject.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/fileutils.h>
#include <QDir>
#include <QTcpServer>
......@@ -73,11 +76,38 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
if (device.isNull())
return 0;
QmakeProject *project = static_cast<QmakeProject *>(target->project());
Kit *kit = target->kit();
DebuggerStartParameters params;
if (device->type() == Core::Id(Ios::Constants::IOS_DEVICE_TYPE)) {
params.startMode = AttachToRemoteProcess;
params.platform = QLatin1String("remote-ios");
IosDevice::ConstPtr iosDevice = device.dynamicCast<const IosDevice>();
if (iosDevice.isNull())
return 0;
QString osVersion = iosDevice->osVersion();
Utils::FileName deviceSdk1 = Utils::FileName::fromString(QDir::homePath()
+ QLatin1String("/Library/Developer/Xcode/iOS DeviceSupport/")
+ osVersion + QLatin1String("/Symbols"));
QString deviceSdk;
if (deviceSdk1.toFileInfo().isDir()) {
deviceSdk = deviceSdk1.toString();
} else {
Utils::FileName deviceSdk2 = IosConfigurations::developerPath()
.appendPath(QLatin1String("Platforms/iPhoneOS.platform/DeviceSupport/"))
.appendPath(osVersion).appendPath(QLatin1String("Symbols"));
if (deviceSdk2.toFileInfo().isDir()) {
deviceSdk = deviceSdk2.toString();
} else {
TaskHub::addTask(Task::Warning, tr(
"Could not find device specific debug symbols at %1. "
"Debugging initialization will be slow until you open the Organizer window of "
"Xcode with the device connected to have the symbols generated.")
.arg(deviceSdk1.toUserOutput()),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
}
}
params.deviceSymbolsRoot = deviceSdk;
} else {
params.startMode = AttachExternal;
params.platform = QLatin1String("ios-simulator");
......@@ -91,7 +121,6 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi
= runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>();
if (aspect->useCppDebugger()) {
params.languages |= CppLanguage;
Kit *kit = target->kit();
params.sysRoot = SysRootKitInformation::sysRoot(kit).toString();
params.debuggerCommand = DebuggerKitInformation::debuggerCommand(kit).toString();
if (ToolChain *tc = ToolChainKitInformation::toolChain(kit))
......
......@@ -190,21 +190,11 @@ QString IosDevice::name()
return QCoreApplication::translate("Ios::Internal::IosDevice", "iOS Device");
}
/*
// add back?
QString IosDevice::cpuArchitecure() const
QString IosDevice::osVersion() const
{
return m_extraInfo.value(QLatin1String("deviceInfo")).toMap()
.value(QLatin1String("CPUArchitecture")).toString();
return m_extraInfo.value(QLatin1String("osVersion"));
}
QString IosDevice::productType() const
{
return m_extraInfo.value(QLatin1String("deviceInfo")).toMap()
.value(QLatin1String("ProductType")).toString();
}*/
// IosDeviceManager
......@@ -222,6 +212,7 @@ IosDeviceManager::TranslationMap IosDeviceManager::translationMap()
tMap[QLatin1String("NO")] = tr("no");
tMap[QLatin1String("YES")] = tr("yes");
tMap[QLatin1String("*unknown*")] = tr("unknown");
tMap[QLatin1String("osVersion")] = tr("OS version");
translationMap = &tMap;
return tMap;
}
......
......@@ -65,9 +65,7 @@ public:
QVariantMap toMap() const;
QString uniqueDeviceID() const;
IosDevice(const QString &uid);
// add back? currently unused...
//QString cpuArchitecure() const;
//QString productType() const;
QString osVersion() const;
static QString name();
......
......@@ -1227,6 +1227,7 @@ void DevInfoSession::deviceCallbackReturned()
QString deviceNameKey = QLatin1String("deviceName");
QString developerStatusKey = QLatin1String("developerStatus");
QString deviceConnectedKey = QLatin1String("deviceConnected");
QString osVersionKey = QLatin1String("osVersion");
bool failure = !device;
if (!failure) {
failure = !connectDevice();
......@@ -1256,6 +1257,32 @@ void DevInfoSession::deviceCallbackReturned()
if (!res.contains(developerStatusKey))
res[developerStatusKey] = QLatin1String("*off*");
}
if (!failure) {
CFPropertyListRef cfProductVersion = lib()->deviceCopyValue(device,
0,
CFSTR("ProductVersion"));
//CFShow(cfProductVersion);
CFPropertyListRef cfBuildVersion = lib()->deviceCopyValue(device,
0,
CFSTR("BuildVersion"));
//CFShow(cfBuildVersion);
QString versionString;
if (cfProductVersion) {
if (CFGetTypeID(cfProductVersion) == CFStringGetTypeID())
versionString = CFStringRef2QString(reinterpret_cast<CFStringRef>(cfProductVersion));
CFRelease(cfProductVersion);
}
if (cfBuildVersion) {
if (!versionString.isEmpty() && CFGetTypeID(cfBuildVersion) == CFStringGetTypeID())
versionString += QString::fromLatin1(" (%1)").arg(
CFStringRef2QString(reinterpret_cast<CFStringRef>(cfBuildVersion)));
CFRelease(cfBuildVersion);
}
if (!versionString.isEmpty())
res[osVersionKey] = versionString;
else
res[osVersionKey] = QLatin1String("*unknown*");
}
disconnectDevice();
}
if (!res.contains(deviceConnectedKey))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment