6#include <private/qqmldebugconnector_p.h>
7#include <private/qv4debugging_p.h>
8#include <private/qv4engine_p.h>
9#include <private/qv4debugging_p.h>
10#include <private/qv4script_p.h>
11#include <private/qv4string_p.h>
12#include <private/qv4objectiterator_p.h>
13#include <private/qv4identifierhash_p.h>
14#include <private/qv4runtime_p.h>
15#include <private/qversionedpacket_p.h>
16#include <private/qqmldebugserviceinterfaces_p.h>
17#include <private/qv4identifiertable_p.h>
19#include <QtQml/qjsengine.h>
20#include <QtCore/qjsonarray.h>
21#include <QtCore/qjsondocument.h>
22#include <QtCore/qjsonobject.h>
23#include <QtCore/qjsonvalue.h>
24#include <QtCore/qvector.h>
25#include <QtCore/qpointer.h>
28#define TRACE_PROTOCOL(s)
57 return a.lineNumber ==
b.lineNumber &&
a.fileName ==
b.fileName
58 &&
a.enabled ==
b.enabled &&
a.condition ==
b.condition
59 &&
a.ignoreCount ==
b.ignoreCount;
157 return m_pauseRequested
159 || m_stepping >= StepOver;
177 bool checkCondition(
const QString &expression);
190 void handleContinue(
QJsonObject *reponse, Speed speed);
194 bool reallyHitTheBreakPoint(
const QV4::Function *function,
int lineNumber);
200 bool m_pauseRequested;
206bool NativeDebugger::checkCondition(
const QString &expression)
210 return r->booleanValue();
227 script.inheritContext =
true;
232 script.run(thisObject);
238 m_runningJob =
false;
243 : m_returnedValue(
engine,
QV4::Value::undefinedValue())
245 m_stepping = NotStepping;
246 m_pauseRequested =
false;
247 m_runningJob =
false;
263 for (
const QString &
signal : std::as_const(breakOnSignals)) {
264 if (
signal == signalName) {
281 handleContinue(response, StepIn);
283 handleContinue(response, StepOut);
285 handleContinue(response, StepOver);
287 handleContinue(response, NotStepping);
322 int line =
f->lineNumber();
327 f =
f->parentFrame();
347 switch (
value.type()) {
397 if (!
name->isValid())
399 if (
name->isStringOrSymbol()) {
461 v = callContext->d()->locals[
i];
505 m_runningJob =
false;
506 if (
result->isUndefined()) {
542void NativeDebugger::pause()
544 m_pauseRequested =
true;
547void NativeDebugger::handleContinue(
QJsonObject *response, Speed speed)
563 if (m_stepping == StepOver) {
569 if (m_stepping == StepIn) {
574 if (m_pauseRequested) {
575 m_pauseRequested =
false;
584 if (reallyHitTheBreakPoint(
function, lineNumber))
595 if (m_stepping == StepIn) {
605 if (m_stepping != NotStepping && m_currentFrame == m_engine->
currentStackFrame) {
607 m_stepping = StepOver;
608 m_returnedValue.
set(m_engine, retVal);
634void NativeDebugger::pauseAndWait()
650bool NativeDebugger::reallyHitTheBreakPoint(
const QV4::Function *function,
int lineNumber)
677 delete m_breakHandler;
688 if (
state() == Enabled)
701 const auto debuggersCopy = m_debuggers;
703 if (
debugger->engine() == executionEngine)
712 if (
state == Enabled) {
745 emit messageToClient(s_key,
ba);
754 emit messageToClient(s_key,
ba);
QVector< BreakPoint > m_breakPoints
void setBreakOnThrow(bool onoff)
void removeBreakPoint(int id)
void enableBreakPoint(int id, bool onoff)
void handleRemoveBreakpoint(QJsonObject *response, const QJsonObject &arguments)
void handleSetBreakpoint(QJsonObject *response, const QJsonObject &arguments)
Collector(QV4::ExecutionEngine *engine)
void collect(QJsonArray *output, const QString &parentIName, const QString &name, const QV4::Value &value)
QV4::ExecutionEngine * m_engine
bool isExpanded(const QString &iname) const
void maybeBreakAtInstruction() override
void aboutToThrow() override
void handleCommand(QJsonObject *response, const QString &cmd, const QJsonObject &arguments)
QV4::ExecutionEngine * engine() const
NativeDebugger(QQmlNativeDebugServiceImpl *service, QV4::ExecutionEngine *engine)
void leavingFunction(const QV4::ReturnedValue &retVal) override
void enteringFunction() override
bool pauseAtNextOpportunity() const override
void signalEmitted(const QString &signal)
static QByteArray fromHex(const QByteArray &hexEncoded)
Returns a decoded copy of the hex encoded array hexEncoded.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
QByteArray toHex(char separator='\0') const
Returns a hex encoded copy of the byte array.
The QJSEngine class provides an environment for evaluating JavaScript code.
QV4::ExecutionEngine * handle() const
\inmodule QtCore\reentrant
void push_back(const QJsonValue &t)
This function is provided for STL compatibility.
\inmodule QtCore\reentrant
QByteArray toJson(JsonFormat format=Indented) const
void setObject(const QJsonObject &object)
Sets object as the main object of this document.
QJsonObject object() const
Returns the QJsonObject contained in the document.
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error=nullptr)
Parses json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it.
\inmodule QtCore\reentrant
iterator insert(const QString &key, const QJsonValue &value)
Inserts a new item with the key key and a value of value.
\inmodule QtCore\reentrant
T value(qsizetype i) const
qsizetype removeAll(const AT &t)
void append(parameter_type t)
const QByteArray & data() const
Returns a reference to the raw packet data.
virtual void stateAboutToBeChanged(State)
virtual void engineAboutToBeAdded(QJSEngine *engine)
virtual void engineAboutToBeRemoved(QJSEngine *engine)
friend class NativeDebugger
void stateAboutToBeChanged(State state) override
void engineAboutToBeRemoved(QJSEngine *engine) override
void engineAboutToBeAdded(QJSEngine *engine) override
void emitAsynchronousMessageToClient(const QJsonObject &message)
QQmlNativeDebugServiceImpl(QObject *parent)
void messageReceived(const QByteArray &message) override
~QQmlNativeDebugServiceImpl() override
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString fileName(ComponentFormattingOptions options=FullyDecoded) const
void set(ExecutionEngine *engine, const Value &value)
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
list append(new Employee("Blackpool", "Stephen"))
QSet< QString >::iterator it
QList< QVariant > arguments
Combined button and popup list for selecting options.
\qmltype Particle \inqmlmodule QtQuick.Particles
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
static struct AttrInfo attrs[]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * message
GLsizei const GLchar *const * string
[0]
static bool isStrict(const QmlIR::Document *doc)
static void setError(QJsonObject *response, const QString &msg)
static QString encodeFrame(QV4::CppStackFrame *f)
#define TRACE_PROTOCOL(s)
size_t qHash(const BreakPoint &b, size_t seed=0) noexcept
bool operator==(const BreakPoint &a, const BreakPoint &b)
static void decodeFrame(const QString &f, QV4::CppStackFrame **frame)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
QLatin1StringView QLatin1String
#define QStringLiteral(str)
static DebuggerProgram debugger
#define TRACE_PROTOCOL(x)
QT_BEGIN_NAMESPACE typedef uchar * output
QTextStream out(stdout)
[7]
QNetworkRequest request(url)
char * toString(const MyType &t)
[31]
\inmodule QtCore \reentrant
ReturnedValue thisObject() const
CppStackFrame * parentFrame() const
static constexpr ReturnedValue undefined()
CppStackFrame * currentStackFrame
ExecutionContext * scriptContext() const
void setDebugger(Debugging::Debugger *)
ExecutionContext * currentContext() const
Pointer< InternalClass *, 0 > internalClass
Q_QML_PRIVATE_EXPORT QString keyAt(uint index) const
static ReturnedValue call(ExecutionEngine *, const Value &)
QV4_NEARLY_ALWAYS_INLINE constexpr quint32 value() const
QString toQStringNoThrow() const
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent