diff options
author | Aurindam Jana <[email protected]> | 2011-12-29 14:05:35 +0100 |
---|---|---|
committer | Aurindam Jana <[email protected]> | 2012-01-09 10:41:43 +0100 |
commit | bcd9bbb6f5ff93895148db7d0db606aaebaebd76 (patch) | |
tree | 5457cadc6c0e25e81544b718634dd991bcb761f9 /src/plugins | |
parent | 6ebdf75cd533933693183fd47d099012aa8c65ba (diff) |
QmlDebugging: Breakpoint data
Set the function name in the break parameters when the breakpoint
is hit.
Change-Id: I40d13f273808f7ea44a7fd8c41284ee7f476d286
Reviewed-by: Kai Koehne <[email protected]>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/debugger/qml/qmlv8debuggerclient.cpp | 87 |
1 files changed, 50 insertions, 37 deletions
diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp index 315061e88eb..b326a340b3e 100644 --- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp +++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp @@ -1390,55 +1390,68 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data) bool inferiorStop = true; - if (invocationText.startsWith(_("[anonymous]()")) - && scriptUrl.endsWith(_(".qml")) + QList<int> v8BreakpointIds; + { + const QVariantList v8BreakpointIdList = breakData.value(_("breakpoints")).toList(); + foreach (const QVariant &breakpointId, v8BreakpointIdList) + v8BreakpointIds << breakpointId.toInt(); + } + + if (!v8BreakpointIds.isEmpty() && invocationText.startsWith(_("[anonymous]()")) + && scriptUrl.endsWith(_(".qml")) && sourceLineText.trimmed().startsWith(QLatin1Char('('))) { - QList<int> v8BreakpointIds; - { - const QVariantList v8BreakpointIdList = breakData.value(_("breakpoints")).toList(); - foreach (const QVariant &breakpointId, v8BreakpointIdList) - v8BreakpointIds << breakpointId.toInt(); - } - if (!v8BreakpointIds.isEmpty()) { - // we hit most likely the anonymous wrapper function automatically generated for bindings - // -> relocate the breakpoint to column: 1 and continue + // 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(); + 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 ¶ms = handler->breakpointData(internalId); + if (internalId.isValid()) { + const BreakpointParameters ¶ms = 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); + inferiorStop = false; } - if (inferiorStop && d->engine->state() == InferiorRunOk) { - d->engine->inferiorSpontaneousStop(); - d->backtrace(); - } + if (inferiorStop) { + //Update breakpoint data + BreakHandler *handler = d->engine->breakHandler(); + foreach (int v8Id, v8BreakpointIds) { + foreach (const BreakpointModelId &id, d->breakpoints.keys()) { + if (d->breakpoints.value(id) == v8Id) { + BreakpointResponse br = handler->response(id); + if (br.functionName.isEmpty()) { + br.functionName = invocationText; + handler->setResponse(id, br); + } + } + } + } - if (inferiorStop && d->engine->state() == InferiorStopOk) { - d->backtrace(); + if (d->engine->state() == InferiorRunOk) { + d->engine->inferiorSpontaneousStop(); + d->backtrace(); + } else if (d->engine->state() == InferiorStopOk) { + d->backtrace(); + } } } else if (eventType == _("exception")) { |