QML JS Debugger: clicking on the stackstrace shows the locals of this context

This commit is contained in:
Olivier Goffart
2010-07-22 15:22:46 +02:00
parent 050905157c
commit d554aa86b7
2 changed files with 45 additions and 3 deletions

View File

@@ -335,7 +335,32 @@ void JSDebuggerAgent::messageReceived(const QByteArray& message)
rs << QByteArray("EXPANDED") << requestId << result;
sendMessage(reply);
state = oldState;
} else if (command == "ACTIVATE_FRAME") {
State oldState = state;
state = Stopped;
int frameId;
ds >> frameId;
int deep = 0;
QScriptContext *ctx = engine()->currentContext();
while (ctx && deep < frameId) {
ctx = ctx->parentContext();
deep++;
}
QList<JSAgentWatchData> locals;
if (ctx)
locals = expandObject(ctx->activationObject());
recordKnownObjects(locals);
// Clear any exceptions occurred during locals evaluation.
engine()->clearExceptions();
QByteArray reply;
QDataStream rs(&reply, QIODevice::WriteOnly);
rs << QByteArray("LOCALS") << frameId << locals;
sendMessage(reply);
} else {
qDebug() << Q_FUNC_INFO << "Unknown command" << command;
}