forked from qt-creator/qt-creator
iOS: Fix standalone QML debugging
Wait for ports before connecting to QML server. Change-Id: Id2cc1928ddd90c61b84ffed5bdeffeb70f15b8c6 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -132,6 +132,11 @@ bool IosRunner::cppDebug() const
|
|||||||
return m_cppDebug;
|
return m_cppDebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IosRunner::qmlDebug() const
|
||||||
|
{
|
||||||
|
return m_qmlDebugServices != QmlDebug::NoQmlDebugServices;
|
||||||
|
}
|
||||||
|
|
||||||
QmlDebug::QmlDebugServicesPreset IosRunner::qmlDebugServices() const
|
QmlDebug::QmlDebugServicesPreset IosRunner::qmlDebugServices() const
|
||||||
{
|
{
|
||||||
return m_qmlDebugServices;
|
return m_qmlDebugServices;
|
||||||
@@ -172,8 +177,6 @@ void IosRunner::start()
|
|||||||
m_toolHandler = new IosToolHandler(m_deviceType, this);
|
m_toolHandler = new IosToolHandler(m_deviceType, this);
|
||||||
connect(m_toolHandler, &IosToolHandler::appOutput,
|
connect(m_toolHandler, &IosToolHandler::appOutput,
|
||||||
this, &IosRunner::handleAppOutput);
|
this, &IosRunner::handleAppOutput);
|
||||||
connect(m_toolHandler, &IosToolHandler::didStartApp,
|
|
||||||
this, &IosRunner::handleDidStartApp);
|
|
||||||
connect(m_toolHandler, &IosToolHandler::errorMsg,
|
connect(m_toolHandler, &IosToolHandler::errorMsg,
|
||||||
this, &IosRunner::handleErrorMsg);
|
this, &IosRunner::handleErrorMsg);
|
||||||
connect(m_toolHandler, &IosToolHandler::gotServerPorts,
|
connect(m_toolHandler, &IosToolHandler::gotServerPorts,
|
||||||
@@ -193,39 +196,34 @@ void IosRunner::stop()
|
|||||||
m_toolHandler->stop();
|
m_toolHandler->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosRunner::handleDidStartApp(IosToolHandler *handler, const QString &bundlePath,
|
|
||||||
const QString &deviceId, IosToolHandler::OpStatus status)
|
|
||||||
{
|
|
||||||
Q_UNUSED(bundlePath); Q_UNUSED(deviceId);
|
|
||||||
if (m_toolHandler == handler && runType() == IosToolHandler::NormalRun) {
|
|
||||||
// For normal run type the notify reportStarted here for debug type wait for
|
|
||||||
// server ports or PID for device and simulator respectivelly.
|
|
||||||
if (status == IosToolHandler::Success)
|
|
||||||
reportStarted();
|
|
||||||
else
|
|
||||||
reportFailure();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosRunner::handleGotServerPorts(IosToolHandler *handler, const QString &bundlePath,
|
void IosRunner::handleGotServerPorts(IosToolHandler *handler, const QString &bundlePath,
|
||||||
const QString &deviceId, Port gdbPort,
|
const QString &deviceId, Port gdbPort,
|
||||||
Port qmlPort)
|
Port qmlPort)
|
||||||
{
|
{
|
||||||
// Called when debugging on Device.
|
// Called when debugging on Device.
|
||||||
Q_UNUSED(bundlePath); Q_UNUSED(deviceId);
|
Q_UNUSED(bundlePath); Q_UNUSED(deviceId);
|
||||||
if (m_toolHandler == handler && runType() == IosToolHandler::DebugRun) {
|
|
||||||
m_gdbServerPort = gdbPort;
|
if (m_toolHandler != handler)
|
||||||
m_qmlServerPort = qmlPort;
|
return;
|
||||||
bool portsValid = m_gdbServerPort.isValid() && m_qmlServerPort.isValid();
|
|
||||||
bool qmlDebugging = m_qmlDebugServices != QmlDebug::NoQmlDebugServices;
|
m_gdbServerPort = gdbPort;
|
||||||
if ( (qmlDebugging && m_cppDebug && portsValid) // Mixed mode debuggin & valid ports
|
m_qmlServerPort = qmlPort;
|
||||||
|| (qmlDebugging && !m_cppDebug && m_qmlServerPort.isValid()) // Qml debugging only
|
|
||||||
|| (m_cppDebug && !qmlDebugging && m_gdbServerPort.isValid())) { // C++ debugging only
|
bool prerequisiteOk = false;
|
||||||
reportStarted();
|
if (cppDebug() && qmlDebug())
|
||||||
} else {
|
prerequisiteOk = m_gdbServerPort.isValid() && m_qmlServerPort.isValid();
|
||||||
reportFailure(tr("Could not get debug server file descriptor."));
|
else if (cppDebug())
|
||||||
}
|
prerequisiteOk = m_gdbServerPort.isValid();
|
||||||
}
|
else if (qmlDebug())
|
||||||
|
prerequisiteOk = m_qmlServerPort.isValid();
|
||||||
|
else
|
||||||
|
prerequisiteOk = true; // Not debugging. Ports not required.
|
||||||
|
|
||||||
|
|
||||||
|
if (prerequisiteOk)
|
||||||
|
reportStarted();
|
||||||
|
else
|
||||||
|
reportFailure(tr("Could not get necessary ports for the debugger connection."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosRunner::handleGotInferiorPid(IosToolHandler *handler, const QString &bundlePath,
|
void IosRunner::handleGotInferiorPid(IosToolHandler *handler, const QString &bundlePath,
|
||||||
@@ -233,17 +231,26 @@ void IosRunner::handleGotInferiorPid(IosToolHandler *handler, const QString &bun
|
|||||||
{
|
{
|
||||||
// Called when debugging on Simulator.
|
// Called when debugging on Simulator.
|
||||||
Q_UNUSED(bundlePath); Q_UNUSED(deviceId);
|
Q_UNUSED(bundlePath); Q_UNUSED(deviceId);
|
||||||
m_pid = pid;
|
|
||||||
if (m_pid <= 0)
|
|
||||||
reportFailure(tr("Could not get inferior PID."));
|
|
||||||
|
|
||||||
if (m_toolHandler == handler && runType() == IosToolHandler::DebugRun) {
|
if (m_toolHandler != handler)
|
||||||
bool qmlDebugging = m_qmlDebugServices != QmlDebug::NoQmlDebugServices;
|
return;
|
||||||
if ((qmlDebugging && m_qmlServerPort.isValid()) || (m_cppDebug && !qmlDebugging))
|
|
||||||
reportStarted();
|
m_pid = pid;
|
||||||
else
|
bool prerequisiteOk = false;
|
||||||
reportFailure(tr("Could not get debug server file descriptor."));
|
if (m_pid > 0) {
|
||||||
|
prerequisiteOk = true;
|
||||||
|
} else {
|
||||||
|
reportFailure(tr("Could not get inferior PID."));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (qmlDebug())
|
||||||
|
prerequisiteOk = m_qmlServerPort.isValid();
|
||||||
|
|
||||||
|
if (prerequisiteOk)
|
||||||
|
reportStarted();
|
||||||
|
else
|
||||||
|
reportFailure(tr("Could not get necessary ports the debugger connection."));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosRunner::handleAppOutput(IosToolHandler *handler, const QString &output)
|
void IosRunner::handleAppOutput(IosToolHandler *handler, const QString &output)
|
||||||
|
@@ -57,6 +57,7 @@ public:
|
|||||||
QString deviceId();
|
QString deviceId();
|
||||||
IosToolHandler::RunKind runType();
|
IosToolHandler::RunKind runType();
|
||||||
bool cppDebug() const;
|
bool cppDebug() const;
|
||||||
|
bool qmlDebug() const;
|
||||||
QmlDebug::QmlDebugServicesPreset qmlDebugServices() const;
|
QmlDebug::QmlDebugServicesPreset qmlDebugServices() const;
|
||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
@@ -71,8 +72,6 @@ public:
|
|||||||
bool isAppRunning() const;
|
bool isAppRunning() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleDidStartApp(Ios::IosToolHandler *handler, const QString &bundlePath,
|
|
||||||
const QString &deviceId, Ios::IosToolHandler::OpStatus status);
|
|
||||||
void handleGotServerPorts(Ios::IosToolHandler *handler, const QString &bundlePath,
|
void handleGotServerPorts(Ios::IosToolHandler *handler, const QString &bundlePath,
|
||||||
const QString &deviceId, Utils::Port gdbPort, Utils::Port qmlPort);
|
const QString &deviceId, Utils::Port gdbPort, Utils::Port qmlPort);
|
||||||
void handleGotInferiorPid(Ios::IosToolHandler *handler, const QString &bundlePath,
|
void handleGotInferiorPid(Ios::IosToolHandler *handler, const QString &bundlePath,
|
||||||
|
Reference in New Issue
Block a user