forked from qt-creator/qt-creator
QmlDebugger: Make sure v8 messages show up in the debugger log
Change-Id: Icd65cde2bcb09eaa35cf67399e60e9d9f4484105 Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
@@ -420,7 +420,6 @@ void QmlEngine::continueInferior()
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
QTC_ASSERT(state() == InferiorStopOk, qDebug() << state());
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (d->m_adapter.activeDebuggerClient()) {
|
||||||
logMessage(LogSend, "CONTINUE");
|
|
||||||
d->m_adapter.activeDebuggerClient()->continueInferior();
|
d->m_adapter.activeDebuggerClient()->continueInferior();
|
||||||
}
|
}
|
||||||
resetLocation();
|
resetLocation();
|
||||||
@@ -431,7 +430,6 @@ void QmlEngine::continueInferior()
|
|||||||
void QmlEngine::interruptInferior()
|
void QmlEngine::interruptInferior()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (d->m_adapter.activeDebuggerClient()) {
|
||||||
logMessage(LogSend, "INTERRUPT");
|
|
||||||
d->m_adapter.activeDebuggerClient()->interruptInferior();
|
d->m_adapter.activeDebuggerClient()->interruptInferior();
|
||||||
}
|
}
|
||||||
notifyInferiorStopOk();
|
notifyInferiorStopOk();
|
||||||
@@ -440,7 +438,6 @@ void QmlEngine::interruptInferior()
|
|||||||
void QmlEngine::executeStep()
|
void QmlEngine::executeStep()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (d->m_adapter.activeDebuggerClient()) {
|
||||||
logMessage(LogSend, "STEPINTO");
|
|
||||||
d->m_adapter.activeDebuggerClient()->executeStep();
|
d->m_adapter.activeDebuggerClient()->executeStep();
|
||||||
}
|
}
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
@@ -450,7 +447,6 @@ void QmlEngine::executeStep()
|
|||||||
void QmlEngine::executeStepI()
|
void QmlEngine::executeStepI()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (d->m_adapter.activeDebuggerClient()) {
|
||||||
logMessage(LogSend, "STEPINTO");
|
|
||||||
d->m_adapter.activeDebuggerClient()->executeStepI();
|
d->m_adapter.activeDebuggerClient()->executeStepI();
|
||||||
}
|
}
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
@@ -460,7 +456,6 @@ void QmlEngine::executeStepI()
|
|||||||
void QmlEngine::executeStepOut()
|
void QmlEngine::executeStepOut()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (d->m_adapter.activeDebuggerClient()) {
|
||||||
logMessage(LogSend, "STEPOUT");
|
|
||||||
d->m_adapter.activeDebuggerClient()->executeStepOut();
|
d->m_adapter.activeDebuggerClient()->executeStepOut();
|
||||||
}
|
}
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
@@ -470,7 +465,6 @@ void QmlEngine::executeStepOut()
|
|||||||
void QmlEngine::executeNext()
|
void QmlEngine::executeNext()
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (d->m_adapter.activeDebuggerClient()) {
|
||||||
logMessage(LogSend, "STEPOVER");
|
|
||||||
d->m_adapter.activeDebuggerClient()->executeNext();
|
d->m_adapter.activeDebuggerClient()->executeNext();
|
||||||
}
|
}
|
||||||
notifyInferiorRunRequested();
|
notifyInferiorRunRequested();
|
||||||
@@ -506,7 +500,6 @@ void QmlEngine::activateFrame(int index)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (d->m_adapter.activeDebuggerClient()) {
|
||||||
logMessage(LogSend, QString("%1 %2").arg(QString("ACTIVATE_FRAME"), QString::number(index)));
|
|
||||||
d->m_adapter.activeDebuggerClient()->activateFrame(index);
|
d->m_adapter.activeDebuggerClient()->activateFrame(index);
|
||||||
}
|
}
|
||||||
gotoLocation(stackHandler()->frames().value(index));
|
gotoLocation(stackHandler()->frames().value(index));
|
||||||
@@ -684,9 +677,6 @@ void QmlEngine::assignValueInDebugger(const WatchData *data,
|
|||||||
{
|
{
|
||||||
quint64 objectId = data->id;
|
quint64 objectId = data->id;
|
||||||
if (objectId > 0 && !expression.isEmpty() && d->m_adapter.activeDebuggerClient()) {
|
if (objectId > 0 && !expression.isEmpty() && d->m_adapter.activeDebuggerClient()) {
|
||||||
logMessage(LogSend, QString("%1 %2 %3 %4 %5").arg(
|
|
||||||
QString("SET_PROPERTY"), QString::number(objectId), QString(expression),
|
|
||||||
valueV.toString()));
|
|
||||||
d->m_adapter.activeDebuggerClient()->assignValueInDebugger(expression.toUtf8(), objectId, expression, valueV.toString());
|
d->m_adapter.activeDebuggerClient()->assignValueInDebugger(expression.toUtf8(), objectId, expression, valueV.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -700,8 +690,6 @@ void QmlEngine::updateWatchData(const WatchData &data,
|
|||||||
|
|
||||||
if (!data.name.isEmpty() && d->m_adapter.activeDebuggerClient()) {
|
if (!data.name.isEmpty() && d->m_adapter.activeDebuggerClient()) {
|
||||||
if (data.isValueNeeded()) {
|
if (data.isValueNeeded()) {
|
||||||
logMessage(LogSend, QString("%1 %2 %3").arg(QString("EXEC"), QString(data.iname),
|
|
||||||
QString(data.name)));
|
|
||||||
d->m_adapter.activeDebuggerClient()->updateWatchData(data);
|
d->m_adapter.activeDebuggerClient()->updateWatchData(data);
|
||||||
}
|
}
|
||||||
if (data.isChildrenNeeded()
|
if (data.isChildrenNeeded()
|
||||||
@@ -720,8 +708,6 @@ void QmlEngine::synchronizeWatchers()
|
|||||||
{
|
{
|
||||||
QStringList watchedExpressions = watchHandler()->watchedExpressions();
|
QStringList watchedExpressions = watchHandler()->watchedExpressions();
|
||||||
// send watchers list
|
// send watchers list
|
||||||
logMessage(LogSend, QString("%1 %2").arg(
|
|
||||||
QString("WATCH_EXPRESSIONS"), watchedExpressions.join(", ")));
|
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (d->m_adapter.activeDebuggerClient()) {
|
||||||
d->m_adapter.activeDebuggerClient()->synchronizeWatchers(watchedExpressions);
|
d->m_adapter.activeDebuggerClient()->synchronizeWatchers(watchedExpressions);
|
||||||
} else {
|
} else {
|
||||||
@@ -778,8 +764,6 @@ void QmlEngine::wrongSetupMessageBoxFinished(int result)
|
|||||||
void QmlEngine::executeDebuggerCommand(const QString& command)
|
void QmlEngine::executeDebuggerCommand(const QString& command)
|
||||||
{
|
{
|
||||||
if (d->m_adapter.activeDebuggerClient()) {
|
if (d->m_adapter.activeDebuggerClient()) {
|
||||||
logMessage(LogSend, QString("%1 %2 %3").arg(QString("EXEC"), QString("console"),
|
|
||||||
QString(command)));
|
|
||||||
d->m_adapter.activeDebuggerClient()->executeDebuggerCommand(command);
|
d->m_adapter.activeDebuggerClient()->executeDebuggerCommand(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -790,13 +774,13 @@ QString QmlEngine::qmlImportPath() const
|
|||||||
return startParameters().environment.value("QML_IMPORT_PATH");
|
return startParameters().environment.value("QML_IMPORT_PATH");
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::logMessage(LogDirection direction, const QString &message)
|
void QmlEngine::logMessage(const QString &service, LogDirection direction, const QString &message)
|
||||||
{
|
{
|
||||||
QString msg = "QmlDebugger";
|
QString msg = service;
|
||||||
if (direction == LogSend) {
|
if (direction == LogSend) {
|
||||||
msg += " sending ";
|
msg += ": sending ";
|
||||||
} else {
|
} else {
|
||||||
msg += " receiving ";
|
msg += ": receiving ";
|
||||||
}
|
}
|
||||||
msg += message;
|
msg += message;
|
||||||
showMessage(msg, LogDebug);
|
showMessage(msg, LogDebug);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
QString toFileInProject(const QUrl &fileUrl);
|
QString toFileInProject(const QUrl &fileUrl);
|
||||||
void inferiorSpontaneousStop();
|
void inferiorSpontaneousStop();
|
||||||
|
|
||||||
void logMessage(LogDirection direction, const QString &str);
|
void logMessage(const QString &service, LogDirection direction, const QString &str);
|
||||||
|
|
||||||
QmlAdapter *adapter() const;
|
QmlAdapter *adapter() const;
|
||||||
|
|
||||||
|
|||||||
@@ -122,10 +122,14 @@ public:
|
|||||||
QmlV8ObjectData extractData(const QVariant &data);
|
QmlV8ObjectData extractData(const QVariant &data);
|
||||||
void clearCache();
|
void clearCache();
|
||||||
|
|
||||||
|
void logSendMessage(const QString &msg) const;
|
||||||
|
void logReceiveMessage(const QString &msg) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QByteArray packMessage(const QByteArray &message);
|
QByteArray packMessage(const QByteArray &message);
|
||||||
QScriptValue initObject();
|
QScriptValue initObject();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmlV8DebuggerClient *q;
|
QmlV8DebuggerClient *q;
|
||||||
|
|
||||||
@@ -175,6 +179,7 @@ void QmlV8DebuggerClientPrivate::connect()
|
|||||||
jsonVal.setProperty(_(COMMAND), QScriptValue(_(CONNECT)));
|
jsonVal.setProperty(_(COMMAND), QScriptValue(_(CONNECT)));
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,6 +193,7 @@ void QmlV8DebuggerClientPrivate::disconnect()
|
|||||||
jsonVal.setProperty(_(COMMAND), QScriptValue(_(DISCONNECT)));
|
jsonVal.setProperty(_(COMMAND), QScriptValue(_(DISCONNECT)));
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,6 +207,7 @@ void QmlV8DebuggerClientPrivate::interrupt()
|
|||||||
jsonVal.setProperty(_(COMMAND), QScriptValue(_(INTERRUPT)));
|
jsonVal.setProperty(_(COMMAND), QScriptValue(_(INTERRUPT)));
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,6 +248,7 @@ void QmlV8DebuggerClientPrivate::continueDebugging(QmlV8DebuggerClient::StepActi
|
|||||||
|
|
||||||
}
|
}
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,6 +306,7 @@ void QmlV8DebuggerClientPrivate::evaluate(const QString expr, bool global,
|
|||||||
jsonVal.setProperty(_(ARGUMENTS), args);
|
jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,6 +339,7 @@ void QmlV8DebuggerClientPrivate::lookup(QList<int> handles, bool includeSource)
|
|||||||
jsonVal.setProperty(_(ARGUMENTS), args);
|
jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,6 +371,7 @@ void QmlV8DebuggerClientPrivate::backtrace(int fromFrame, int toFrame, bool bott
|
|||||||
jsonVal.setProperty(_(ARGUMENTS), args);
|
jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,6 +394,7 @@ void QmlV8DebuggerClientPrivate::frame(int number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,6 +422,7 @@ void QmlV8DebuggerClientPrivate::scope(int number, int frameNumber)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,6 +446,7 @@ void QmlV8DebuggerClientPrivate::scopes(int frameNumber)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,6 +489,7 @@ void QmlV8DebuggerClientPrivate::scripts(int types, const QList<int> ids, bool i
|
|||||||
jsonVal.setProperty(_(ARGUMENTS), args);
|
jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,6 +521,7 @@ void QmlV8DebuggerClientPrivate::source(int frame, int fromLine, int toLine)
|
|||||||
jsonVal.setProperty(_(ARGUMENTS), args);
|
jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,6 +566,7 @@ void QmlV8DebuggerClientPrivate::setBreakpoint(const QString type, const QString
|
|||||||
jsonVal.setProperty(_(ARGUMENTS), args);
|
jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,6 +601,7 @@ void QmlV8DebuggerClientPrivate::changeBreakpoint(int breakpoint, bool enabled,
|
|||||||
jsonVal.setProperty(_(ARGUMENTS), args);
|
jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,6 +624,7 @@ void QmlV8DebuggerClientPrivate::clearBreakpoint(int breakpoint)
|
|||||||
jsonVal.setProperty(_(ARGUMENTS), args);
|
jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,6 +657,7 @@ void QmlV8DebuggerClientPrivate::setExceptionBreak(QmlV8DebuggerClient::Exceptio
|
|||||||
|
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,6 +672,7 @@ void QmlV8DebuggerClientPrivate::listBreakpoints()
|
|||||||
QScriptValue(_(LISTBREAKPOINTS)));
|
QScriptValue(_(LISTBREAKPOINTS)));
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,6 +695,7 @@ void QmlV8DebuggerClientPrivate::v8flags(const QString flags)
|
|||||||
jsonVal.setProperty(_(ARGUMENTS), args);
|
jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -687,6 +709,7 @@ void QmlV8DebuggerClientPrivate::version()
|
|||||||
jsonVal.setProperty(_(COMMAND), QScriptValue(_(VERSION)));
|
jsonVal.setProperty(_(COMMAND), QScriptValue(_(VERSION)));
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,6 +734,7 @@ void QmlV8DebuggerClientPrivate::version()
|
|||||||
// jsonVal.setProperty(_(ARGUMENTS), args);
|
// jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
// const QScriptValue jsonMessage = m_stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
// const QScriptValue jsonMessage = m_stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
// logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
// q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
// q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
//}
|
//}
|
||||||
|
|
||||||
@@ -733,6 +757,7 @@ void QmlV8DebuggerClientPrivate::gc()
|
|||||||
jsonVal.setProperty(_(ARGUMENTS), args);
|
jsonVal.setProperty(_(ARGUMENTS), args);
|
||||||
|
|
||||||
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
const QScriptValue jsonMessage = stringifier.call(QScriptValue(), QScriptValueList() << jsonVal);
|
||||||
|
logSendMessage(QString(_("%1 %2")).arg(_(V8DEBUG), jsonMessage.toString()));
|
||||||
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
q->sendMessage(packMessage(jsonMessage.toString().toUtf8()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,6 +885,18 @@ QScriptValue QmlV8DebuggerClientPrivate::initObject()
|
|||||||
return jsonVal;
|
return jsonVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlV8DebuggerClientPrivate::logSendMessage(const QString &msg) const
|
||||||
|
{
|
||||||
|
if (engine)
|
||||||
|
engine->logMessage("V8DebuggerClient", QmlEngine::LogSend, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlV8DebuggerClientPrivate::logReceiveMessage(const QString &msg) const
|
||||||
|
{
|
||||||
|
if (engine)
|
||||||
|
engine->logMessage("V8DebuggerClient", QmlEngine::LogReceive, msg);
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// QmlV8DebuggerClient
|
// QmlV8DebuggerClient
|
||||||
@@ -1078,6 +1115,7 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
QString responseString(response);
|
QString responseString(response);
|
||||||
|
|
||||||
SDEBUG(responseString);
|
SDEBUG(responseString);
|
||||||
|
d->logReceiveMessage(QString(_("%1 %2")).arg(_(V8DEBUG), responseString));
|
||||||
|
|
||||||
const QVariantMap resp = d->parser.call(QScriptValue(),
|
const QVariantMap resp = d->parser.call(QScriptValue(),
|
||||||
QScriptValueList() <<
|
QScriptValueList() <<
|
||||||
@@ -1090,9 +1128,6 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
bool success = resp.value(_("success")).toBool();
|
bool success = resp.value(_("success")).toBool();
|
||||||
if (!success) {
|
if (!success) {
|
||||||
SDEBUG("Request was unsuccessful");
|
SDEBUG("Request was unsuccessful");
|
||||||
d->engine->logMessage(QmlEngine::LogReceive,
|
|
||||||
QString(_("V8 Response Error: %1")).arg(
|
|
||||||
resp.value(_("message")).toString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString debugCommand(resp.value(_(COMMAND)).toString());
|
const QString debugCommand(resp.value(_(COMMAND)).toString());
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "qmlengine.h"
|
#include "qmlengine.h"
|
||||||
#include "stackhandler.h"
|
#include "stackhandler.h"
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
|
#include "debuggerstringutils.h"
|
||||||
|
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@@ -125,6 +126,9 @@ public:
|
|||||||
int ping;
|
int ping;
|
||||||
QmlEngine *engine;
|
QmlEngine *engine;
|
||||||
JSAgentBreakpoints breakpoints;
|
JSAgentBreakpoints breakpoints;
|
||||||
|
|
||||||
|
void logSendMessage(const QString &msg) const;
|
||||||
|
void logReceiveMessage(const QString &msg) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
QScriptDebuggerClient::QScriptDebuggerClient(QmlJsDebugClient::QDeclarativeDebugConnection* client)
|
QScriptDebuggerClient::QScriptDebuggerClient(QmlJsDebugClient::QDeclarativeDebugConnection* client)
|
||||||
@@ -144,6 +148,7 @@ void QScriptDebuggerClient::executeStep()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "STEPINTO";
|
QByteArray cmd = "STEPINTO";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
|
d->logSendMessage(cmd);
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,6 +158,7 @@ void QScriptDebuggerClient::executeStepOut()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "STEPOUT";
|
QByteArray cmd = "STEPOUT";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
|
d->logSendMessage(cmd);
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,6 +168,7 @@ void QScriptDebuggerClient::executeNext()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "STEPOVER";
|
QByteArray cmd = "STEPOVER";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
|
d->logSendMessage(cmd);
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,6 +178,7 @@ void QScriptDebuggerClient::executeStepI()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "STEPINTO";
|
QByteArray cmd = "STEPINTO";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
|
d->logSendMessage(cmd);
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,6 +188,7 @@ void QScriptDebuggerClient::continueInferior()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "CONTINUE";
|
QByteArray cmd = "CONTINUE";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
|
d->logSendMessage(cmd);
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,6 +198,7 @@ void QScriptDebuggerClient::interruptInferior()
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "INTERRUPT";
|
QByteArray cmd = "INTERRUPT";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
|
d->logSendMessage(cmd);
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,6 +223,7 @@ void QScriptDebuggerClient::activateFrame(int index)
|
|||||||
QByteArray cmd = "ACTIVATE_FRAME";
|
QByteArray cmd = "ACTIVATE_FRAME";
|
||||||
rs << cmd
|
rs << cmd
|
||||||
<< index;
|
<< index;
|
||||||
|
d->logSendMessage(QString(_("%1 %2")).arg(cmd, QString::number(index)));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,6 +267,15 @@ void QScriptDebuggerClient::synchronizeBreakpoints()
|
|||||||
QByteArray cmd = "BREAKPOINTS";
|
QByteArray cmd = "BREAKPOINTS";
|
||||||
rs << cmd
|
rs << cmd
|
||||||
<< d->breakpoints;
|
<< d->breakpoints;
|
||||||
|
|
||||||
|
QStringList logBreakpoints;
|
||||||
|
foreach (const JSAgentBreakpointData &bp, d->breakpoints) {
|
||||||
|
logBreakpoints << QString("[%1, %2, %3]").arg(bp.functionName,
|
||||||
|
bp.fileUrl,
|
||||||
|
QString::number(bp.lineNumber));
|
||||||
|
}
|
||||||
|
d->logSendMessage(QString(_("%1 (%2)")).arg(cmd, logBreakpoints.join(", ")));
|
||||||
|
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,6 +287,8 @@ void QScriptDebuggerClient::assignValueInDebugger(const QByteArray expr, const q
|
|||||||
QByteArray cmd = "SET_PROPERTY";
|
QByteArray cmd = "SET_PROPERTY";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
rs << expr << id << property << value;
|
rs << expr << id << property << value;
|
||||||
|
d->logSendMessage(QString(_("%1 %2 %3 %4 %5")).arg(cmd, expr, QString::number(id), property,
|
||||||
|
value));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,6 +299,7 @@ void QScriptDebuggerClient::updateWatchData(const WatchData &data)
|
|||||||
QByteArray cmd = "EXEC";
|
QByteArray cmd = "EXEC";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
rs << data.iname << data.name;
|
rs << data.iname << data.name;
|
||||||
|
d->logSendMessage(QString(_("%1 %2 %3")).arg(cmd, data.iname, data.name));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,6 +310,7 @@ void QScriptDebuggerClient::executeDebuggerCommand(const QString &command)
|
|||||||
QByteArray cmd = "EXEC";
|
QByteArray cmd = "EXEC";
|
||||||
QByteArray console = "console";
|
QByteArray console = "console";
|
||||||
rs << cmd << console << command;
|
rs << cmd << console << command;
|
||||||
|
d->logSendMessage(QString(_("%1 %2 %3")).arg(cmd, console, command));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,7 +321,7 @@ void QScriptDebuggerClient::synchronizeWatchers(const QStringList &watchers)
|
|||||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||||
QByteArray cmd = "WATCH_EXPRESSIONS";
|
QByteArray cmd = "WATCH_EXPRESSIONS";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
rs << watchers;
|
d->logSendMessage(QString(_("%1 (%2)")).arg(cmd, watchers.join(", ")));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,6 +332,7 @@ void QScriptDebuggerClient::expandObject(const QByteArray &iname, quint64 object
|
|||||||
QByteArray cmd = "EXPAND";
|
QByteArray cmd = "EXPAND";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
rs << iname << objectId;
|
rs << iname << objectId;
|
||||||
|
d->logSendMessage(QString(_("%1 %2 %3")).arg(cmd, iname, QString::number(objectId)));
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,6 +344,7 @@ void QScriptDebuggerClient::sendPing()
|
|||||||
QByteArray cmd = "PING";
|
QByteArray cmd = "PING";
|
||||||
rs << cmd;
|
rs << cmd;
|
||||||
rs << d->ping;
|
rs << d->ping;
|
||||||
|
d->logSendMessage(cmd);
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +424,7 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
|
|
||||||
logString += QLatin1Char(' ');
|
logString += QLatin1Char(' ');
|
||||||
logString += error;
|
logString += error;
|
||||||
d->engine->logMessage(QmlEngine::LogReceive, logString);
|
d->logReceiveMessage(logString);
|
||||||
|
|
||||||
QString msg = stackFrames.isEmpty()
|
QString msg = stackFrames.isEmpty()
|
||||||
? tr("<p>An uncaught exception occurred:</p><p>%1</p>")
|
? tr("<p>An uncaught exception occurred:</p><p>%1</p>")
|
||||||
@@ -436,7 +462,7 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d->engine->logMessage(QmlEngine::LogReceive, logString);
|
d->logReceiveMessage(logString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ideStackFrames.isEmpty())
|
if (!ideStackFrames.isEmpty())
|
||||||
@@ -447,8 +473,8 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
QByteArray iname;
|
QByteArray iname;
|
||||||
stream >> iname >> data;
|
stream >> iname >> data;
|
||||||
|
|
||||||
d->engine->logMessage(QmlEngine::LogReceive, QString("%1 %2 %3").arg(QString(command),
|
d->logReceiveMessage(QString("%1 %2 %3").arg(QString(command), QString(iname),
|
||||||
QString(iname), QString(data.value)));
|
QString(data.value)));
|
||||||
data.iname = iname;
|
data.iname = iname;
|
||||||
if (iname.startsWith("watch.")) {
|
if (iname.startsWith("watch.")) {
|
||||||
d->engine->watchHandler()->insertData(data);
|
d->engine->watchHandler()->insertData(data);
|
||||||
@@ -461,10 +487,11 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
QList<WatchData> result;
|
QList<WatchData> result;
|
||||||
QByteArray iname;
|
QByteArray iname;
|
||||||
stream >> iname >> result;
|
stream >> iname >> result;
|
||||||
|
d->logReceiveMessage(QString("%1 %2 (%3 x watchdata)").arg( QString(command),
|
||||||
d->engine->logMessage(QmlEngine::LogReceive, QString("%1 %2 (%3 x watchdata)").arg(
|
QString(iname),
|
||||||
QString(command), QString(iname), QString::number(result.size())));
|
QString::number(result.size())));
|
||||||
bool needPing = false;
|
bool needPing = false;
|
||||||
|
|
||||||
foreach (WatchData data, result) {
|
foreach (WatchData data, result) {
|
||||||
data.iname = iname + '.' + data.exp;
|
data.iname = iname + '.' + data.exp;
|
||||||
d->engine->watchHandler()->insertData(data);
|
d->engine->watchHandler()->insertData(data);
|
||||||
@@ -485,7 +512,7 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
stream >> watches;
|
stream >> watches;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->engine->logMessage(QmlEngine::LogReceive, QString("%1 %2 (%3 x locals) (%4 x watchdata)").arg(
|
d->logReceiveMessage(QString("%1 %2 (%3 x locals) (%4 x watchdata)").arg(
|
||||||
QString(command), QString::number(frameId),
|
QString(command), QString::number(frameId),
|
||||||
QString::number(locals.size()),
|
QString::number(locals.size()),
|
||||||
QString::number(watches.size())));
|
QString::number(watches.size())));
|
||||||
@@ -518,13 +545,13 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data)
|
|||||||
int ping;
|
int ping;
|
||||||
stream >> ping;
|
stream >> ping;
|
||||||
|
|
||||||
d->engine->logMessage(QmlEngine::LogReceive, QString("%1 %2").arg(QString(command), QString::number(ping)));
|
d->logReceiveMessage(QString("%1 %2").arg(QString(command), QString::number(ping)));
|
||||||
|
|
||||||
if (ping == d->ping)
|
if (ping == d->ping)
|
||||||
d->engine->watchHandler()->endCycle();
|
d->engine->watchHandler()->endCycle();
|
||||||
} else {
|
} else {
|
||||||
qDebug() << Q_FUNC_INFO << "Unknown command: " << command;
|
qDebug() << Q_FUNC_INFO << "Unknown command: " << command;
|
||||||
d->engine->logMessage(QmlEngine::LogReceive, QString("%1 UNKNOWN COMMAND!!").arg(QString(command)));
|
d->logReceiveMessage(QString("%1 UNKNOWN COMMAND!!").arg(QString(command)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -534,5 +561,17 @@ void QScriptDebuggerClient::setEngine(QmlEngine *engine)
|
|||||||
d->engine = engine;
|
d->engine = engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QScriptDebuggerClientPrivate::logSendMessage(const QString &msg) const
|
||||||
|
{
|
||||||
|
if (engine)
|
||||||
|
engine->logMessage("QScriptDebuggerClient", QmlEngine::LogSend, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QScriptDebuggerClientPrivate::logReceiveMessage(const QString &msg) const
|
||||||
|
{
|
||||||
|
if (engine)
|
||||||
|
engine->logMessage("QScriptDebuggerClient", QmlEngine::LogReceive, msg);
|
||||||
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // Debugger
|
} // Debugger
|
||||||
|
|||||||
Reference in New Issue
Block a user