Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
18#include "qv4datacollector.h"
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 {
43 Paused
44 };
45
54
61
63
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;
90 QVector<QV4::Heap::ExecutionContext::ContextType> getScopeTypes(int frame = 0) const;
91
93 void runInEngine(QV4DebugJob *job);
94
95 // compile-time interface
96 void maybeBreakAtInstruction() override;
97
98 // execution hooks
99 void enteringFunction() override;
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
136
139
140#endif // QV4DEBUGGER_H
\inmodule QtCore
Definition qmutex.h:281
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
void maybeBreakAtInstruction() override
QV4::Function * getFunction() const
void enteringFunction() override
void scheduleJob()
void runInEngine(QV4DebugJob *job)
void removeBreakPoint(const QString &fileName, int lineNumber)
QV4::ExecutionEngine * engine() const
void debuggerPaused(QV4Debugger *self, QV4Debugger::PauseReason reason)
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.
quint64 ReturnedValue
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1525
GLenum condition
#define Q_OBJECT
#define Q_SIGNALS
future resume()
QFrame frame
[0]
BreakPoint(const QString &fileName, int line)