summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2011-09-13 12:47:46 +0200
committerAurindam Jana <aurindam.jana@nokia.com>2011-09-16 11:42:54 +0200
commitf05683ac7e20e00034871d601bbd78275d8b6e53 (patch)
tree18b91f1077d52e647a9f9f7c8ab1d22131b2e1be /src/plugins/debugger/qml/qmlv8debuggerclient.cpp
parent1285a638529c25d711d5b905388a4ea1c0d99d2f (diff)
downloadqt-creator-f05683ac7e20e00034871d601bbd78275d8b6e53.tar.gz
JSDebugger: Enable break on events.
The user can request Javascript break on event. The user can provide this info in the Breakpoints Window and provide the slot which will be called when the event occurs. For example: specify "onTriggered" if you need to break on Timer triggered event. Change-Id: If936d7402f5978a182132fdcca75515588364e16 Reviewed-on: http://codereview.qt-project.org/4758 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'src/plugins/debugger/qml/qmlv8debuggerclient.cpp')
-rw-r--r--src/plugins/debugger/qml/qmlv8debuggerclient.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
index 5f7b11f45e..24fd4e1523 100644
--- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
+++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
@@ -312,7 +312,13 @@ void QmlV8DebuggerClient::activateFrame(int index)
setLocals(index);
}
-void QmlV8DebuggerClient::insertBreakpoint(BreakpointModelId id)
+bool QmlV8DebuggerClient::acceptsBreakpoint(const BreakpointModelId &id)
+{
+ BreakpointType type = d->engine->breakHandler()->breakpointData(id).type;
+ return ((type == BreakpointOnSignalHandler) || (type == BreakpointByFunction));
+}
+
+void QmlV8DebuggerClient::insertBreakpoint(const BreakpointModelId &id)
{
BreakHandler *handler = d->engine->breakHandler();
QByteArray request;
@@ -327,6 +333,9 @@ void QmlV8DebuggerClient::insertBreakpoint(BreakpointModelId id)
} else if (handler->breakpointData(id).type == BreakpointByFunction) {
JsonInputStream(request) << "type" << ':' << "function";
JsonInputStream(request) << ',' << "target" << ':' << handler->functionName(id).toUtf8();
+ } else if (handler->breakpointData(id).type == BreakpointOnSignalHandler) {
+ JsonInputStream(request) << "type" << ':' << "event";
+ JsonInputStream(request) << ',' << "target" << ':' << handler->functionName(id).toUtf8();
}
JsonInputStream(request) << '}';
JsonInputStream(request) << '}';
@@ -335,7 +344,7 @@ void QmlV8DebuggerClient::insertBreakpoint(BreakpointModelId id)
sendMessage(packMessage(request));
}
-void QmlV8DebuggerClient::removeBreakpoint(BreakpointModelId id)
+void QmlV8DebuggerClient::removeBreakpoint(const BreakpointModelId &id)
{
int breakpoint = d->breakpoints.value(id);
d->breakpoints.remove(id);
@@ -354,7 +363,7 @@ void QmlV8DebuggerClient::removeBreakpoint(BreakpointModelId id)
sendMessage(packMessage(request));
}
-void QmlV8DebuggerClient::changeBreakpoint(BreakpointModelId /*id*/)
+void QmlV8DebuggerClient::changeBreakpoint(const BreakpointModelId &/*id*/)
{
}
@@ -363,7 +372,7 @@ void QmlV8DebuggerClient::updateBreakpoints()
}
void QmlV8DebuggerClient::assignValueInDebugger(const QByteArray /*expr*/, const quint64 &/*id*/,
- const QString &/*property*/, const QString /*value*/)
+ const QString &/*property*/, const QString &/*value*/)
{
//TODO::
}
@@ -468,7 +477,7 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
ds >> response;
JsonValue value(response);
- QString type = value.findChild("type").toVariant().toString();
+ const QString type = value.findChild("type").toVariant().toString();
if (type == "response") {
@@ -478,7 +487,7 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
return;
}
- QString debugCommand(value.findChild("command").toVariant().toString());
+ const QString debugCommand(value.findChild("command").toVariant().toString());
if (debugCommand == "backtrace") {
setStackFrames(response);
@@ -491,6 +500,12 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
BreakpointModelId id = d->breakpointsSync.take(sequence);
d->breakpoints.insert(id,breakpoint);
+ //If this is an event breakpoint then set state = BreakpointInsertOk
+ const QString breakpointType = value.findChild("body").findChild("type").toVariant().toString();
+ if (breakpointType == "event") {
+ d->engine->breakHandler()->notifyBreakpointInsertOk(id);
+ }
+
} else if (debugCommand == "evaluate") {
setExpression(response);
@@ -504,7 +519,7 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
}
} else if (type == "event") {
- QString event(value.findChild("event").toVariant().toString());
+ const QString event(value.findChild("event").toVariant().toString());
if (event == "break") {
d->engine->inferiorSpontaneousStop();