diff options
author | hjk <hjk@theqtcompany.com> | 2015-10-13 12:39:35 +0200 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2015-10-16 12:57:40 +0000 |
commit | a4420af04a9ace7fff9bb14d3cfd1511c6b641b8 (patch) | |
tree | 1c07d0bef1b77c0ad8d5d72dd9b29c12924e5aa7 /src/qml | |
parent | cac24aee6c799cf6fb8a9b19c825ae77502af18b (diff) |
QmlDebug: Add a debug connector for use with native debuggers
This debug connector offers a few simple C functions a native debugger
can hook into to communicate with QML debug services.
It is the base of the 'native mixed' debugging mode in Qt Creator.
Change-Id: I32ce1f21be8e3522dccf1210d4de3b131b819bc5
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/debugger/qqmldebugconnector.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/qml/debugger/qqmldebugconnector.cpp b/src/qml/debugger/qqmldebugconnector.cpp index 460cb8f203..64a8a49bb9 100644 --- a/src/qml/debugger/qqmldebugconnector.cpp +++ b/src/qml/debugger/qqmldebugconnector.cpp @@ -45,10 +45,12 @@ QT_BEGIN_NAMESPACE -// We could add more plugins here, and distinguish by arguments to instance() +// Connectors. We could add more plugins here, and distinguish by arguments to instance() Q_QML_DEBUG_PLUGIN_LOADER(QQmlDebugConnector) Q_QML_IMPORT_DEBUG_PLUGIN(QQmlDebugServerFactory) +Q_QML_IMPORT_DEBUG_PLUGIN(QQmlNativeDebugConnectorFactory) +// Services Q_QML_DEBUG_PLUGIN_LOADER(QQmlDebugService) Q_QML_IMPORT_DEBUG_PLUGIN(QQmlInspectorServiceFactory) Q_QML_IMPORT_DEBUG_PLUGIN(QQmlProfilerServiceFactory) @@ -116,13 +118,20 @@ QQmlDebugConnector *QQmlDebugConnector::instance() } if (!params->instance) { + const QString serverConnector = QStringLiteral("QQmlDebugServer"); + const QString nativeConnector = QStringLiteral("QQmlNativeDebugConnector"); + const bool isNative = params->arguments.startsWith(QStringLiteral("native")); if (!params->pluginKey.isEmpty()) { - if (params->pluginKey != QLatin1String("QQmlDebugServer")) + if (params->pluginKey == serverConnector || params->pluginKey == nativeConnector) + params->instance = loadQQmlDebugConnector(params->pluginKey); + else return 0; // We cannot load anything else, yet } else if (params->arguments.isEmpty()) { return 0; // no explicit class name given and no command line arguments + } else { + params->instance = loadQQmlDebugConnector(isNative ? nativeConnector : serverConnector); } - params->instance = loadQQmlDebugConnector(QLatin1String("QQmlDebugServer")); + if (params->instance) { foreach (const QJsonObject &object, metaDataForQQmlDebugService()) { foreach (const QJsonValue &key, object.value(QLatin1String("MetaData")).toObject() |