diff options
author | Eike Ziller <[email protected]> | 2025-02-03 10:55:12 +0100 |
---|---|---|
committer | Eike Ziller <[email protected]> | 2025-02-04 11:13:27 +0000 |
commit | fdeb9fabca3b0b4546b8c2f10507b18af18c7dfb (patch) | |
tree | a9b00a4998e00f2a5797c450b1c271f507f1adf4 | |
parent | 46d057019bf7df3f7a21da35d811f1af82a22994 (diff) |
iOS: Report the ports that are listened on for debuggers
For devices <= iOS 16.
The code tried to replace the output from the QML debugging support that
is linked to the application and inject the local port into it. And
failed.
Instead of fiddling with the application output, just report the facts at
the start.
Change-Id: Id52f61d798607fe400390d54f1cf26e5a80add48
Reviewed-by: hjk <[email protected]>
-rw-r--r-- | src/plugins/ios/iosrunner.cpp | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/src/plugins/ios/iosrunner.cpp b/src/plugins/ios/iosrunner.cpp index 53dee22e590..d9067bacfae 100644 --- a/src/plugins/ios/iosrunner.cpp +++ b/src/plugins/ios/iosrunner.cpp @@ -678,6 +678,8 @@ void IosRunner::handleGotServerPorts(IosToolHandler *handler, const FilePath &bu if (m_toolHandler != handler) return; + const Port portOnDevice = m_qmlServerPort; + m_gdbServerPort = gdbPort; m_qmlServerPort = qmlPort; // The run control so far knows about the port on the device side, @@ -688,21 +690,28 @@ void IosRunner::handleGotServerPorts(IosToolHandler *handler, const FilePath &bu qmlChannel.setPort(qmlPort.number()); runControl()->setQmlChannel(qmlChannel); - bool prerequisiteOk = false; - if (cppDebug() && qmlDebug()) - prerequisiteOk = m_gdbServerPort.isValid() && m_qmlServerPort.isValid(); - else if (cppDebug()) - prerequisiteOk = m_gdbServerPort.isValid(); - else if (qmlDebug()) - prerequisiteOk = m_qmlServerPort.isValid(); - else - prerequisiteOk = true; // Not debugging. Ports not required. - + if (cppDebug()) { + if (!m_gdbServerPort.isValid()) { + reportFailure(Tr::tr("Failed to get a local debugger port.")); + return; + } + appendMessage( + Tr::tr("Listening for debugger on local port %1.").arg(m_gdbServerPort.number()), + LogMessageFormat); + } + if (qmlDebug()) { + if (!m_qmlServerPort.isValid()) { + reportFailure(Tr::tr("Failed to get a local debugger port.")); + return; + } + appendMessage( + Tr::tr("Listening for QML debugger on local port %1 (port %2 on the device).") + .arg(m_qmlServerPort.number()) + .arg(portOnDevice.number()), + LogMessageFormat); + } - if (prerequisiteOk) - reportStarted(); - else - reportFailure(Tr::tr("Could not get necessary ports for the debugger connection.")); + reportStarted(); } void IosRunner::handleGotInferiorPid(IosToolHandler *handler, const FilePath &bundlePath, @@ -736,22 +745,12 @@ void IosRunner::handleGotInferiorPid(IosToolHandler *handler, const FilePath &bu void IosRunner::handleAppOutput(IosToolHandler *handler, const QString &output) { Q_UNUSED(handler) - static const QRegularExpression qmlPortRe(QString::fromLatin1(QML_DEBUGGER_WAITING)); - const QRegularExpressionMatch match = qmlPortRe.match(output); - QString res(output); - if (match.hasMatch() && m_qmlServerPort.isValid()) - res.replace(match.captured(1), QString::number(m_qmlServerPort.number())); appendMessage(output, StdOutFormat); } void IosRunner::handleMessage(const QString &msg) { - QString res(msg); - static const QRegularExpression qmlPortRe(QString::fromLatin1(QML_DEBUGGER_WAITING)); - const QRegularExpressionMatch match = qmlPortRe.match(msg); - if (match.hasMatch() && m_qmlServerPort.isValid()) - res.replace(match.captured(1), QString::number(m_qmlServerPort.number())); - appendMessage(res, StdOutFormat); + appendMessage(msg, StdOutFormat); } void IosRunner::handleErrorMsg(IosToolHandler *handler, const QString &msg) |