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// Qt-Security score:significant
4
5#ifndef QV4DEBUGGER_H
6#define QV4DEBUGGER_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
20#include <private/qv4debugging_p.h>
21#include <private/qv4function_p.h>
22#include <private/qv4context_p.h>
23#include <private/qv4persistent_p.h>
24
25#include <QtCore/qmutex.h>
26#include <QtCore/qwaitcondition.h>
27
29
30class QV4DebugJob;
33{
35public:
41
42 enum State {
45 };
46
55
62
63 QV4Debugger(QV4::ExecutionEngine *engine);
64
65 QV4::ExecutionEngine *engine() const;
66 const QV4DataCollector *collector() const;
68
69 void pause();
70 void resume(Speed speed);
71
72 State state() const;
73
74 void addBreakPoint(const QString &fileName, int lineNumber,
75 const QString &condition = QString());
76 void removeBreakPoint(const QString &fileName, int lineNumber);
77
78 void setBreakOnThrow(bool onoff);
79
80 void clearPauseRequest();
81
82 // used for testing
89
90 QVector<QV4::StackFrame> stackTrace(int frameLimit = -1) const;
92
93 QV4::Function *getFunction() const;
94 void runInEngine(QV4DebugJob *job);
95
96 // compile-time interface
98
99 // execution hooks
101 void leavingFunction(const QV4::ReturnedValue &retVal) override;
102 void aboutToThrow() override;
103
104 bool pauseAtNextOpportunity() const override;
105
109
110private:
111 // requires lock to be held
112 void pauseAndWait(PauseReason reason);
113 bool reallyHitTheBreakPoint(const QString &filename, int linenr);
114 void runInEngine_havingLock(QV4DebugJob *job);
115 void runJobUnpaused();
116
117 QV4::ExecutionEngine *m_engine;
118 QV4::CppStackFrame *m_currentFrame = 0;
119 QMutex m_lock;
120 QWaitCondition m_runningCondition;
121 State m_state;
122 Speed m_stepping;
123 bool m_pauseRequested;
124 bool m_haveBreakPoints;
125 bool m_breakOnThrow;
126
127 QHash<BreakPoint, QString> m_breakPoints;
128 QV4::PersistentValue m_returnedValue;
129
130 QV4DebugJob *m_gatherSources;
131 QV4DebugJob *m_runningJob;
132 QV4DataCollector m_collector;
133 QWaitCondition m_jobIsRunning;
134};
135
136QT_END_NAMESPACE
137
138Q_DECLARE_METATYPE(QV4Debugger::PauseReason)
139Q_DECLARE_METATYPE(QV4Debugger*)
140
141#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()
Combined button and popup list for selecting options.
Definition qjsvalue.h:23
QDataStream & operator>>(QDataStream &, QQmlEngineDebugServiceImpl::QQmlObjectProperty &)
QDataStream & operator>>(QDataStream &, QQmlEngineDebugServiceImpl::QQmlObjectData &)