diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-08-10 17:43:58 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-08-17 15:13:56 +0000 |
commit | 5f90990c308e2deddc3f9491262e354477ebe5f4 (patch) | |
tree | 65f7524332bc61168836ebf16fd5d84dc4deb083 /src/plugins | |
parent | be31022276ced789d3a0ea2fb373a63a5921e157 (diff) |
Tell the QML debug server exactly what services we expect
The services need to be loaded before the first QML engine is created.
The first QML engine may be created before a client connects. When the
JavaScript debug service is loaded the engine is put into interpreter
mode as we don't support debugging in JIT mode. Profiling, however
should be done in JIT mode, whenever possible.
Thus, in order to avoid the loading of unnecessary plugins and to get
better results from the QML profiler we tell the debug server which
services we expect, even before the client connects. Qt 5.6 will support
additional command line arguments to specify the services and this
change uses them.
Change-Id: I6dcee016c39995e9adada6eaf0e39d8299c9b7e7
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/android/androidrunner.cpp | 23 | ||||
-rw-r--r-- | src/plugins/android/androidrunner.h | 4 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerruncontrol.cpp | 4 | ||||
-rw-r--r-- | src/plugins/ios/iosanalyzesupport.cpp | 3 | ||||
-rw-r--r-- | src/plugins/ios/iosdebugsupport.cpp | 3 | ||||
-rw-r--r-- | src/plugins/ios/iosruncontrol.cpp | 2 | ||||
-rw-r--r-- | src/plugins/ios/iosrunner.cpp | 16 | ||||
-rw-r--r-- | src/plugins/ios/iosrunner.h | 9 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/localqmlprofilerrunner.cpp | 4 | ||||
-rw-r--r-- | src/plugins/qnx/qnxanalyzesupport.cpp | 4 | ||||
-rw-r--r-- | src/plugins/qnx/qnxdebugsupport.cpp | 4 | ||||
-rw-r--r-- | src/plugins/remotelinux/remotelinuxanalyzesupport.cpp | 4 | ||||
-rw-r--r-- | src/plugins/remotelinux/remotelinuxdebugsupport.cpp | 7 |
13 files changed, 57 insertions, 30 deletions
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index 7dcd549e63c..d1d0a8b2e6e 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -134,13 +134,17 @@ AndroidRunner::AndroidRunner(QObject *parent, = runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>(); const bool debuggingMode = (runMode == ProjectExplorer::Constants::DEBUG_RUN_MODE || runMode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN); m_useCppDebugger = debuggingMode && aspect->useCppDebugger(); - m_useQmlDebugger = debuggingMode && aspect->useQmlDebugger(); + if (debuggingMode && aspect->useQmlDebugger()) + m_qmlDebugServices = QmlDebug::QmlDebuggerServices; + else if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) + m_qmlDebugServices = QmlDebug::QmlProfilerServices; + else + m_qmlDebugServices = QmlDebug::NoQmlDebugServices; QString channel = runConfig->remoteChannel(); QTC_CHECK(channel.startsWith(QLatin1Char(':'))); m_localGdbServerPort = channel.mid(1).toUShort(); QTC_CHECK(m_localGdbServerPort); - m_useQmlProfiler = runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE; - if (m_useQmlDebugger || m_useQmlProfiler) { + if (m_qmlDebugServices != QmlDebug::NoQmlDebugServices) { QTcpServer server; QTC_ASSERT(server.listen(QHostAddress::LocalHost) || server.listen(QHostAddress::LocalHostIPv6), @@ -289,12 +293,12 @@ void AndroidRunner::checkPID() // gdb. Afterwards this ends up in handleRemoteDebuggerRunning() below. QByteArray serverChannel = ':' + QByteArray::number(m_localGdbServerPort); emit remoteServerRunning(serverChannel, m_processPID); - } else if (m_useQmlDebugger) { + } else if (m_qmlDebugServices == QmlDebug::QmlDebuggerServices) { // This will be funneled to the engine to actually start and attach // gdb. Afterwards this ends up in handleRemoteDebuggerRunning() below. QByteArray serverChannel = QByteArray::number(m_qmlPort); emit remoteServerRunning(serverChannel, m_processPID); - } else if (m_useQmlProfiler) { + } else if (m_qmlDebugServices == QmlDebug::QmlProfilerServices) { emit remoteProcessStarted(-1, m_qmlPort); } else { // Start without debugging. @@ -389,7 +393,7 @@ void AndroidRunner::asyncStart() } } - if (m_useQmlDebugger || m_useQmlProfiler) { + if (m_qmlDebugServices != QmlDebug::NoQmlDebugServices) { // currently forward to same port on device and host const QString port = QString::fromLatin1("tcp:%1").arg(m_qmlPort); QProcess adb; @@ -402,8 +406,11 @@ void AndroidRunner::asyncStart() emit remoteProcessFinished(tr("Failed to forward QML debugging ports.")); return; } - args << _("-e") << _("qml_debug") << _("true"); - args << _("-e") << _("qmljsdebugger") << QString::fromLatin1("port:%1,block").arg(m_qmlPort); + + args << _("-e") << _("qml_debug") << _("true") + << _("-e") << _("qmljsdebugger") + << QString::fromLatin1("port:%1,block,services:%2") + .arg(m_qmlPort).arg(QmlDebug::qmlDebugServices(m_qmlDebugServices)); } QProcess adb; diff --git a/src/plugins/android/androidrunner.h b/src/plugins/android/androidrunner.h index 8bf90f4e8a2..a87e99dca33 100644 --- a/src/plugins/android/androidrunner.h +++ b/src/plugins/android/androidrunner.h @@ -34,6 +34,7 @@ #include "androidconfigurations.h" #include <projectexplorer/runconfiguration.h> +#include <qmldebug/qmldebugcommandlinearguments.h> #include <QObject> #include <QTimer> @@ -103,8 +104,7 @@ private: QString m_deviceSerialNumber; qint64 m_processPID; bool m_useCppDebugger; - bool m_useQmlDebugger; - bool m_useQmlProfiler; + QmlDebug::QmlDebugServicesPreset m_qmlDebugServices; ushort m_localGdbServerPort; // Local end of forwarded debug socket. quint16 m_qmlPort; bool m_useLocalQtLibs; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index 2fb3fc12973..da10be4b3f8 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -57,6 +57,7 @@ #include <utils/qtcassert.h> #include <utils/qtcprocess.h> #include <coreplugin/icore.h> +#include <qmldebug/qmldebugcommandlinearguments.h> #include <QTcpServer> @@ -462,7 +463,8 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const if (!m_rp.environment.hasKey(optimizerKey)) m_rp.environment.set(optimizerKey, _("1")); - QtcProcess::addArg(&m_rp.processArgs, QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(m_rp.qmlServerPort)); + QtcProcess::addArg(&m_rp.processArgs, QmlDebug::qmlDebugCommandLineArguments( + QmlDebug::QmlDebuggerServices, m_rp.qmlServerPort)); } } } diff --git a/src/plugins/ios/iosanalyzesupport.cpp b/src/plugins/ios/iosanalyzesupport.cpp index fa1f9f9f8f7..ac52e0dac0f 100644 --- a/src/plugins/ios/iosanalyzesupport.cpp +++ b/src/plugins/ios/iosanalyzesupport.cpp @@ -100,7 +100,8 @@ RunControl *IosAnalyzeSupport::createAnalyzeRunControl(IosRunConfiguration *runC IosAnalyzeSupport::IosAnalyzeSupport(IosRunConfiguration *runConfig, AnalyzerRunControl *runControl, bool cppDebug, bool qmlDebug) : QObject(runControl), m_runControl(runControl), - m_runner(new IosRunner(this, runConfig, cppDebug, qmlDebug)) + m_runner(new IosRunner(this, runConfig, cppDebug, qmlDebug ? QmlDebug::QmlProfilerServices : + QmlDebug::NoQmlDebugServices)) { connect(m_runControl, SIGNAL(starting(const Analyzer::AnalyzerRunControl*)), m_runner, SLOT(start())); diff --git a/src/plugins/ios/iosdebugsupport.cpp b/src/plugins/ios/iosdebugsupport.cpp index 1638393756c..2b2a9686f37 100644 --- a/src/plugins/ios/iosdebugsupport.cpp +++ b/src/plugins/ios/iosdebugsupport.cpp @@ -161,7 +161,8 @@ RunControl *IosDebugSupport::createDebugRunControl(IosRunConfiguration *runConfi IosDebugSupport::IosDebugSupport(IosRunConfiguration *runConfig, DebuggerRunControl *runControl, bool cppDebug, bool qmlDebug) : QObject(runControl), m_runControl(runControl), - m_runner(new IosRunner(this, runConfig, cppDebug, qmlDebug)) + m_runner(new IosRunner(this, runConfig, cppDebug, qmlDebug ? QmlDebug::QmlDebuggerServices : + QmlDebug::NoQmlDebugServices)) { connect(m_runControl, SIGNAL(requestRemoteSetup()), m_runner, SLOT(start())); diff --git a/src/plugins/ios/iosruncontrol.cpp b/src/plugins/ios/iosruncontrol.cpp index 7edeb14661f..0b982fa2871 100644 --- a/src/plugins/ios/iosruncontrol.cpp +++ b/src/plugins/ios/iosruncontrol.cpp @@ -42,7 +42,7 @@ namespace Internal { IosRunControl::IosRunControl(IosRunConfiguration *rc) : RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE) - , m_runner(new IosRunner(this, rc, false, false)) + , m_runner(new IosRunner(this, rc, false, QmlDebug::NoQmlDebugServices)) , m_running(false) { setIcon(QLatin1String(ProjectExplorer::Constants::ICON_DEBUG_SMALL)); diff --git a/src/plugins/ios/iosrunner.cpp b/src/plugins/ios/iosrunner.cpp index 83262715cc1..fb90e0e1e93 100644 --- a/src/plugins/ios/iosrunner.cpp +++ b/src/plugins/ios/iosrunner.cpp @@ -43,6 +43,7 @@ #include <projectexplorer/taskhub.h> #include <projectexplorer/projectexplorerconstants.h> #include <debugger/debuggerrunconfigurationaspect.h> +#include <qmldebug/qmldebugcommandlinearguments.h> #include <QDir> #include <QTime> @@ -56,11 +57,12 @@ using namespace ProjectExplorer; namespace Ios { namespace Internal { -IosRunner::IosRunner(QObject *parent, IosRunConfiguration *runConfig, bool cppDebug, bool qmlDebug) +IosRunner::IosRunner(QObject *parent, IosRunConfiguration *runConfig, bool cppDebug, + QmlDebug::QmlDebugServicesPreset qmlDebugServices) : QObject(parent), m_toolHandler(0), m_bundleDir(runConfig->bundleDirectory().toString()), m_arguments(runConfig->commandLineArguments()), m_device(DeviceKitInformation::device(runConfig->target()->kit())), - m_cppDebug(cppDebug), m_qmlDebug(qmlDebug), m_cleanExit(false), + m_cppDebug(cppDebug), m_qmlDebugServices(qmlDebugServices), m_cleanExit(false), m_qmlPort(0), m_pid(0) { m_deviceType = runConfig->deviceType(); @@ -80,7 +82,7 @@ QStringList IosRunner::extraArgs() { QStringList res = m_arguments; if (m_qmlPort != 0) - res << QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(m_qmlPort); + res << QmlDebug::qmlDebugCommandLineArguments(m_qmlDebugServices, m_qmlPort); return res; } @@ -104,9 +106,9 @@ bool IosRunner::cppDebug() const return m_cppDebug; } -bool IosRunner::qmlDebug() const +QmlDebug::QmlDebugServicesPreset IosRunner::qmlDebugServices() const { - return m_qmlDebug; + return m_qmlDebugServices; } void IosRunner::start() @@ -130,7 +132,7 @@ void IosRunner::start() emit finished(m_cleanExit); return; } - if (m_qmlDebug) + if (m_qmlDebugServices != QmlDebug::NoQmlDebugServices) m_qmlPort = iosDevice->nextPort(); } else { IosSimulator::ConstPtr sim = m_device.dynamicCast<const IosSimulator>(); @@ -138,7 +140,7 @@ void IosRunner::start() emit finished(m_cleanExit); return; } - if (m_qmlDebug) + if (m_qmlDebugServices != QmlDebug::NoQmlDebugServices) m_qmlPort = sim->nextPort(); } diff --git a/src/plugins/ios/iosrunner.h b/src/plugins/ios/iosrunner.h index 22946e4cdc5..569f42f8678 100644 --- a/src/plugins/ios/iosrunner.h +++ b/src/plugins/ios/iosrunner.h @@ -35,6 +35,7 @@ #include "iossimulator.h" #include <projectexplorer/devicesupport/idevice.h> +#include <qmldebug/qmldebugcommandlinearguments.h> #include <QObject> #include <QTimer> @@ -52,7 +53,8 @@ class IosRunner : public QObject Q_OBJECT public: - IosRunner(QObject *parent, IosRunConfiguration *runConfig, bool cppDebug, bool qmlDebug); + IosRunner(QObject *parent, IosRunConfiguration *runConfig, bool cppDebug, + QmlDebug::QmlDebugServicesPreset qmlDebugServices); ~IosRunner(); QString displayName() const; @@ -62,7 +64,7 @@ public: QString deviceId(); IosToolHandler::RunKind runType(); bool cppDebug() const; - bool qmlDebug() const; + QmlDebug::QmlDebugServicesPreset qmlDebugServices() const; public slots: void start(); void stop(); @@ -92,7 +94,8 @@ private: ProjectExplorer::IDevice::ConstPtr m_device; IosDeviceType m_deviceType; bool m_cppDebug; - bool m_qmlDebug; + QmlDebug::QmlDebugServicesPreset m_qmlDebugServices; + bool m_cleanExit; quint16 m_qmlPort; Q_PID m_pid; diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp index f49e5350157..86454d38f4a 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp @@ -41,6 +41,7 @@ #include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/kitinformation.h> #include <projectexplorer/target.h> +#include <qmldebug/qmldebugcommandlinearguments.h> #include <QTcpServer> @@ -119,7 +120,8 @@ LocalQmlProfilerRunner::~LocalQmlProfilerRunner() void LocalQmlProfilerRunner::start() { - QString arguments = QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(m_configuration.port); + QString arguments = QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlProfilerServices, + m_configuration.port); if (!m_configuration.executableArguments.isEmpty()) arguments += QLatin1Char(' ') + m_configuration.executableArguments; diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index 2c7eb8619f6..56dec1bbf0c 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -42,6 +42,7 @@ #include <utils/qtcassert.h> #include <utils/qtcprocess.h> +#include <qmldebug/qmldebugcommandlinearguments.h> using namespace ProjectExplorer; @@ -98,7 +99,8 @@ void QnxAnalyzeSupport::startExecution() const QStringList args = QStringList() << Utils::QtcProcess::splitArgs(m_runControl->startParameters().debuggeeArgs) - << QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(m_qmlPort); + << QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlProfilerServices, m_qmlPort); + appRunner()->setEnvironment(environment()); appRunner()->setWorkingDirectory(workingDirectory()); appRunner()->start(device(), executable(), args); diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index 1ed7b39448c..79dfbee3a8d 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -45,6 +45,7 @@ #include <projectexplorer/target.h> #include <utils/qtcassert.h> #include <utils/qtcprocess.h> +#include <qmldebug/qmldebugcommandlinearguments.h> using namespace ProjectExplorer; using namespace RemoteLinux; @@ -104,7 +105,8 @@ void QnxDebugSupport::startExecution() setState(StartingRemoteProcess); if (m_useQmlDebugger) - m_runControl->startParameters().processArgs += QString::fromLatin1(" -qmljsdebugger=port:%1,block").arg(m_qmlPort); + m_runControl->startParameters().processArgs += + QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlDebuggerServices, m_qmlPort); QStringList arguments; if (m_useCppDebugger) diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp index a7316280e94..9ca77f9898b 100644 --- a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp +++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp @@ -43,6 +43,7 @@ #include <utils/qtcassert.h> #include <qmldebug/qmloutputparser.h> +#include <qmldebug/qmldebugcommandlinearguments.h> #include <QPointer> @@ -147,7 +148,8 @@ void RemoteLinuxAnalyzeSupport::startExecution() this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError); const QStringList args = arguments() - << QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(d->qmlPort); + << QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlProfilerServices, d->qmlPort); + runner->setWorkingDirectory(workingDirectory()); runner->setEnvironment(environment()); runner->start(device(), remoteFilePath(), args); diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 769b0a2929e..33e0001ffac 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -45,6 +45,7 @@ #include <utils/qtcassert.h> #include <utils/qtcprocess.h> +#include <qmldebug/qmldebugcommandlinearguments.h> #include <QPointer> @@ -101,7 +102,8 @@ DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const AbstractR aspect->setUseMultiProcess(true); QStringList args = runConfig->arguments(); if (aspect->useQmlDebugger()) - args.prepend(QString::fromLatin1("-qmljsdebugger=port:%qml_port%,block")); + args.prepend(QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlDebuggerServices)); + params.processArgs = Utils::QtcProcess::joinArgs(args, Utils::OsTypeLinux); params.executable = runConfig->localExecutableFilePath(); params.remoteChannel = device->sshParameters().host + QLatin1String(":-1"); @@ -164,7 +166,8 @@ void LinuxDeviceDebugSupport::startExecution() QString command; if (d->qmlDebugging) - args.prepend(QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(d->qmlPort)); + args.prepend(QmlDebug::qmlDebugCommandLineArguments(QmlDebug::QmlDebuggerServices, + d->qmlPort)); if (d->qmlDebugging && !d->cppDebugging) { command = remoteFilePath(); |