Commit d554aa86 authored by Olivier Goffart's avatar Olivier Goffart
Browse files

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

parent 05090515
......@@ -430,7 +430,13 @@ void QmlEngine::executeJumpToLine(const QString &fileName, int lineNumber)
void QmlEngine::activateFrame(int index)
{
Q_UNUSED(index)
qDebug() << Q_FUNC_INFO << index;
QByteArray reply;
QDataStream rs(&reply, QIODevice::WriteOnly);
rs << QByteArray("ACTIVATE_FRAME");
rs << index;
sendMessage(reply);
gotoLocation(stackHandler()->frames().value(index), true);
}
......@@ -585,8 +591,6 @@ void QmlEngine::messageReceived(const QByteArray &message)
QByteArray command;
stream >> command;
qDebug() << "RECEIVED COMMAND: " << command;
showMessage(_("RECEIVED RESPONSE: ") + quoteUnprintableLatin1(message));
if (command == "STOPPED") {
notifyInferiorSpontaneousStop();
......@@ -647,6 +651,19 @@ void QmlEngine::messageReceived(const QByteArray &message)
if (watchHandler()->expandedINames().contains(data.iname))
expandObject(data.iname, data.objectId);
}
} else if (command == "LOCALS") {
QList<WatchData> locals;
int frameId;
stream >> frameId >> locals;
watchHandler()->beginCycle();
foreach (WatchData data, locals) {
data.iname = "local." + data.exp;
qDebug() << data.iname << data.value;
watchHandler()->insertData(data);
if (watchHandler()->expandedINames().contains(data.iname))
expandObject(data.iname, data.objectId);
}
watchHandler()->endCycle();
} else {
qDebug() << Q_FUNC_INFO << "Unknown command: " << command;
}
......
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment