8#include <private/qqmlengine_p.h>
9#include <private/qv4compileddata_p.h>
18#if __cplusplus
>= 202002L
19# define Q_ATOMIC_FLAG_INIT {}
21# define Q_ATOMIC_FLAG_INIT ATOMIC_FLAG_INIT
26void QQmlDebuggingEnabler::enableDebugging(
bool printWarning)
28 if (printWarning && !s_printedWarning.test_and_set(std::memory_order_relaxed)) {
29 fprintf(stderr,
"QML debugging is enabled. Only use this in a safe environment.\n");
32 QQmlEnginePrivate::qml_debugging_enabled.store(
true, std::memory_order_relaxed);
35#if QT_DEPRECATED_SINCE(6
, 4
)
36QQmlDebuggingEnabler::QQmlDebuggingEnabler(
bool printWarning)
38 enableDebugging(printWarning);
43
44
45
46
47
48QStringList QQmlDebuggingEnabler::debuggerServices()
50 return {QV4DebugService::s_key, QQmlEngineDebugService::s_key, QDebugMessageService::s_key};
54
55
56
57
58QStringList QQmlDebuggingEnabler::inspectorServices()
60 return {QQmlInspectorService::s_key};
64
65
66
67
68
69QStringList QQmlDebuggingEnabler::profilerServices()
71 return {QQmlProfilerService::s_key, QQmlEngineControlService::s_key, QDebugMessageService::s_key};
75
76
77
78
79
80QStringList QQmlDebuggingEnabler::nativeDebuggerServices()
82 return {QQmlNativeDebugService::s_key};
86
87
88
89
90
91
92
93
94
95
96
97void QQmlDebuggingEnabler::setServices(
const QStringList &services)
99 QQmlDebugConnector::setServices(services);
103
104
105
106
107
108
109
110
111
114
115
116
117
118
119
120
121
122bool QQmlDebuggingEnabler::startTcpDebugServer(
int port, StartMode mode,
const QString &hostName)
124 QVariantHash configuration;
125 configuration[QLatin1String(
"portFrom")] = configuration[QLatin1String(
"portTo")] = port;
126 configuration[QLatin1String(
"block")] = (mode == WaitForClient);
127 configuration[QLatin1String(
"hostAddress")] = hostName;
128 return startDebugConnector(QLatin1String(
"QQmlDebugServer"), configuration);
132
133
134
135
136
137
138
139
140
141bool QQmlDebuggingEnabler::connectToLocalDebugger(
const QString &socketFileName, StartMode mode)
143 QVariantHash configuration;
144 configuration[QLatin1String(
"fileName")] = socketFileName;
145 configuration[QLatin1String(
"block")] = (mode == WaitForClient);
146 return startDebugConnector(QLatin1String(
"QQmlDebugServer"), configuration);
150
151
152
153
154
155
156
157
158
159bool QQmlDebuggingEnabler::startDebugConnector(
const QString &pluginName,
160 const QVariantHash &configuration)
162 QQmlDebugConnector::setPluginKey(pluginName);
163 QQmlDebugConnector *connector = QQmlDebugConnector::instance();
164 return connector ? connector->open(configuration) :
false;
183 QV4_DATA_STRUCTURE_VERSION
186Q_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)