Commit cdffb378 authored by Vikas Pachdha's avatar Vikas Pachdha Committed by Eike Ziller

Android: Fix QML debugging

Specify the qml server address and use correct default loop back
address in qmlengine

Change-Id: I9b77cb3385041bbe79900e7f7a188ca26124bacc
Reviewed-by: Ulf Hermann's avatarUlf Hermann <ulf.hermann@qt.io>
parent a194b107
......@@ -133,6 +133,7 @@ void AndroidDebugSupport::start()
.appendPath(toNdkArch(AndroidManager::targetArch(target))).toString();
}
if (isQmlDebugging()) {
params.qmlServer.host = m_runner->qmlServerHost();
params.qmlServer.port = m_runner->qmlServerPort();
//TODO: Not sure if these are the right paths.
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
......
......@@ -226,7 +226,8 @@ public:
Utils::Port localGdbServerPort() const { return m_localGdbServerPort; }
signals:
void remoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlServerPort, int pid);
void remoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlServerPort,
QString qmlServerHost, int pid);
void remoteProcessFinished(const QString &errString = QString());
void remoteOutput(const QString &output);
......@@ -257,6 +258,7 @@ private:
bool m_useCppDebugger = false;
QmlDebug::QmlDebugServicesPreset m_qmlDebugServices;
Utils::Port m_localGdbServerPort; // Local end of forwarded debug socket.
QString m_qmlServerHost;
Utils::Port m_qmlPort;
QString m_pingFile;
QString m_pongFile;
......@@ -295,6 +297,7 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunControl *runControl, const AndroidRu
QTC_ASSERT(server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6),
qDebug() << tr("No free ports available on host for QML debugging."));
m_qmlServerHost = server.serverAddress().toString();
m_qmlPort = Utils::Port(server.serverPort());
} else {
m_qmlPort = Utils::Port();
......@@ -638,7 +641,7 @@ void AndroidRunnerWorker::onProcessIdChanged(qint64 pid)
} else {
// In debugging cases this will be funneled to the engine to actually start
// and attach gdb. Afterwards this ends up in handleRemoteDebuggerRunning() below.
emit remoteProcessStarted(m_localGdbServerPort, m_qmlPort, m_processPID);
emit remoteProcessStarted(m_localGdbServerPort, m_qmlPort, m_qmlServerHost, m_processPID);
logcatReadStandardOutput();
QTC_ASSERT(!m_psIsAlive, /**/);
m_psIsAlive.reset(new QProcess);
......@@ -782,10 +785,12 @@ void AndroidRunner::remoteErrorOutput(const QString &output)
m_outputParser.processOutput(output);
}
void AndroidRunner::handleRemoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlServerPort, int pid)
void AndroidRunner::handleRemoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlServerPort,
QString qmlServerHost, int pid)
{
m_pid = ProcessHandle(pid);
m_gdbServerPort = gdbServerPort;
m_qmlServerHost = qmlServerHost;
m_qmlServerPort = qmlServerPort;
reportStarted();
}
......
......@@ -57,6 +57,7 @@ public:
const AndroidRunnable &runnable() const { return m_androidRunnable; }
Utils::Port gdbServerPort() const { return m_gdbServerPort; }
QString qmlServerHost() const { return m_qmlServerHost; }
Utils::Port qmlServerPort() const { return m_qmlServerPort; }
Utils::ProcessHandle pid() const { return m_pid; }
......@@ -76,7 +77,8 @@ private:
void remoteOutput(const QString &output);
void remoteErrorOutput(const QString &output);
void gotRemoteOutput(const QString &output);
void handleRemoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlServerPort, int pid);
void handleRemoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlServerPort,
QString qmlServerHost, int pid);
void handleRemoteProcessFinished(const QString &errString = QString());
void checkAVD();
void launchAVD();
......@@ -88,6 +90,7 @@ private:
QScopedPointer<AndroidRunnerWorker> m_worker;
QPointer<ProjectExplorer::Target> m_target;
Utils::Port m_gdbServerPort;
QString m_qmlServerHost;
Utils::Port m_qmlServerPort;
Utils::ProcessHandle m_pid;
QmlDebug::QmlOutputParser m_outputParser;
......
......@@ -427,7 +427,7 @@ void QmlEngine::beginConnection(Utils::Port port)
QString host = runParameters().qmlServer.host;
// Use localhost as default
if (host.isEmpty())
host = "localhost";
host = QHostAddress(QHostAddress::LocalHost).toString();
/*
* Let plugin-specific code override the port printed by the application. This is necessary
......
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