aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4debugging_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-07-21 18:56:32 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-10 10:05:09 +0000
commitbf5db2bbc1da83a9930832e628e65ec64cd4b831 (patch)
tree201a6b57ac3177ad01c3ffb1e7d6e98d952439ec /src/qml/jsruntime/qv4debugging_p.h
parentdc341e6c1c524330b838a62ceeaa148a01dc0729 (diff)
Move V4 debugger agent into the debugger plugin
The debugger is the only thing that actually needs it. Note that for this to work we need to make QV4::Debugging::Debugger a QObject and add some signals. The net effect is still a reduction in binary size of about 1kb. Change-Id: Ibecb8cfa140fc26fc13c8cbefb3d027ebdcd28a4 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4debugging_p.h')
-rw-r--r--src/qml/jsruntime/qv4debugging_p.h63
1 files changed, 6 insertions, 57 deletions
diff --git a/src/qml/jsruntime/qv4debugging_p.h b/src/qml/jsruntime/qv4debugging_p.h
index 424459a7d9..b85611f457 100644
--- a/src/qml/jsruntime/qv4debugging_p.h
+++ b/src/qml/jsruntime/qv4debugging_p.h
@@ -61,8 +61,6 @@ enum PauseReason {
Step
};
-class DebuggerAgent;
-
struct DebuggerBreakPoint {
DebuggerBreakPoint(const QString &fileName, int line)
: fileName(fileName), lineNumber(line)
@@ -137,8 +135,9 @@ private:
DataCollector::Refs *m_previousRefs;
};
-class Q_QML_EXPORT Debugger
+class Q_QML_EXPORT Debugger : public QObject
{
+ Q_OBJECT
public:
class Job
{
@@ -162,15 +161,10 @@ public:
};
Debugger(ExecutionEngine *engine);
- ~Debugger();
ExecutionEngine *engine() const
{ return m_engine; }
- void attachToAgent(DebuggerAgent *agent);
- void detachFromAgent();
- DebuggerAgent *agent() const { return m_agent; }
-
void gatherSources(int requestSequenceNr);
void pause();
void resume(Speed speed);
@@ -214,6 +208,10 @@ public: // execution hooks
void leavingFunction(const ReturnedValue &retVal);
void aboutToThrow();
+signals:
+ void sourcesCollected(QV4::Debugging::Debugger *self, const QStringList &sources, int seq);
+ void debuggerPaused(QV4::Debugging::Debugger *self, QV4::Debugging::PauseReason reason);
+
private:
Function *getFunction() const;
@@ -228,7 +226,6 @@ private:
private:
QV4::ExecutionEngine *m_engine;
QV4::PersistentValue m_currentContext;
- DebuggerAgent *m_agent;
QMutex m_lock;
QWaitCondition m_runningCondition;
State m_state;
@@ -245,54 +242,6 @@ private:
QWaitCondition m_jobIsRunning;
};
-class Q_QML_EXPORT DebuggerAgent : public QObject
-{
- Q_OBJECT
-public:
- DebuggerAgent(): m_breakOnThrow(false) {}
- ~DebuggerAgent();
-
- void addDebugger(Debugger *debugger);
- void removeDebugger(Debugger *debugger);
-
- void pause(Debugger *debugger) const;
- void pauseAll() const;
- void resumeAll() const;
- int addBreakPoint(const QString &fileName, int lineNumber, bool enabled = true, const QString &condition = QString());
- void removeBreakPoint(int id);
- void removeAllBreakPoints();
- void enableBreakPoint(int id, bool onoff);
- QList<int> breakPointIds(const QString &fileName, int lineNumber) const;
-
- bool breakOnThrow() const { return m_breakOnThrow; }
- void setBreakOnThrow(bool onoff);
-
- Q_INVOKABLE virtual void debuggerPaused(QV4::Debugging::Debugger *debugger,
- QV4::Debugging::PauseReason reason) = 0;
- Q_INVOKABLE virtual void sourcesCollected(QV4::Debugging::Debugger *debugger,
- QStringList sources, int requestSequenceNr) = 0;
-
-protected:
- QList<Debugger *> m_debuggers;
-
- struct BreakPoint {
- QString fileName;
- int lineNr;
- bool enabled;
- QString condition;
-
- BreakPoint(): lineNr(-1), enabled(false) {}
- BreakPoint(const QString &fileName, int lineNr, bool enabled, const QString &condition)
- : fileName(fileName), lineNr(lineNr), enabled(enabled), condition(condition)
- {}
-
- bool isValid() const { return lineNr >= 0 && !fileName.isEmpty(); }
- };
-
- QHash<int, BreakPoint> m_breakPoints;
- bool m_breakOnThrow;
-};
-
} // namespace Debugging
} // namespace QV4