Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qv4debugger.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QV4DEBUGGER_H
5#define QV4DEBUGGER_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
19#include <private/qv4debugging_p.h>
20#include <private/qv4function_p.h>
21#include <private/qv4context_p.h>
22#include <private/qv4persistent_p.h>
23
24#include <QtCore/qmutex.h>
25#include <QtCore/qwaitcondition.h>
26
28
29class QV4DebugJob;
32{
34public:
40
41 enum State {
44 };
45
54
61
62 QV4Debugger(QV4::ExecutionEngine *engine);
63
64 QV4::ExecutionEngine *engine() const;
65 const QV4DataCollector *collector() const;
67
68 void pause();
69 void resume(Speed speed);
70
71 State state() const;
72
73 void addBreakPoint(const QString &fileName, int lineNumber,
74 const QString &condition = QString());
75 void removeBreakPoint(const QString &fileName, int lineNumber);
76
77 void setBreakOnThrow(bool onoff);
78
79 void clearPauseRequest();
80
81 // used for testing
88
89 QVector<QV4::StackFrame> stackTrace(int frameLimit = -1) const;
91
92 QV4::Function *getFunction() const;
93 void runInEngine(QV4DebugJob *job);
94
95 // compile-time interface
97
98 // execution hooks
100 void leavingFunction(const QV4::ReturnedValue &retVal) override;
101 void aboutToThrow() override;
102
103 bool pauseAtNextOpportunity() const override;
104
108
109private:
110 // requires lock to be held
111 void pauseAndWait(PauseReason reason);
112 bool reallyHitTheBreakPoint(const QString &filename, int linenr);
113 void runInEngine_havingLock(QV4DebugJob *job);
114 void runJobUnpaused();
115
116 QV4::ExecutionEngine *m_engine;
117 QV4::CppStackFrame *m_currentFrame = 0;
118 QMutex m_lock;
119 QWaitCondition m_runningCondition;
120 State m_state;
121 Speed m_stepping;
122 bool m_pauseRequested;
123 bool m_haveBreakPoints;
124 bool m_breakOnThrow;
125
126 QHash<BreakPoint, QString> m_breakPoints;
127 QV4::PersistentValue m_returnedValue;
128
129 QV4DebugJob *m_gatherSources;
130 QV4DebugJob *m_runningJob;
131 QV4DataCollector m_collector;
132 QWaitCondition m_jobIsRunning;
133};
134
135QT_END_NAMESPACE
136
137Q_DECLARE_METATYPE(QV4Debugger::PauseReason)
138Q_DECLARE_METATYPE(QV4Debugger*)
139
140#endif // QV4DEBUGGER_H
void objectCreated(QJSEngine *, QObject *) override
void engineAboutToBeAdded(QJSEngine *) override
void messageReceived(const QByteArray &) override
void engineAboutToBeRemoved(QJSEngine *) override
QQmlDebugStatesDelegate * statesDelegate()
void send(QJsonObject v4Payload)
void engineAboutToBeRemoved(QJSEngine *engine) override
QV4DebuggerAgent debuggerAgent
void messageReceived(const QByteArray &) override
void stateAboutToBeChanged(State state) override
void signalEmitted(const QString &signal) override
void sendSomethingToSomebody(const char *type, int magicNumber=1)
void engineAdded(QJSEngine *engine) override
void selectFrame(int frameNr)
void setBreakOnThrow(bool onoff)
const QList< QV4Debugger * > & debuggers()
QList< int > breakPointIds(const QString &fileName, int lineNumber) const
void handleDebuggerDeleted(QObject *debugger)
bool breakOnThrow() const
int addBreakPoint(const QString &fileName, int lineNumber, bool enabled=true, const QString &condition=QString())
void addDebugger(QV4Debugger *debugger)
void removeDebugger(QV4Debugger *debugger)
void pause(QV4Debugger *debugger) const
void removeBreakPoint(int id)
void enableBreakPoint(int id, bool onoff)
void debuggerPaused(QV4Debugger *debugger, QV4Debugger::PauseReason reason)
void maybeBreakAtInstruction() override
QV4::Function * getFunction() const
void enteringFunction() override
void scheduleJob()
void runInEngine(QV4DebugJob *job)
QV4DataCollector * collector()
void removeBreakPoint(const QString &fileName, int lineNumber)
QV4::ExecutionEngine * engine() const
void resume(Speed speed)
QVector< QV4::StackFrame > stackTrace(int frameLimit=-1) const
void setBreakOnThrow(bool onoff)
bool pauseAtNextOpportunity() const override
void leavingFunction(const QV4::ReturnedValue &retVal) override
State state() const
QVector< QV4::Heap::ExecutionContext::ContextType > getScopeTypes(int frame=0) const
ExecutionState currentExecutionState() const
const QV4DataCollector * collector() const
QV4Debugger(QV4::ExecutionEngine *engine)
void aboutToThrow() override
void addBreakPoint(const QString &fileName, int lineNumber, const QString &condition=QString())
void clearPauseRequest()
Definition qjsvalue.h:23
QDataStream & operator>>(QDataStream &, QQmlEngineDebugServiceImpl::QQmlObjectProperty &)
QDataStream & operator>>(QDataStream &, QQmlEngineDebugServiceImpl::QQmlObjectData &)