Commit 5cc536cd authored by Aurindam Jana's avatar Aurindam Jana

QmlV8DebuggerClient: Watched Expressions

Show errors in evaluating watched expressions in the watch window
and not in the console.

Change-Id: I4792d54268bcdef085aa4dab091c5f27a4a01c02
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent ab3d07a2
......@@ -53,7 +53,7 @@
#include <QtScript/QScriptEngine>
#include <QtScript/QScriptValue>
#define DEBUG_QML 1
#define DEBUG_QML 0
#if DEBUG_QML
# define SDEBUG(s) qDebug() << s << '\n'
#else
......@@ -1120,10 +1120,12 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
int seq = resp.value(_("request_seq")).toInt();
if (success) {
d->requestBacktrace = true;
updateEvaluationResult(seq, resp.value(_(BODY)), resp.value(_(REFS)));
updateEvaluationResult(seq, success, resp.value(_(BODY)), resp.value(_(REFS)));
} else {
d->engine->showMessage(resp.value(_("message")).toString(), ScriptConsoleOutput);
updateEvaluationResult(seq, QVariant(), QVariant());
QVariantMap map;
map.insert(_(TYPE), QVariant(_("string")));
map.insert(_(VALUE), resp.value(_("message")));
updateEvaluationResult(seq, success, QVariant(map), QVariant());
}
} else if (debugCommand == _(LISTBREAKPOINTS)) {
......@@ -1522,7 +1524,7 @@ void QmlV8DebuggerClient::updateScope(const QVariant &bodyVal, const QVariant &r
}
}
void QmlV8DebuggerClient::updateEvaluationResult(int sequence, const QVariant &bodyVal,
void QmlV8DebuggerClient::updateEvaluationResult(int sequence, bool success, const QVariant &bodyVal,
const QVariant &refsVal)
{
// { "seq" : <number>,
......@@ -1556,8 +1558,13 @@ void QmlV8DebuggerClient::updateEvaluationResult(int sequence, const QVariant &b
data.name = exp;
data.iname = iname;
data.id = bodyMap.value(_(HANDLE)).toInt();
data.type = body.type;
data.value = body.value.toString();
if (success) {
data.type = body.type;
data.value = body.value.toString();
} else {
//Do not set type since it is unkown
data.setError(body.value.toString());
}
//TODO:: Fix expanding watched objects/expressions
// const QVariantList properties = body.properties.toList();
......
......@@ -113,7 +113,7 @@ private:
void updateLocals(const QVariant &localsVal, const QVariant &refsVal);
void updateScope(const QVariant &localsVal, const QVariant &refsVal);
void updateEvaluationResult(int sequence, const QVariant &bodyVal,
void updateEvaluationResult(int sequence, bool success, const QVariant &bodyVal,
const QVariant &refsVal);
void updateBreakpoints(const QVariant &bodyVal);
......
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