summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@nokia.com>2011-12-29 13:43:59 +0100
committerAurindam Jana <aurindam.jana@nokia.com>2012-01-07 22:05:05 +0100
commit83196c26114bd641be2162e48522d7da23f2c14c (patch)
tree38ad3fe403a498a146ba304ba8a0171c945379e1 /src/plugins/debugger/qml/qmlv8debuggerclient.cpp
parent71cad949edcbf41f6165785783976511fb8d69a0 (diff)
downloadqt-creator-83196c26114bd641be2162e48522d7da23f2c14c.tar.gz
QmlDebugging: Handle interrupt
Handle the case where debug break is due to interrupt and not due to hitting a breakpoint. Change-Id: I080ef779558432f9285fb94aaed548ecf476fb91 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.cpp60
1 files changed, 37 insertions, 23 deletions
diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
index ed180fa97a..315061e88e 100644
--- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
+++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp
@@ -1388,14 +1388,11 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
const QString scriptUrl = breakData.value(_("script")).toMap().value(_("name")).toString();
const QString sourceLineText = breakData.value("sourceLineText").toString();
+ bool inferiorStop = true;
+
if (invocationText.startsWith(_("[anonymous]()"))
&& scriptUrl.endsWith(_(".qml"))
&& sourceLineText.trimmed().startsWith(QLatin1Char('('))) {
- // we hit most likely the anonymous wrapper function automatically generated for bindings
- // -> relocate the breakpoint to column: 1 and continue
-
- int newColumn = sourceLineText.indexOf(QLatin1Char('(')) + 1;
-
QList<int> v8BreakpointIds;
{
const QVariantList v8BreakpointIdList = breakData.value(_("breakpoints")).toList();
@@ -1403,34 +1400,47 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
v8BreakpointIds << breakpointId.toInt();
}
- BreakHandler *handler = d->engine->breakHandler();
+ if (!v8BreakpointIds.isEmpty()) {
+ // we hit most likely the anonymous wrapper function automatically generated for bindings
+ // -> relocate the breakpoint to column: 1 and continue
+
+ int newColumn = sourceLineText.indexOf(QLatin1Char('(')) + 1;
+ BreakHandler *handler = d->engine->breakHandler();
- foreach (int v8Id, v8BreakpointIds) {
- BreakpointModelId internalId;
- foreach (const BreakpointModelId &id, d->breakpoints.keys()) {
- if (d->breakpoints.value(id) == v8Id) {
- internalId = id;
- break;
+ foreach (int v8Id, v8BreakpointIds) {
+ BreakpointModelId internalId;
+ foreach (const BreakpointModelId &id, d->breakpoints.keys()) {
+ if (d->breakpoints.value(id) == v8Id) {
+ internalId = id;
+ break;
+ }
}
- }
- if (internalId.isValid()) {
- const BreakpointParameters &params = handler->breakpointData(internalId);
+ if (internalId.isValid()) {
+ const BreakpointParameters &params = handler->breakpointData(internalId);
- d->clearBreakpoint(v8Id);
- const QString type = d->isOldService ? QString(_(SCRIPT)) :QString(_(SCRIPTREGEXP));
- d->setBreakpoint(type, QFileInfo(params.fileName).fileName(),
- params.lineNumber - 1, newColumn, params.enabled,
- QString(params.condition), params.ignoreCount);
- d->breakpointsSync.insert(d->sequence, internalId);
+ d->clearBreakpoint(v8Id);
+ const QString type = d->isOldService ? QString(_(SCRIPT)) :QString(_(SCRIPTREGEXP));
+ d->setBreakpoint(type, QFileInfo(params.fileName).fileName(),
+ params.lineNumber - 1, newColumn, params.enabled,
+ QString(params.condition), params.ignoreCount);
+ d->breakpointsSync.insert(d->sequence, internalId);
+ }
}
+ d->continueDebugging(Continue);
+ inferiorStop = false;
}
- d->continueDebugging(Continue);
- } else if (d->engine->state() == InferiorRunOk) {
+ }
+
+ if (inferiorStop && d->engine->state() == InferiorRunOk) {
d->engine->inferiorSpontaneousStop();
d->backtrace();
}
+ if (inferiorStop && d->engine->state() == InferiorStopOk) {
+ d->backtrace();
+ }
+
} else if (eventType == _("exception")) {
const QVariantMap body = resp.value(_(BODY)).toMap();
int lineNumber = body.value(_("sourceLine")).toInt() + 1;
@@ -1449,6 +1459,10 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
d->backtrace();
}
+ if (d->engine->state() == InferiorStopOk) {
+ d->backtrace();
+ }
+
} else if (eventType == _("afterCompile")) {
//Currently break point relocation is disabled.
//Uncomment the line below when it will be enabled.