QmlDebugger: keeping watches when changing stack frames

Reviewed-by: Kai Koehne
This commit is contained in:
Christiaan Janssen
2011-04-20 16:47:47 +02:00
parent 01ad08400e
commit 85801227a9
2 changed files with 28 additions and 3 deletions

View File

@@ -538,11 +538,21 @@ void JSDebuggerAgentPrivate::messageReceived(const QByteArray &message)
deep++;
}
QList<JSAgentWatchData> watches;
QList<JSAgentWatchData> locals = getLocals(ctx);
// re-evaluate watches given the frame's context
QScriptContext *currentCtx = engine()->pushContext();
currentCtx->setActivationObject(ctx->activationObject());
currentCtx->setThisObject(ctx->thisObject());
foreach (const QString &expr, watchExpressions)
watches << fromScriptValue(expr, engine()->evaluate(expr));
recordKnownObjects(watches);
engine()->popContext();
QByteArray reply;
QDataStream rs(&reply, QIODevice::WriteOnly);
rs << QByteArray("LOCALS") << frameId << locals;
rs << QByteArray("LOCALS") << frameId << locals << watches;
sendMessage(reply);
} else if (command == "SET_PROPERTY") {
SetupExecEnv execEnv(this);