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.");
68 if (qEnvironmentVariableIsSet(
"CLICOLOR_FORCE") || qEnvironmentVariableIsSet(
"QTC_RUN")
69 || qEnvironmentVariableIsSet(
"VSCODE_CLI")) {
70 warning = QByteArray(
"\033[38;2;255;0;0m") + warning +
"\033[0m";
75 if (!qEnvironmentVariableIsSet(
"VSCODE_CLI"))
76 OutputDebugStringA(warning);
79 fprintf(stderr,
"%s", warning.constData());
82 QQmlEnginePrivate::qml_debugging_enabled.store(
true, std::memory_order_relaxed);
85#if QT_DEPRECATED_SINCE(6
, 4
)
87
88
89QQmlDebuggingEnabler::QQmlDebuggingEnabler(
bool printWarning)
91 enableDebugging(printWarning);
96
97
98
99
100
101QStringList QQmlDebuggingEnabler::debuggerServices()
103 return {QV4DebugService::s_key, QQmlEngineDebugService::s_key, QDebugMessageService::s_key};
107
108
109
110
111QStringList QQmlDebuggingEnabler::inspectorServices()
113 return {QQmlInspectorService::s_key};
117
118
119
120
121
122QStringList QQmlDebuggingEnabler::profilerServices()
124 return {QQmlProfilerService::s_key, QQmlEngineControlService::s_key, QDebugMessageService::s_key};
128
129
130
131
132
133QStringList QQmlDebuggingEnabler::nativeDebuggerServices()
135 return {QQmlNativeDebugService::s_key};
139
140
141
142
143
144
145
146
147
148
149
150void QQmlDebuggingEnabler::setServices(
const QStringList &services)
152 QQmlDebugConnector::setServices(services);
156
157
158
159
160
161
162
163
164
167
168
169
170
171
172
173
174
175bool QQmlDebuggingEnabler::startTcpDebugServer(
int port, StartMode mode,
const QString &hostName)
177 QVariantHash configuration;
178 configuration[QLatin1String(
"portFrom")] = configuration[QLatin1String(
"portTo")] = port;
179 configuration[QLatin1String(
"block")] = (mode == WaitForClient);
180 configuration[QLatin1String(
"hostAddress")] = hostName;
181 return startDebugConnector(QLatin1String(
"QQmlDebugServer"), configuration);
185
186
187
188
189
190
191
192
193
194bool QQmlDebuggingEnabler::connectToLocalDebugger(
const QString &socketFileName, StartMode mode)
196 QVariantHash configuration;
197 configuration[QLatin1String(
"fileName")] = socketFileName;
198 configuration[QLatin1String(
"block")] = (mode == WaitForClient);
199 return startDebugConnector(QLatin1String(
"QQmlDebugServer"), configuration);
203
204
205
206
207
208
209
210
211
212bool QQmlDebuggingEnabler::startDebugConnector(
const QString &pluginName,
213 const QVariantHash &configuration)
215 QQmlDebugConnector::setPluginKey(pluginName);
216 QQmlDebugConnector *connector = QQmlDebugConnector::instance();
217 return connector ? connector->open(configuration) :
false;
236 QV4_DATA_STRUCTURE_VERSION
239Q_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)