From 63ddfee7550b4d12ddb56e4575d8bb27c664c41e Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 11 Sep 2013 13:46:27 +0200 Subject: V4 debugger: retrieve formals and locals. Change-Id: I47507a4d7d1b429b9c43ed3a7822079efe577327 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4debugging_p.h | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'src/qml/jsruntime/qv4debugging_p.h') 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 stackTrace(int frameLimit = -1) const; + QList retrieveArgumentsFromContext(const QStringList &path, int frame = 0); + QList 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 retrieveFromValue(const ObjectRef o, const QStringList &path) const; + void convert(ValueRef v, QVariant *varValue, VarInfo::Type *type) const; + struct BreakPoints : public QHash > { 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; -- cgit v1.2.3