Commit 83196c26 authored by Aurindam Jana's avatar Aurindam Jana
Browse files

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: default avatarKai Koehne <kai.koehne@nokia.com>
parent 71cad949
......@@ -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.
......
Supports Markdown
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