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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94void QQmlDebuggingEnabler::enableDebugging(
bool printWarning)
96 if (printWarning && !s_printedWarning.test_and_set(std::memory_order_relaxed)) {
97 QByteArray warning(
"QML debugging is enabled. Only use this in a safe environment.");
98 if (qEnvironmentVariableIsSet(
"CLICOLOR_FORCE") || qEnvironmentVariableIsSet(
"QTC_RUN")
99 || qEnvironmentVariableIsSet(
"VSCODE_CLI")) {
100 warning = QByteArray(
"\033[38;2;255;0;0m") + warning +
"\033[0m";
105 if (!qEnvironmentVariableIsSet(
"VSCODE_CLI"))
106 OutputDebugStringA(warning);
109 fprintf(stderr,
"%s", warning.constData());
112 QQmlEnginePrivate::qml_debugging_enabled.store(
true, std::memory_order_relaxed);
115#if QT_DEPRECATED_SINCE(6
, 4
)
117
118
119QQmlDebuggingEnabler::QQmlDebuggingEnabler(
bool printWarning)
121 enableDebugging(printWarning);
126
127
128
129
130
131QStringList QQmlDebuggingEnabler::debuggerServices()
133 return {QV4DebugService::s_key, QQmlEngineDebugService::s_key, QDebugMessageService::s_key};
137
138
139
140
141QStringList QQmlDebuggingEnabler::inspectorServices()
143 return {QQmlInspectorService::s_key};
147
148
149
150
151
152QStringList QQmlDebuggingEnabler::profilerServices()
154 return {QQmlProfilerService::s_key, QQmlEngineControlService::s_key, QDebugMessageService::s_key};
158
159
160
161
162
163QStringList QQmlDebuggingEnabler::nativeDebuggerServices()
165 return {QQmlNativeDebugService::s_key};
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188void QQmlDebuggingEnabler::setServices(
const QStringList &services)
190 QQmlDebugConnector::setServices(services);
194
195
196
197
198
199
200
201
202
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219bool QQmlDebuggingEnabler::startTcpDebugServer(
int port, StartMode mode,
const QString &hostName)
221 QVariantHash configuration;
222 configuration[QLatin1String(
"portFrom")] = configuration[QLatin1String(
"portTo")] = port;
223 configuration[QLatin1String(
"block")] = (mode == WaitForClient);
224 configuration[QLatin1String(
"hostAddress")] = hostName;
225 return startDebugConnector(QLatin1String(
"QQmlDebugServer"), configuration);
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243bool QQmlDebuggingEnabler::connectToLocalDebugger(
const QString &socketFileName, StartMode mode)
245 QVariantHash configuration;
246 configuration[QLatin1String(
"fileName")] = socketFileName;
247 configuration[QLatin1String(
"block")] = (mode == WaitForClient);
248 return startDebugConnector(QLatin1String(
"QQmlDebugServer"), configuration);
252
253
254
255
256
257
258
259
260
261
262
263
264
265bool QQmlDebuggingEnabler::startDebugConnector(
const QString &pluginName,
266 const QVariantHash &configuration)
268 QQmlDebugConnector::setPluginKey(pluginName);
269 QQmlDebugConnector *connector = QQmlDebugConnector::instance();
270 return connector ? connector->open(configuration) :
false;
289 QV4_DATA_STRUCTURE_VERSION
292Q_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)