forked from qt-creator/qt-creator
QmlDebugging: Implement RunToLine capability
Change-Id: I153c30310ac318d2de8b9a96c6d1e7f80439d306 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
#define QMLDEBUGGERCLIENT_H
|
#define QMLDEBUGGERCLIENT_H
|
||||||
|
|
||||||
#include "qmljsprivateapi.h"
|
#include "qmljsprivateapi.h"
|
||||||
|
#include "debuggerengine.h"
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -60,6 +61,8 @@ public:
|
|||||||
virtual void executeNext() = 0;
|
virtual void executeNext() = 0;
|
||||||
virtual void executeStepI() = 0;
|
virtual void executeStepI() = 0;
|
||||||
|
|
||||||
|
virtual void executeRunToLine(const ContextData &data) = 0;
|
||||||
|
|
||||||
virtual void continueInferior() = 0;
|
virtual void continueInferior() = 0;
|
||||||
virtual void interruptInferior() = 0;
|
virtual void interruptInferior() = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -530,8 +530,13 @@ void QmlEngine::executeNextI()
|
|||||||
|
|
||||||
void QmlEngine::executeRunToLine(const ContextData &data)
|
void QmlEngine::executeRunToLine(const ContextData &data)
|
||||||
{
|
{
|
||||||
Q_UNUSED(data)
|
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||||
SDEBUG("FIXME: QmlEngine::executeRunToLine()");
|
showStatusMessage(tr("Run to line %1 (%2) requested...").arg(data.lineNumber).arg(data.fileName), 5000);
|
||||||
|
resetLocation();
|
||||||
|
if (d->m_adapter.activeDebuggerClient())
|
||||||
|
d->m_adapter.activeDebuggerClient()->executeRunToLine(data);
|
||||||
|
notifyInferiorRunRequested();
|
||||||
|
notifyInferiorRunOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::executeRunToFunction(const QString &functionName)
|
void QmlEngine::executeRunToFunction(const QString &functionName)
|
||||||
@@ -777,7 +782,9 @@ void QmlEngine::synchronizeWatchers()
|
|||||||
|
|
||||||
unsigned QmlEngine::debuggerCapabilities() const
|
unsigned QmlEngine::debuggerCapabilities() const
|
||||||
{
|
{
|
||||||
return AddWatcherCapability|AddWatcherWhileRunningCapability;
|
return AddWatcherCapability
|
||||||
|
| AddWatcherWhileRunningCapability
|
||||||
|
| RunToLineCapability;
|
||||||
/*ReverseSteppingCapability | SnapshotCapability
|
/*ReverseSteppingCapability | SnapshotCapability
|
||||||
| AutoDerefPointersCapability | DisassemblerCapability
|
| AutoDerefPointersCapability | DisassemblerCapability
|
||||||
| RegisterCapability | ShowMemoryCapability
|
| RegisterCapability | ShowMemoryCapability
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ public:
|
|||||||
QmlEngine *engine;
|
QmlEngine *engine;
|
||||||
QHash<BreakpointModelId, int> breakpoints;
|
QHash<BreakpointModelId, int> breakpoints;
|
||||||
QHash<int, BreakpointModelId> breakpointsSync;
|
QHash<int, BreakpointModelId> breakpointsSync;
|
||||||
|
QList<int> breakpointsTemp;
|
||||||
|
|
||||||
QScriptValue parser;
|
QScriptValue parser;
|
||||||
QScriptValue stringifier;
|
QScriptValue stringifier;
|
||||||
@@ -1019,6 +1020,19 @@ void QmlV8DebuggerClient::executeStepI()
|
|||||||
d->continueDebugging(In);
|
d->continueDebugging(In);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlV8DebuggerClient::executeRunToLine(const ContextData &data)
|
||||||
|
{
|
||||||
|
if (d->isOldService) {
|
||||||
|
d->setBreakpoint(QString(_(SCRIPT)), QFileInfo(data.fileName).fileName(),
|
||||||
|
data.lineNumber - 1);
|
||||||
|
} else {
|
||||||
|
d->setBreakpoint(QString(_(SCRIPTREGEXP)), QFileInfo(data.fileName).fileName(),
|
||||||
|
data.lineNumber - 1);
|
||||||
|
}
|
||||||
|
clearExceptionSelection();
|
||||||
|
d->continueDebugging(Continue);
|
||||||
|
}
|
||||||
|
|
||||||
void QmlV8DebuggerClient::continueInferior()
|
void QmlV8DebuggerClient::continueInferior()
|
||||||
{
|
{
|
||||||
clearExceptionSelection();
|
clearExceptionSelection();
|
||||||
@@ -1282,11 +1296,16 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
const QVariantMap breakpointData = resp.value(_(BODY)).toMap();
|
const QVariantMap breakpointData = resp.value(_(BODY)).toMap();
|
||||||
int index = breakpointData.value(_("breakpoint")).toInt();
|
int index = breakpointData.value(_("breakpoint")).toInt();
|
||||||
|
|
||||||
BreakpointModelId id = d->breakpointsSync.take(seq);
|
if (d->breakpointsSync.contains(seq)) {
|
||||||
d->breakpoints.insert(id, index);
|
BreakpointModelId id = d->breakpointsSync.take(seq);
|
||||||
|
d->breakpoints.insert(id, index);
|
||||||
|
|
||||||
if (d->engine->breakHandler()->state(id) != BreakpointInserted)
|
if (d->engine->breakHandler()->state(id) != BreakpointInserted)
|
||||||
d->engine->breakHandler()->notifyBreakpointInsertOk(id);
|
d->engine->breakHandler()->notifyBreakpointInsertOk(id);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
d->breakpointsTemp.append(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else if (debugCommand == _(CHANGEBREAKPOINT)) {
|
} else if (debugCommand == _(CHANGEBREAKPOINT)) {
|
||||||
@@ -1447,6 +1466,10 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d->engine->state() == InferiorRunOk) {
|
if (d->engine->state() == InferiorRunOk) {
|
||||||
|
foreach (const QVariant &breakpointId, v8BreakpointIds) {
|
||||||
|
if (d->breakpointsTemp.contains(breakpointId.toInt()))
|
||||||
|
d->clearBreakpoint(breakpointId.toInt());
|
||||||
|
}
|
||||||
d->engine->inferiorSpontaneousStop();
|
d->engine->inferiorSpontaneousStop();
|
||||||
d->backtrace();
|
d->backtrace();
|
||||||
} else if (d->engine->state() == InferiorStopOk) {
|
} else if (d->engine->state() == InferiorStopOk) {
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ public:
|
|||||||
void executeNext();
|
void executeNext();
|
||||||
void executeStepI();
|
void executeStepI();
|
||||||
|
|
||||||
|
void executeRunToLine(const ContextData &data);
|
||||||
|
|
||||||
void continueInferior();
|
void continueInferior();
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
|
|
||||||
|
|||||||
@@ -183,6 +183,17 @@ void QScriptDebuggerClient::executeStepI()
|
|||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QScriptDebuggerClient::executeRunToLine(const ContextData &data)
|
||||||
|
{
|
||||||
|
JSAgentBreakpointData bp;
|
||||||
|
bp.fileUrl = QUrl::fromLocalFile(data.fileName).toString().toUtf8();
|
||||||
|
bp.lineNumber = data.lineNumber;
|
||||||
|
bp.functionName = "TEMPORARY";
|
||||||
|
d->breakpoints.insert(bp);
|
||||||
|
synchronizeBreakpoints();
|
||||||
|
continueInferior();
|
||||||
|
}
|
||||||
|
|
||||||
void QScriptDebuggerClient::continueInferior()
|
void QScriptDebuggerClient::continueInferior()
|
||||||
{
|
{
|
||||||
QByteArray reply;
|
QByteArray reply;
|
||||||
@@ -398,6 +409,7 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
|
|
||||||
if (ideStackFrames.size() && ideStackFrames.back().function == QLatin1String("<global>"))
|
if (ideStackFrames.size() && ideStackFrames.back().function == QLatin1String("<global>"))
|
||||||
ideStackFrames.takeLast();
|
ideStackFrames.takeLast();
|
||||||
|
|
||||||
d->engine->stackHandler()->setFrames(ideStackFrames);
|
d->engine->stackHandler()->setFrames(ideStackFrames);
|
||||||
|
|
||||||
d->engine->watchHandler()->beginCycle();
|
d->engine->watchHandler()->beginCycle();
|
||||||
@@ -478,6 +490,18 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<JSAgentBreakpointData> breakpoints(d->breakpoints.toList());
|
||||||
|
foreach (const JSAgentBreakpointData &data, breakpoints) {
|
||||||
|
if (data.fileUrl == QUrl::fromLocalFile(file).toString().toUtf8() &&
|
||||||
|
data.lineNumber == line &&
|
||||||
|
data.functionName == "TEMPORARY") {
|
||||||
|
breakpoints.removeOne(data);
|
||||||
|
d->breakpoints = JSAgentBreakpoints::fromList(breakpoints);
|
||||||
|
synchronizeBreakpoints();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
d->logReceiveMessage(logString);
|
d->logReceiveMessage(logString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ public:
|
|||||||
void executeNext();
|
void executeNext();
|
||||||
void executeStepI();
|
void executeStepI();
|
||||||
|
|
||||||
|
void executeRunToLine(const ContextData &data);
|
||||||
|
|
||||||
void continueInferior();
|
void continueInferior();
|
||||||
void interruptInferior();
|
void interruptInferior();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user