OpenCoverage

qqmldebug.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/debugger/qqmldebug.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qqmldebug.h"-
41#include "qqmldebugconnector_p.h"-
42#include "qqmldebugserviceinterfaces_p.h"-
43-
44#include <private/qqmlengine_p.h>-
45#include <private/qv4compileddata_p.h>-
46-
47QT_REQUIRE_CONFIG(qml_debug);-
48-
49QT_BEGIN_NAMESPACE-
50-
51QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning)-
52{-
53 if (!QQmlEnginePrivate::qml_debugging_enabled
!QQmlEnginePri...ugging_enabledDescription
TRUEevaluated 58 times by 15 tests
Evaluated by:
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlenginedebugservice
  • tst_qqmlextensionplugin
  • tst_qqmllistmodel
  • tst_qqmlnativeconnector
  • tst_qqmlprofilerservice
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_quicktestmainwithsetup
  • tst_signalspy
  • tst_testfiltering
FALSEevaluated 52 times by 8 tests
Evaluated by:
  • tst_qqmlextensionplugin
  • tst_qqmllistmodel
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_quicktestmainwithsetup
  • tst_signalspy
  • tst_testfiltering
52-58
54 && printWarning) {
printWarningDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlnativeconnector
FALSEevaluated 56 times by 14 tests
Evaluated by:
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlenginedebugservice
  • tst_qqmlextensionplugin
  • tst_qqmllistmodel
  • tst_qqmlprofilerservice
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_quicktestmainwithsetup
  • tst_signalspy
  • tst_testfiltering
2-56
55 qDebug("QML debugging is enabled. Only use this in a safe environment.");-
56 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlnativeconnector
2
57 QQmlEnginePrivate::qml_debugging_enabled = true;-
58}
executed 110 times by 15 tests: end of block
Executed by:
  • tst_qqmldebugclient
  • tst_qqmldebugjs
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
  • tst_qqmlenginedebugservice
  • tst_qqmlextensionplugin
  • tst_qqmllistmodel
  • tst_qqmlnativeconnector
  • tst_qqmlprofilerservice
  • tst_qquickanimationcontroller
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_quicktestmainwithsetup
  • tst_signalspy
  • tst_testfiltering
110
59-
60/*!-
61 * Retrieves the plugin keys of the debugger services provided by default. The debugger services-
62 * enable a debug client to use a Qml/JavaScript debugger, in order to set breakpoints, pause-
63 * execution, evaluate expressions and similar debugging tasks.-
64 * \return List of plugin keys of default debugger services.-
65 */-
66QStringList QQmlDebuggingEnabler::debuggerServices()-
67{-
68 return QStringList() << QV4DebugService::s_key << QQmlEngineDebugService::s_key
executed 12 times by 3 tests: return QStringList() << QV4DebugService::s_key << QQmlEngineDebugService::s_key << QDebugMessageService::s_key;
Executed by:
  • tst_qqmldebugclient
  • tst_qqmldebuggingenabler
  • tst_qqmldebugservice
12
69 << QDebugMessageService::s_key;
executed 12 times by 3 tests: return QStringList() << QV4DebugService::s_key << QQmlEngineDebugService::s_key << QDebugMessageService::s_key;
Executed by:
  • tst_qqmldebugclient
  • tst_qqmldebuggingenabler
  • tst_qqmldebugservice
12
70}-
71-
72/*!-
73 * Retrieves the plugin keys of the inspector services provided by default. The inspector services-
74 * enable a debug client to use a visual inspector tool for Qt Quick.-
75 * \return List of plugin keys of default inspector services.-
76 */-
77QStringList QQmlDebuggingEnabler::inspectorServices()-
78{-
79 return QStringList() << QQmlInspectorService::s_key;
executed 12 times by 3 tests: return QStringList() << QQmlInspectorService::s_key;
Executed by:
  • tst_qqmldebugclient
  • tst_qqmldebuggingenabler
  • tst_qqmldebugservice
12
80}-
81-
82/*!-
83 * Retrieves the names of the profiler services provided by default. The profiler services enable a-
84 * debug client to use a profiler and track the time taken by various QML and JavaScript constructs,-
85 * as well as the QtQuick SceneGraph.-
86 * \return List of plugin keys of default profiler services.-
87 */-
88QStringList QQmlDebuggingEnabler::profilerServices()-
89{-
90 return QStringList() << QQmlProfilerService::s_key << QQmlEngineControlService::s_key
executed 8 times by 3 tests: return QStringList() << QQmlProfilerService::s_key << QQmlEngineControlService::s_key << QDebugMessageService::s_key;
Executed by:
  • tst_qqmldebugclient
  • tst_qqmldebuggingenabler
  • tst_qqmldebugservice
8
91 << QDebugMessageService::s_key;
executed 8 times by 3 tests: return QStringList() << QQmlProfilerService::s_key << QQmlEngineControlService::s_key << QDebugMessageService::s_key;
Executed by:
  • tst_qqmldebugclient
  • tst_qqmldebuggingenabler
  • tst_qqmldebugservice
8
92}-
93-
94/*!-
95 * Retrieves the plugin keys of the debug services designed to be used with a native debugger. The-
96 * native debugger will communicate with these services by directly reading and writing the-
97 * application's memory.-
98 * \return List of plugin keys of debug services designed to be used with a native debugger.-
99 */-
100QStringList QQmlDebuggingEnabler::nativeDebuggerServices()-
101{-
102 return QStringList() << QQmlNativeDebugService::s_key;
executed 4 times by 1 test: return QStringList() << QQmlNativeDebugService::s_key;
Executed by:
  • tst_qqmldebuggingenabler
4
103}-
104-
105/*!-
106 * Restricts the services available from the debug connector. The connector will scan plugins in the-
107 * "qmltooling" subdirectory of the default plugin path. If this function is not called before the-
108 * debug connector is enabled, all services found that way will be available to any client. If this-
109 * function is called, only the services with plugin keys given in \a services will be available.-
110 *-
111 * Use this method to disable debugger and inspector services when profiling to get better-
112 * performance and more realistic profiles. The debugger service will put any JavaScript engine it-
113 * connects to into interpreted mode, disabling the JIT compiler.-
114 *-
115 * \sa debuggerServices(), profilerServices(), inspectorServices()-
116 */-
117void QQmlDebuggingEnabler::setServices(const QStringList &services)-
118{-
119 QQmlDebugConnector::setServices(services);-
120}
never executed: end of block
0
121-
122/*!-
123 * \enum QQmlDebuggingEnabler::StartMode-
124 *-
125 * Defines the debug connector's start behavior. You can interrupt QML engines starting while a-
126 * debug client is connecting, in order to set breakpoints in or profile startup code.-
127 *-
128 * \value DoNotWaitForClient Run any QML engines as usual while the debug services are connecting.-
129 * \value WaitForClient If a QML engine starts while the debug services are connecting,-
130 * interrupt it until they are done.-
131 */-
132-
133/*!-
134 * Enables debugging for QML engines created after calling this function. The debug connector will-
135 * listen on \a port at \a hostName and block the QML engine until it receives a connection if-
136 * \a mode is \c WaitForClient. If \a mode is not specified it won't block and if \a hostName is not-
137 * specified it will listen on all available interfaces. You can only start one debug connector at a-
138 * time. A debug connector may have already been started if the -qmljsdebugger= command line-
139 * argument was given. This method returns \c true if a new debug connector was successfully-
140 * started, or \c false otherwise.-
141 */-
142bool QQmlDebuggingEnabler::startTcpDebugServer(int port, StartMode mode, const QString &hostName)-
143{-
144 QVariantHash configuration;-
145 configuration[QLatin1String("portFrom")] = configuration[QLatin1String("portTo")] = port;-
146 configuration[QLatin1String("block")] = (mode == WaitForClient);-
147 configuration[QLatin1String("hostAddress")] = hostName;-
148 return startDebugConnector(QLatin1String("QQmlDebugServer"), configuration);
executed 4 times by 2 tests: return startDebugConnector(QLatin1String("QQmlDebugServer"), configuration);
Executed by:
  • tst_qqmldebugclient
  • tst_qqmldebugservice
4
149}-
150-
151/*!-
152 * \since 5.6-
153 *-
154 * Enables debugging for QML engines created after calling this function. The debug connector will-
155 * connect to a debugger waiting on a local socket at the given \a socketFileName and block the QML-
156 * engine until the connection is established if \a mode is \c WaitForClient. If \a mode is not-
157 * specified it will not block. You can only start one debug connector at a time. A debug connector-
158 * may have already been started if the -qmljsdebugger= command line argument was given. This method-
159 * returns \c true if a new debug connector was successfully started, or \c false otherwise.-
160 */-
161bool QQmlDebuggingEnabler::connectToLocalDebugger(const QString &socketFileName, StartMode mode)-
162{-
163 QVariantHash configuration;-
164 configuration[QLatin1String("fileName")] = socketFileName;-
165 configuration[QLatin1String("block")] = (mode == WaitForClient);-
166 return startDebugConnector(QLatin1String("QQmlDebugServer"), configuration);
executed 2 times by 1 test: return startDebugConnector(QLatin1String("QQmlDebugServer"), configuration);
Executed by:
  • tst_qqmldebuglocal
2
167}-
168-
169/*!-
170 * \since 5.7-
171 *-
172 * Enables debugging for QML engines created after calling this function. A debug connector plugin-
173 * specified by \a pluginName will be loaded and started using the given \a configuration. Supported-
174 * configuration entries and their semantics depend on the plugin being loaded. You can only start-
175 * one debug connector at a time. A debug connector may have already been started if the-
176 * -qmljsdebugger= command line argument was given. This method returns \c true if a new debug-
177 * connector was successfully started, or \c false otherwise.-
178 */-
179bool QQmlDebuggingEnabler::startDebugConnector(const QString &pluginName,-
180 const QVariantHash &configuration)-
181{-
182 QQmlDebugConnector::setPluginKey(pluginName);-
183 QQmlDebugConnector *connector = QQmlDebugConnector::instance();-
184 return connector ? connector->open(configuration) : false;
executed 6 times by 3 tests: return connector ? connector->open(configuration) : false;
Executed by:
  • tst_qqmldebugclient
  • tst_qqmldebuglocal
  • tst_qqmldebugservice
6
185}-
186-
187enum { HookCount = 4 };-
188-
189// Only add to the end, and bump version if you do.-
190quintptr Q_QML_EXPORT qtDeclarativeHookData[] = {-
191 // Version of this Array. Bump if you add to end.-
192 2,-
193-
194 // Number of entries in this array.-
195 HookCount,-
196-
197 // TypeInformationVersion, an integral value, bumped whenever private-
198 // object sizes or member offsets that are used in Qt Creator's-
199 // data structure "pretty printing" change.-
200 3,-
201-
202 // Version of the cache data.-
203 QV4_DATA_STRUCTURE_VERSION-
204};-
205-
206Q_STATIC_ASSERT(HookCount == sizeof(qtDeclarativeHookData) / sizeof(qtDeclarativeHookData[0]));-
207-
208QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0