diff options
author | Erik Verbruggen <erik.verbruggen@me.com> | 2013-09-11 13:46:27 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-24 14:34:33 +0200 |
commit | 63ddfee7550b4d12ddb56e4575d8bb27c664c41e (patch) | |
tree | 4aa6281bec7705bc183829b1a776916d8b0054ce /src/qml/jsruntime/qv4debugging_p.h | |
parent | aa1760f84bd711cf56159075630fb71d38a4087b (diff) |
V4 debugger: retrieve formals and locals.
Change-Id: I47507a4d7d1b429b9c43ed3a7822079efe577327
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4debugging_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4debugging_p.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4debugging_p.h b/src/qml/jsruntime/qv4debugging_p.h index e44f415da4..133cc3e17c 100644 --- a/src/qml/jsruntime/qv4debugging_p.h +++ b/src/qml/jsruntime/qv4debugging_p.h @@ -64,12 +64,35 @@ class DebuggerAgent; class Q_QML_EXPORT Debugger { public: + struct VarInfo { + enum Type { + Invalid = 0, + Undefined = 1, + Null, + Number, + String, + Bool, + Object + }; + + QString name; + QVariant value; + Type type; + + VarInfo(): type(Invalid) {} + VarInfo(const QString &name, const QVariant &value, Type type) + : name(name), value(value), type(type) + {} + + bool isValid() const { return type != Invalid; } + }; + enum State { Running, Paused }; - Debugger(ExecutionEngine *_engine); + Debugger(ExecutionEngine *engine); ~Debugger(); void attachToAgent(DebuggerAgent *agent); @@ -98,6 +121,10 @@ public: } void setPendingBreakpoints(Function *function); + QVector<StackFrame> stackTrace(int frameLimit = -1) const; + QList<VarInfo> retrieveArgumentsFromContext(const QStringList &path, int frame = 0); + QList<VarInfo> retrieveLocalsFromContext(const QStringList &path, int frame = 0); + public: // compile-time interface void maybeBreakAtInstruction(const uchar *code, bool breakPointHit); @@ -110,6 +137,9 @@ private: void applyPendingBreakPoints(); + QList<Debugger::VarInfo> retrieveFromValue(const ObjectRef o, const QStringList &path) const; + void convert(ValueRef v, QVariant *varValue, VarInfo::Type *type) const; + struct BreakPoints : public QHash<QString, QList<int> > { void add(const QString &fileName, int lineNumber); @@ -118,7 +148,7 @@ private: void applyToFunction(Function *function, bool removeBreakPoints); }; - QV4::ExecutionEngine *_engine; + QV4::ExecutionEngine *m_engine; DebuggerAgent *m_agent; QMutex m_lock; QWaitCondition m_runningCondition; @@ -142,6 +172,7 @@ public: void pause(Debugger *debugger) const; void pauseAll() const; + void resumeAll() const; void addBreakPoint(const QString &fileName, int lineNumber) const; void removeBreakPoint(const QString &fileName, int lineNumber) const; |