9#include <private/qqmlengine_p.h>
10#include <private/qv4compileddata_p.h>
18#include <qt_windows.h>
25#if __cplusplus
>= 202002L
26# define Q_ATOMIC_FLAG_INIT {}
28# define Q_ATOMIC_FLAG_INIT ATOMIC_FLAG_INIT
33
34
35
36
37
38
39
40
41
42
43
44
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64void QQmlDebuggingEnabler::enableDebugging(
bool printWarning)
66 if (printWarning && !s_printedWarning.test_and_set(std::memory_order_relaxed)) {
67 QByteArray warning(
"QML debugging is enabled. Only use this in a safe environment.\n");
68 if (qEnvironmentVariableIsSet(
"CLICOLOR_FORCE") || qEnvironmentVariableIsSet(
"QTC_RUN")
69 || qEnvironmentVariableIsSet(
"VSCODE_CLI")) {
70 warning = QByteArray(
"\033[38;2;255;0;0m") + warning +
"\033[0m";
74 if (!qEnvironmentVariableIsSet(
"VSCODE_CLI"))
75 OutputDebugStringA(warning);
78 fprintf(stderr,
"%s", warning.constData());
81 QQmlEnginePrivate::qml_debugging_enabled.store(
true, std::memory_order_relaxed);
84#if QT_DEPRECATED_SINCE(6
, 4
)
86
87
88QQmlDebuggingEnabler::QQmlDebuggingEnabler(
bool printWarning)
90 enableDebugging(printWarning);
95
96
97
98
99
100QStringList QQmlDebuggingEnabler::debuggerServices()
102 return {QV4DebugService::s_key, QQmlEngineDebugService::s_key, QDebugMessageService::s_key};
106
107
108
109
110QStringList QQmlDebuggingEnabler::inspectorServices()
112 return {QQmlInspectorService::s_key};
116
117
118
119
120
121QStringList QQmlDebuggingEnabler::profilerServices()
123 return {QQmlProfilerService::s_key, QQmlEngineControlService::s_key, QDebugMessageService::s_key};
127
128
129
130
131
132QStringList QQmlDebuggingEnabler::nativeDebuggerServices()
134 return {QQmlNativeDebugService::s_key};
138
139
140
141
142
143
144
145
146
147
148
149void QQmlDebuggingEnabler::setServices(
const QStringList &services)
151 QQmlDebugConnector::setServices(services);
155
156
157
158
159
160
161
162
163
166
167
168
169
170
171
172
173
174bool QQmlDebuggingEnabler::startTcpDebugServer(
int port, StartMode mode,
const QString &hostName)
176 QVariantHash configuration;
177 configuration[QLatin1String(
"portFrom")] = configuration[QLatin1String(
"portTo")] = port;
178 configuration[QLatin1String(
"block")] = (mode == WaitForClient);
179 configuration[QLatin1String(
"hostAddress")] = hostName;
180 return startDebugConnector(QLatin1String(
"QQmlDebugServer"), configuration);
184
185
186
187
188
189
190
191
192
193bool QQmlDebuggingEnabler::connectToLocalDebugger(
const QString &socketFileName, StartMode mode)
195 QVariantHash configuration;
196 configuration[QLatin1String(
"fileName")] = socketFileName;
197 configuration[QLatin1String(
"block")] = (mode == WaitForClient);
198 return startDebugConnector(QLatin1String(
"QQmlDebugServer"), configuration);
202
203
204
205
206
207
208
209
210
211bool QQmlDebuggingEnabler::startDebugConnector(
const QString &pluginName,
212 const QVariantHash &configuration)
214 QQmlDebugConnector::setPluginKey(pluginName);
215 QQmlDebugConnector *connector = QQmlDebugConnector::instance();
216 return connector ? connector->open(configuration) :
false;
235 QV4_DATA_STRUCTURE_VERSION
238Q_STATIC_ASSERT(HookCount ==
sizeof(qtDeclarativeHookData) /
sizeof(qtDeclarativeHookData[0]));
#define Q_ATOMIC_FLAG_INIT
static Q_CONSTINIT std::atomic_flag s_printedWarning
QT_REQUIRE_CONFIG(qml_debug)
QDebug Q_QML_EXPORT operator<<(QDebug debug, const QQmlError &error)
Q_STATIC_ASSERT(sizeof(SharedImageHeader) % 4==0)