diff options
Diffstat (limited to 'src/qml/debugger')
-rw-r--r-- | src/qml/debugger/qqmldebug.cpp | 14 | ||||
-rw-r--r-- | src/qml/debugger/qqmldebug.h | 1 | ||||
-rw-r--r-- | src/qml/debugger/qqmldebugconnector.cpp | 18 | ||||
-rw-r--r-- | src/qml/debugger/qqmldebugserviceinterfaces_p.h | 4 |
4 files changed, 31 insertions, 6 deletions
diff --git a/src/qml/debugger/qqmldebug.cpp b/src/qml/debugger/qqmldebug.cpp index b2c4b139ee..15230d75a5 100644 --- a/src/qml/debugger/qqmldebug.cpp +++ b/src/qml/debugger/qqmldebug.cpp @@ -84,7 +84,19 @@ QStringList QQmlDebuggingEnabler::inspectorServices() */ QStringList QQmlDebuggingEnabler::profilerServices() { - return QStringList() << QQmlProfilerService::s_key << QQmlEngineControlService::s_key; + return QStringList() << QQmlProfilerService::s_key << QQmlEngineControlService::s_key + << QDebugMessageService::s_key; +} + +/*! + * Retrieves the plugin keys of the debug services designed to be used with a native debugger. The + * native debugger will communicate with these services by directly reading and writing the + * application's memory. + * \return List of plugin keys of debug services designed to be used with a native debugger. + */ +QStringList QQmlDebuggingEnabler::nativeDebuggerServices() +{ + return QStringList() << QQmlNativeDebugService::s_key; } /*! diff --git a/src/qml/debugger/qqmldebug.h b/src/qml/debugger/qqmldebug.h index fb41039867..6a0cfdc709 100644 --- a/src/qml/debugger/qqmldebug.h +++ b/src/qml/debugger/qqmldebug.h @@ -60,6 +60,7 @@ struct Q_QML_EXPORT QQmlDebuggingEnabler static QStringList debuggerServices(); static QStringList inspectorServices(); static QStringList profilerServices(); + static QStringList nativeDebuggerServices(); static void setServices(const QStringList &services); diff --git a/src/qml/debugger/qqmldebugconnector.cpp b/src/qml/debugger/qqmldebugconnector.cpp index dd34bb910f..8a16d56c45 100644 --- a/src/qml/debugger/qqmldebugconnector.cpp +++ b/src/qml/debugger/qqmldebugconnector.cpp @@ -126,6 +126,16 @@ QQmlDebugConnector *QQmlDebugConnector::instance() params->instance = loadQQmlDebugConnector(params->pluginKey); } else if (params->arguments.isEmpty()) { return 0; // no explicit class name given and no command line arguments + } else if (params->arguments.startsWith(QLatin1String("connector:"))) { + static const int connectorBegin = int(strlen("connector:")); + + int connectorEnd = params->arguments.indexOf(QLatin1Char(','), connectorBegin); + if (connectorEnd == -1) + connectorEnd = params->arguments.length(); + + params->instance = loadQQmlDebugConnector(params->arguments.mid( + connectorBegin, + connectorEnd - connectorBegin)); } else { params->instance = loadQQmlDebugConnector( params->arguments.startsWith(QLatin1String("native")) ? @@ -134,9 +144,11 @@ QQmlDebugConnector *QQmlDebugConnector::instance() } if (params->instance) { - foreach (const QJsonObject &object, metaDataForQQmlDebugService()) { - foreach (const QJsonValue &key, object.value(QLatin1String("MetaData")).toObject() - .value(QLatin1String("Keys")).toArray()) { + const auto metaData = metaDataForQQmlDebugService(); + for (const QJsonObject &object : metaData) { + const auto keys = object.value(QLatin1String("MetaData")).toObject() + .value(QLatin1String("Keys")).toArray(); + for (const QJsonValue &key : keys) { QString keyString = key.toString(); if (params->services.isEmpty() || params->services.contains(keyString)) loadQQmlDebugService(keyString); diff --git a/src/qml/debugger/qqmldebugserviceinterfaces_p.h b/src/qml/debugger/qqmldebugserviceinterfaces_p.h index ca6293c3ec..2fe3a588c3 100644 --- a/src/qml/debugger/qqmldebugserviceinterfaces_p.h +++ b/src/qml/debugger/qqmldebugserviceinterfaces_p.h @@ -205,14 +205,14 @@ protected: class Q_QML_PRIVATE_EXPORT QQmlNativeDebugService : public QQmlDebugService { Q_OBJECT +public: + static const QString s_key; protected: friend class QQmlDebugConnector; QQmlNativeDebugService(float version, QObject *parent = 0) : QQmlDebugService(s_key, version, parent) {} - - static const QString s_key; }; #endif |