forked from qt-creator/qt-creator
QmlV8DebuggerClient: Refactored code
Change List: a) Refactored code: Shifted JSON message creation to QmlV8DebuggerClientPrivate. b) QScriptEngine is used for JSON instead of JsonValue and JsonInputStream. c) Locals Window displays all variables accessible in the current context. Change-Id: I82e73f6c57482408f5fc501c908aa96297d3d754 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
INCLUDEPATH *= $$PWD/../../shared/symbianutils
|
||||
INCLUDEPATH *= $$PWD/../../shared/symbianutils $$PWD/../../shared/json
|
||||
LIBS *= -l$$qtLibraryName(symbianutils)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
TEMPLATE = lib
|
||||
CONFIG+=dll
|
||||
TARGET = symbianutils
|
||||
DEFINES += SYMBIANUTILS_BUILD_LIB
|
||||
DEFINES += SYMBIANUTILS_BUILD_LIB JSON_BUILD_LIB
|
||||
include(../../qtcreatorlibrary.pri)
|
||||
include(../../shared/symbianutils/symbianutils.pri)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
include($$PWD/../../../libs/qmljsdebugclient/qmljsdebugclient.pri)
|
||||
include($$PWD/../../../shared/json/json.pri)
|
||||
DEFINES += JSON_INCLUDE_PRI
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/qmlengine.h \
|
||||
@@ -11,7 +9,8 @@ HEADERS += \
|
||||
$$PWD/qmljsscriptconsole.h \
|
||||
$$PWD/qscriptdebuggerclient.h \
|
||||
$$PWD/qmlv8debuggerclient.h \
|
||||
$$PWD/interactiveinterpreter.h
|
||||
$$PWD/interactiveinterpreter.h \
|
||||
$$PWD/qmlv8debuggerclientconstants.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/qmlengine.cpp \
|
||||
|
||||
@@ -69,12 +69,12 @@ public:
|
||||
virtual void insertBreakpoint(const BreakpointModelId &id) = 0;
|
||||
virtual void removeBreakpoint(const BreakpointModelId &id) = 0;
|
||||
virtual void changeBreakpoint(const BreakpointModelId &id) = 0;
|
||||
virtual void updateBreakpoints() = 0;
|
||||
virtual void synchronizeBreakpoints() = 0;
|
||||
|
||||
virtual void assignValueInDebugger(const QByteArray expr, const quint64 &id,
|
||||
const QString &property, const QString &value) = 0;
|
||||
|
||||
virtual void updateWatchData(const WatchData *data) = 0;
|
||||
virtual void updateWatchData(const WatchData &data) = 0;
|
||||
virtual void executeDebuggerCommand(const QString &command) = 0;
|
||||
|
||||
virtual void synchronizeWatchers(const QStringList &watchers) = 0;
|
||||
|
||||
@@ -629,10 +629,10 @@ void QmlEngine::attemptBreakpointSynchronization()
|
||||
DebuggerEngine::attemptBreakpointSynchronization();
|
||||
|
||||
if (d->m_adapter.activeDebuggerClient()) {
|
||||
d->m_adapter.activeDebuggerClient()->updateBreakpoints();
|
||||
d->m_adapter.activeDebuggerClient()->synchronizeBreakpoints();
|
||||
} else {
|
||||
foreach (QmlDebuggerClient *client, d->m_adapter.debuggerClients()) {
|
||||
client->updateBreakpoints();
|
||||
client->synchronizeBreakpoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -715,7 +715,7 @@ void QmlEngine::updateWatchData(const WatchData &data,
|
||||
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()
|
||||
&& watchHandler()->isExpandedIName(data.iname)) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,8 +36,6 @@
|
||||
#include "qmldebuggerclient.h"
|
||||
#include "stackframe.h"
|
||||
#include "watchdata.h"
|
||||
#include "qmlengine.h"
|
||||
#include "json.h"
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
@@ -84,12 +82,12 @@ public:
|
||||
void insertBreakpoint(const BreakpointModelId &id);
|
||||
void removeBreakpoint(const BreakpointModelId &id);
|
||||
void changeBreakpoint(const BreakpointModelId &id);
|
||||
void updateBreakpoints();
|
||||
void synchronizeBreakpoints();
|
||||
|
||||
void assignValueInDebugger(const QByteArray expr, const quint64 &id,
|
||||
const QString &property, const QString &value);
|
||||
|
||||
void updateWatchData(const WatchData *data);
|
||||
void updateWatchData(const WatchData &data);
|
||||
void executeDebuggerCommand(const QString &command);
|
||||
|
||||
void synchronizeWatchers(const QStringList &watchers);
|
||||
@@ -98,30 +96,27 @@ public:
|
||||
|
||||
void setEngine(QmlEngine *engine);
|
||||
|
||||
signals:
|
||||
void notifyDebuggerStopped();
|
||||
|
||||
protected:
|
||||
void messageReceived(const QByteArray &data);
|
||||
|
||||
private:
|
||||
void listBreakpoints();
|
||||
void backtrace();
|
||||
void setStackFrames(const QByteArray &message);
|
||||
void setLocals(int frameIndex);
|
||||
void setExpression(const QByteArray &message);
|
||||
void updateBreakpoints(const QByteArray &message);
|
||||
void expandLocal(const QByteArray &message);
|
||||
void setPropertyValue(const Json::JsonValue &refs, const Json::JsonValue &property, const QByteArray &prepend);
|
||||
int indexInRef(const Json::JsonValue &refs, int refIndex);
|
||||
QByteArray packMessage(const QByteArray &message);
|
||||
void updateStack(const QVariant &bodyVal, const QVariant &refsVal);
|
||||
StackFrame createStackFrame(const QVariant &bodyVal, const QVariant &refsVal);
|
||||
void updateLocals(const QVariant &localsVal, const QVariant &refsVal);
|
||||
|
||||
void breakOnException(Exceptions exceptionsType, bool enabled);
|
||||
void storeExceptionInformation(const QByteArray &message);
|
||||
void handleException();
|
||||
void updateEvaluationResult(int sequence, const QVariant &bodyVal,
|
||||
const QVariant &refsVal);
|
||||
void updateBreakpoints(const QVariant &bodyVal);
|
||||
|
||||
QVariant valueFromRef(int handle, const QVariant &refsVal);
|
||||
|
||||
void expandLocal(const QVariant &bodyVal, const QVariant &refsVal);
|
||||
|
||||
void highlightExceptionCode(int lineNumber, const QString &filePath,
|
||||
const QString &errorMessage);
|
||||
void clearExceptionSelection();
|
||||
|
||||
void continueDebugging(StepAction type);
|
||||
void reset();
|
||||
|
||||
private:
|
||||
QmlV8DebuggerClientPrivate *d;
|
||||
|
||||
121
src/plugins/debugger/qml/qmlv8debuggerclientconstants.h
Normal file
121
src/plugins/debugger/qml/qmlv8debuggerclientconstants.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QMLV8DEBUGGERCLIENTCONSTANTS_H
|
||||
#define QMLV8DEBUGGERCLIENTCONSTANTS_H
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
const char V8DEBUG[] = "V8DEBUG";
|
||||
const char SEQ[] = "seq";
|
||||
const char TYPE[] = "type";
|
||||
const char COMMAND[] = "command";
|
||||
const char ARGUMENTS[] = "arguments";
|
||||
const char STEPACTION[] = "stepaction";
|
||||
const char STEPCOUNT[] = "stepcount";
|
||||
const char EXPRESSION[] = "expression";
|
||||
const char FRAME[] = "frame";
|
||||
const char GLOBAL[] = "global";
|
||||
const char DISABLE_BREAK[] = "disable_break";
|
||||
const char ADDITIONAL_CONTEXT[] = "additional_context";
|
||||
const char HANDLES[] = "handles";
|
||||
const char INCLUDESOURCE[] = "includeSource";
|
||||
const char FROMFRAME[] = "fromFrame";
|
||||
const char TOFRAME[] = "toFrame";
|
||||
const char BOTTOM[] = "bottom";
|
||||
const char NUMBER[] = "number";
|
||||
const char FRAMENUMBER[] = "frameNumber";
|
||||
const char TYPES[] = "types";
|
||||
const char IDS[] = "ids";
|
||||
const char FILTER[] = "filter";
|
||||
const char FROMLINE[] = "fromLine";
|
||||
const char TOLINE[] = "toLine";
|
||||
const char TARGET[] = "target";
|
||||
const char LINE[] = "line";
|
||||
const char COLUMN[] = "column";
|
||||
const char ENABLED[] = "enabled";
|
||||
const char CONDITION[] = "condition";
|
||||
const char IGNORECOUNT[] = "ignoreCount";
|
||||
const char BREAKPOINT[] = "breakpoint";
|
||||
const char FLAGS[] = "flags";
|
||||
|
||||
const char CONTINEDEBUGGING[] = "continue";
|
||||
const char EVALUATE[] = "evaluate";
|
||||
const char LOOKUP[] = "lookup";
|
||||
const char BACKTRACE[] = "backtrace";
|
||||
const char SCOPE[] = "scope";
|
||||
const char SCOPES[] = "scopes";
|
||||
const char SCRIPTS[] = "scripts";
|
||||
const char SOURCE[] = "source";
|
||||
const char SETBREAKPOINT[] = "setbreakpoint";
|
||||
const char CHANGEBREAKPOINT[] = "changebreakpoint";
|
||||
const char CLEARBREAKPOINT[] = "clearbreakpoint";
|
||||
const char SETEXCEPTIONBREAK[] = "setexceptionbreak";
|
||||
const char V8FLAGS[] = "v8flags";
|
||||
const char VERSION[] = "version";
|
||||
const char DISCONNECT[] = "disconnect";
|
||||
const char LISTBREAKPOINTS[] = "listbreakpoints";
|
||||
const char GARBAGECOLLECTOR[] = "gc";
|
||||
//const char PROFILE[] = "profile";
|
||||
|
||||
const char CONNECT[] = "connect";
|
||||
const char INTERRUPT[] = "interrupt";
|
||||
|
||||
const char REQUEST[] = "request";
|
||||
const char IN[] = "in";
|
||||
const char NEXT[] = "next";
|
||||
const char OUT[] = "out";
|
||||
|
||||
const char FUNCTION[] = "function";
|
||||
const char SCRIPT[] = "script";
|
||||
const char EVENT[] = "event";
|
||||
|
||||
const char ALL[] = "all";
|
||||
const char UNCAUGHT[] = "uncaught";
|
||||
|
||||
//const char PAUSE[] = "pause";
|
||||
//const char RESUME[] = "resume";
|
||||
|
||||
const char HANDLE[] = "handle";
|
||||
const char REF[] = "ref";
|
||||
const char REFS[] = "refs";
|
||||
const char BODY[] = "body";
|
||||
const char NAME[] = "name";
|
||||
const char VALUE[] = "value";
|
||||
|
||||
const char OBJECT[] = "{}";
|
||||
const char ARRAY[] = "[]";
|
||||
|
||||
} //Internal
|
||||
} //Debugger
|
||||
#endif // QMLV8DEBUGGERCLIENTCONSTANTS_H
|
||||
@@ -240,7 +240,7 @@ void QScriptDebuggerClient::changeBreakpoint(const BreakpointModelId &/*id*/)
|
||||
{
|
||||
}
|
||||
|
||||
void QScriptDebuggerClient::updateBreakpoints()
|
||||
void QScriptDebuggerClient::synchronizeBreakpoints()
|
||||
{
|
||||
QByteArray reply;
|
||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||
@@ -261,13 +261,13 @@ void QScriptDebuggerClient::assignValueInDebugger(const QByteArray expr, const q
|
||||
sendMessage(reply);
|
||||
}
|
||||
|
||||
void QScriptDebuggerClient::updateWatchData(const WatchData *data)
|
||||
void QScriptDebuggerClient::updateWatchData(const WatchData &data)
|
||||
{
|
||||
QByteArray reply;
|
||||
QDataStream rs(&reply, QIODevice::WriteOnly);
|
||||
QByteArray cmd = "EXEC";
|
||||
rs << cmd;
|
||||
rs << data->iname << data->name;
|
||||
rs << data.iname << data.name;
|
||||
sendMessage(reply);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,12 +67,12 @@ public:
|
||||
void insertBreakpoint(const BreakpointModelId &id);
|
||||
void removeBreakpoint(const BreakpointModelId &id);
|
||||
void changeBreakpoint(const BreakpointModelId &id);
|
||||
void updateBreakpoints();
|
||||
void synchronizeBreakpoints();
|
||||
|
||||
void assignValueInDebugger(const QByteArray expr, const quint64 &id,
|
||||
const QString &property, const QString &value);
|
||||
|
||||
void updateWatchData(const WatchData *data);
|
||||
void updateWatchData(const WatchData &data);
|
||||
void executeDebuggerCommand(const QString &command);
|
||||
|
||||
void synchronizeWatchers(const QStringList &watchers);
|
||||
@@ -81,9 +81,6 @@ public:
|
||||
|
||||
void setEngine(QmlEngine *engine);
|
||||
|
||||
signals:
|
||||
void notifyDebuggerStopped();
|
||||
|
||||
protected:
|
||||
void messageReceived(const QByteArray &data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user