aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/ios/iosrunner.cpp
diff options
context:
space:
mode:
authorEike Ziller <[email protected]>2025-01-27 16:26:59 +0100
committerEike Ziller <[email protected]>2025-01-28 07:36:15 +0000
commit54e897396452ae9145e19a6685a59a91a46254b8 (patch)
treeca830e5cb463709846187939936b3b8859c87e3a /src/plugins/ios/iosrunner.cpp
parent99185d04ec355f1046e9cc6fa45df247f5080536 (diff)
iOS: Fix debugging and QML profiling on Simulatorv16.0.0-beta1
Fixes a crash that was introduced by a6aa050890789f689f3780cc5481f6e0340b5468 - the simulator device is not derived from IosDevice, so we may not assume that. Re-implement IosSimulator::portsGatheringRecipe - the base implementation tries to run netstat "on" the simulator device, instead do the same just locally, since the ports for the simulator are effectively local ports. Also remove the custom port range for the same reason. Fixes: QTCREATORBUG-32416 Change-Id: I7294d0c20e94bafb9eb4590b7faaf6652792cbb1 Reviewed-by: Jarek Kobus <[email protected]>
Diffstat (limited to 'src/plugins/ios/iosrunner.cpp')
-rw-r--r--src/plugins/ios/iosrunner.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/plugins/ios/iosrunner.cpp b/src/plugins/ios/iosrunner.cpp
index 61f4a52d14d..53dee22e590 100644
--- a/src/plugins/ios/iosrunner.cpp
+++ b/src/plugins/ios/iosrunner.cpp
@@ -632,18 +632,8 @@ void IosRunner::start()
reportFailure();
return;
}
- if (m_device->type() == Ios::Constants::IOS_DEVICE_TYPE) {
- if (m_qmlDebugServices != NoQmlDebugServices)
- m_qmlServerPort = Port(runControl()->qmlChannel().port());
- } else {
- IosSimulator::ConstPtr sim = std::dynamic_pointer_cast<const IosSimulator>(m_device);
- if (!sim) {
- reportFailure();
- return;
- }
- if (m_qmlDebugServices != NoQmlDebugServices)
- m_qmlServerPort = sim->nextPort();
- }
+ if (m_qmlDebugServices != NoQmlDebugServices)
+ m_qmlServerPort = Port(runControl()->qmlChannel().port());
m_toolHandler = new IosToolHandler(m_deviceType, this);
connect(m_toolHandler, &IosToolHandler::appOutput,
@@ -899,6 +889,10 @@ IosDebugSupport::IosDebugSupport(RunControl *runControl)
setId("IosDebugSupport");
IosDevice::ConstPtr dev = std::dynamic_pointer_cast<const IosDevice>(runControl->device());
+ const bool isIosDeviceType = runControl->device()->type() == Ios::Constants::IOS_DEVICE_TYPE;
+ const bool isIosDeviceInstance = bool(dev);
+ // type info and device class must match
+ QTC_ASSERT(isIosDeviceInstance == isIosDeviceType, return);
DebuggerRunParameters &rp = runParameters();
// TODO cannot use setupPortsGatherer() from DebuggerRunTool, because that also requests
// the "debugChannel", which then results in runControl trying to retrieve ports&URL for that
@@ -907,8 +901,7 @@ IosDebugSupport::IosDebugSupport(RunControl *runControl)
if (rp.isQmlDebugging())
runControl->requestQmlChannel();
- if (dev->type() == Ios::Constants::IOS_SIMULATOR_TYPE
- || dev->handler() == IosDevice::Handler::IosTool) {
+ if (!isIosDeviceInstance /*== simulator */ || dev->handler() == IosDevice::Handler::IosTool) {
m_iosRunner = new IosRunner(runControl);
m_iosRunner->setCppDebugging(rp.isCppDebugging());
m_iosRunner->setQmlDebugging(rp.isQmlDebugging() ? QmlDebuggerServices : NoQmlDebugServices);
@@ -920,7 +913,7 @@ IosDebugSupport::IosDebugSupport(RunControl *runControl)
addStartDependency(m_deviceCtlRunner);
}
- if (runControl->device()->type() == Ios::Constants::IOS_DEVICE_TYPE) {
+ if (isIosDeviceInstance) {
if (dev->handler() == IosDevice::Handler::DeviceCtl) {
QTC_CHECK(IosDeviceManager::isDeviceCtlDebugSupported());
rp.setStartMode(AttachToIosDevice);
@@ -950,8 +943,12 @@ void IosDebugSupport::start()
rp.setContinueAfterAttach(true);
IosDevice::ConstPtr dev = std::dynamic_pointer_cast<const IosDevice>(runControl()->device());
- if (dev->type() == Ios::Constants::IOS_DEVICE_TYPE
- && dev->handler() == IosDevice::Handler::DeviceCtl) {
+ const bool isIosDeviceType = runControl()->device()->type() == Ios::Constants::IOS_DEVICE_TYPE;
+ const bool isIosDeviceInstance = bool(dev);
+ // type info and device class must match
+ QTC_ASSERT(isIosDeviceInstance == isIosDeviceType, reportFailure(Tr::tr("Internal error."));
+ return);
+ if (isIosDeviceInstance && dev->handler() == IosDevice::Handler::DeviceCtl) {
const auto msgOnlyCppDebuggingSupported = [] {
return Tr::tr("Only C++ debugging is supported for devices with iOS 17 and later.");
};