diff options
Diffstat (limited to 'src/plugins/qmltooling')
46 files changed, 267 insertions, 619 deletions
diff --git a/src/plugins/qmltooling/packetprotocol/packetprotocol.pro b/src/plugins/qmltooling/packetprotocol/packetprotocol.pro index 383e32b54e..990d3169ad 100644 --- a/src/plugins/qmltooling/packetprotocol/packetprotocol.pro +++ b/src/plugins/qmltooling/packetprotocol/packetprotocol.pro @@ -4,7 +4,8 @@ CONFIG += static internal_module HEADERS = \ qpacketprotocol_p.h \ - qpacket_p.h + qpacket_p.h \ + qqmldebugpacket_p.h SOURCES = \ qpacketprotocol.cpp \ diff --git a/src/plugins/qmltooling/shared/qqmldebugpacket.h b/src/plugins/qmltooling/packetprotocol/qqmldebugpacket_p.h index f1c21e0a2b..9a0f8cd82d 100644 --- a/src/plugins/qmltooling/shared/qqmldebugpacket.h +++ b/src/plugins/qmltooling/packetprotocol/qqmldebugpacket_p.h @@ -40,9 +40,10 @@ #ifndef QQMLDEBUGPACKET_P_H #define QQMLDEBUGPACKET_P_H +#include "qpacket_p.h" + #include <QtCore/qbuffer.h> #include <QtQml/private/qqmldebugconnector_p.h> -#include <QtPacketProtocol/private/qpacket_p.h> // // W A R N I N G diff --git a/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro b/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro index f3f8a21ff8..2d8f0ceda2 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro +++ b/src/plugins/qmltooling/qmldbg_debugger/qmldbg_debugger.pro @@ -12,8 +12,6 @@ SOURCES += \ $$PWD/qv4debugjob.cpp HEADERS += \ - $$PWD/../shared/qqmlconfigurabledebugservice.h \ - $$PWD/../shared/qqmldebugpacket.h \ $$PWD/qqmldebuggerservicefactory.h \ $$PWD/qqmlenginedebugservice.h \ $$PWD/qqmlwatcher.h \ @@ -23,9 +21,6 @@ HEADERS += \ $$PWD/qv4datacollector.h \ $$PWD/qv4debugjob.h -INCLUDEPATH += $$PWD \ - $$PWD/../shared - OTHER_FILES += \ $$PWD/qqmldebuggerservice.json diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index d2934ba034..9514204392 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -39,7 +39,6 @@ #include "qqmlenginedebugservice.h" #include "qqmlwatcher.h" -#include "qqmldebugpacket.h" #include <private/qqmldebugstatesdelegate_p.h> #include <private/qqmlboundsignal_p.h> @@ -57,6 +56,7 @@ #include <QtCore/qmetaobject.h> #include <QtCore/qfileinfo.h> #include <private/qmetaobject_p.h> +#include <private/qqmldebugpacket_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h index 2e40eb4de8..c0c24058eb 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h @@ -95,17 +95,17 @@ public: bool hasNotifySignal; }; - void engineAboutToBeAdded(QJSEngine *) Q_DECL_OVERRIDE; - void engineAboutToBeRemoved(QJSEngine *) Q_DECL_OVERRIDE; - void objectCreated(QJSEngine *, QObject *) Q_DECL_OVERRIDE; + void engineAboutToBeAdded(QJSEngine *) override; + void engineAboutToBeRemoved(QJSEngine *) override; + void objectCreated(QJSEngine *, QObject *) override; - void setStatesDelegate(QQmlDebugStatesDelegate *) Q_DECL_OVERRIDE; + void setStatesDelegate(QQmlDebugStatesDelegate *) override; signals: void scheduleMessage(const QByteArray &); protected: - virtual void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; + void messageReceived(const QByteArray &) override; private: friend class QQmlDebuggerServiceFactory; diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp index 4573fb9d9a..a538956e8e 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp @@ -55,47 +55,43 @@ QT_BEGIN_NAMESPACE -QV4::SimpleCallContext *QV4DataCollector::findContext(int frame) +QV4::CppStackFrame *QV4DataCollector::findFrame(int frame) { - QV4::ExecutionContext *ctx = engine()->currentContext; - while (ctx) { - QV4::SimpleCallContext *cCtxt = ctx->asSimpleCallContext(); - if (cCtxt && cCtxt->d()->v4Function) { - if (frame < 1) - return cCtxt; - --frame; - } - ctx = engine()->parentContext(ctx); + QV4::CppStackFrame *f = engine()->currentStackFrame; + while (f && frame) { + --frame; + f = f->parent; } + return f; +} - return 0; +QV4::Heap::ExecutionContext *QV4DataCollector::findContext(int frame) +{ + QV4::CppStackFrame *f = findFrame(frame); + + return f ? f->context()->d() : 0; } -QV4::Heap::SimpleCallContext *QV4DataCollector::findScope(QV4::ExecutionContext *ctxt, int scope) +QV4::Heap::CallContext *QV4DataCollector::findScope(QV4::Heap::ExecutionContext *ctx, int scope) { - if (!ctxt) + if (!ctx) return 0; - QV4::Scope s(ctxt); - QV4::ScopedContext ctx(s, ctxt); for (; scope > 0 && ctx; --scope) - ctx = ctx->d()->outer; + ctx = ctx->outer; - return (ctx && ctx->d()) ? ctx->asSimpleCallContext()->d() : 0; + return (ctx && ctx->type == QV4::Heap::ExecutionContext::Type_CallContext) ? + static_cast<QV4::Heap::CallContext *>(ctx) : 0; } QVector<QV4::Heap::ExecutionContext::ContextType> QV4DataCollector::getScopeTypes(int frame) { QVector<QV4::Heap::ExecutionContext::ContextType> types; - QV4::Scope scope(engine()); - QV4::SimpleCallContext *sctxt = findContext(frame); - if (!sctxt || sctxt->d()->type < QV4::Heap::ExecutionContext::Type_QmlContext) - return types; + QV4::Heap::ExecutionContext *it = findFrame(frame)->context()->d(); - QV4::ScopedContext it(scope, sctxt); - for (; it; it = it->d()->outer) - types.append(QV4::Heap::ExecutionContext::ContextType(it->d()->type)); + for (; it; it = it->outer) + types.append(QV4::Heap::ExecutionContext::ContextType(it->type)); return types; } @@ -109,7 +105,6 @@ int QV4DataCollector::encodeScopeType(QV4::Heap::ExecutionContext::ContextType s return 4; case QV4::Heap::ExecutionContext::Type_WithContext: return 2; - case QV4::Heap::ExecutionContext::Type_SimpleCallContext: case QV4::Heap::ExecutionContext::Type_CallContext: return 1; case QV4::Heap::ExecutionContext::Type_QmlContext: @@ -267,27 +262,17 @@ bool QV4DataCollector::collectScope(QJsonObject *dict, int frameNr, int scopeNr) QStringList names; QV4::Scope scope(engine()); + QV4::Scoped<QV4::CallContext> ctxt(scope, findScope(findContext(frameNr), scopeNr)); if (!ctxt) return false; Refs collectedRefs; QV4::ScopedValue v(scope); - int nFormals = ctxt->formalCount(); - for (unsigned i = 0, ei = nFormals; i != ei; ++i) { - QString qName; - if (QV4::Identifier *name = ctxt->formals()[nFormals - i - 1]) - qName = name->string; - names.append(qName); - v = ctxt->argument(i); - collectedRefs.append(collect(v)); - } - - for (unsigned i = 0, ei = ctxt->variableCount(); i != ei; ++i) { - QString qName; - if (QV4::Identifier *name = ctxt->variables()[i]) - qName = name->string; - names.append(qName); + QV4::InternalClass *ic = ctxt->internalClass(); + for (uint i = 0; i < ic->size; ++i) { + QString name = ic->nameMap[i]->string; + names.append(name); v = ctxt->d()->locals[i]; collectedRefs.append(collect(v)); } @@ -338,7 +323,7 @@ QJsonObject QV4DataCollector::buildFrame(const QV4::StackFrame &stackFrame, int QV4::Scope scope(engine()); QV4::ScopedContext ctxt(scope, findContext(frameNr)); while (ctxt) { - if (QV4::SimpleCallContext *cCtxt = ctxt->asSimpleCallContext()) { + if (QV4::CallContext *cCtxt = ctxt->asCallContext()) { if (cCtxt->d()->activation) break; } @@ -346,7 +331,7 @@ QJsonObject QV4DataCollector::buildFrame(const QV4::StackFrame &stackFrame, int } if (ctxt) { - QV4::ScopedValue o(scope, ctxt->asSimpleCallContext()->d()->activation); + QV4::ScopedValue o(scope, ctxt->d()->activation); frame[QLatin1String("receiver")] = toRef(collect(o)); } @@ -432,7 +417,7 @@ QV4::ReturnedValue QV4DataCollector::getValue(Ref ref) QV4::Scope scope(engine()); QV4::ScopedObject array(scope, m_values.value()); Q_ASSERT(ref < array->getLength()); - return array->getIndexed(ref, Q_NULLPTR); + return array->getIndexed(ref, nullptr); } // TODO: Drop this method once we don't need to support namesAsObjects anymore diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h index de12e8d527..87be009de5 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h @@ -58,11 +58,12 @@ public: typedef uint Ref; typedef QVector<uint> Refs; - static QV4::Heap::SimpleCallContext *findScope(QV4::ExecutionContext *ctxt, int scope); + static QV4::Heap::CallContext *findScope(QV4::Heap::ExecutionContext *ctxt, int scope); static int encodeScopeType(QV4::Heap::ExecutionContext::ContextType scopeType); QVector<QV4::Heap::ExecutionContext::ContextType> getScopeTypes(int frame); - QV4::SimpleCallContext *findContext(int frame); + QV4::Heap::ExecutionContext *findContext(int frame); + QV4::CppStackFrame *findFrame(int frame); QV4DataCollector(QV4::ExecutionEngine *engine); diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp index b82df9c6a9..45817ea38e 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp @@ -115,7 +115,7 @@ void QV4Debugger::resume(Speed speed) if (!m_returnedValue.isUndefined()) m_returnedValue.set(m_engine, QV4::Encode::undefined()); - m_currentContext.set(m_engine, *m_engine->currentContext); + m_currentFrame = m_engine->currentStackFrame; m_stepping = speed; m_runningCondition.wakeAll(); } @@ -158,7 +158,7 @@ QV4Debugger::ExecutionState QV4Debugger::currentExecutionState() const { ExecutionState state; state.fileName = getFunction()->sourceFile(); - state.lineNumber = engine()->current->lineNumber; + state.lineNumber = engine()->currentStackFrame->lineNumber(); return state; } @@ -187,9 +187,9 @@ void QV4Debugger::maybeBreakAtInstruction() switch (m_stepping) { case StepOver: - if (m_currentContext.asManaged()->d() != m_engine->current) + if (m_currentFrame != m_engine->currentStackFrame) break; - // fall through + Q_FALLTHROUGH(); case StepIn: pauseAndWait(Step); return; @@ -203,7 +203,8 @@ void QV4Debugger::maybeBreakAtInstruction() pauseAndWait(PauseRequest); } else if (m_haveBreakPoints) { if (QV4::Function *f = getFunction()) { - const int lineNumber = engine()->current->lineNumber; + // lineNumber will be negative for Ret instructions, so those won't match + const int lineNumber = engine()->currentStackFrame->lineNumber(); if (reallyHitTheBreakPoint(f->sourceFile(), lineNumber)) pauseAndWait(BreakPointHit); } @@ -216,9 +217,8 @@ void QV4Debugger::enteringFunction() return; QMutexLocker locker(&m_lock); - if (m_stepping == StepIn) { - m_currentContext.set(m_engine, *m_engine->currentContext); - } + if (m_stepping == StepIn) + m_currentFrame = m_engine->currentStackFrame; } void QV4Debugger::leavingFunction(const QV4::ReturnedValue &retVal) @@ -229,13 +229,8 @@ void QV4Debugger::leavingFunction(const QV4::ReturnedValue &retVal) QMutexLocker locker(&m_lock); - if (m_stepping != NotStepping && m_currentContext.asManaged()->d() == m_engine->current) { - if (QV4::ExecutionContext *parentContext - = m_engine->parentContext(m_engine->currentContext)) { - m_currentContext.set(m_engine, *parentContext); - } else { - m_currentContext.clear(); - } + if (m_stepping != NotStepping && m_currentFrame == m_engine->currentStackFrame) { + m_currentFrame = m_currentFrame->parent; m_stepping = StepOver; m_returnedValue.set(m_engine, retVal); } @@ -255,10 +250,8 @@ void QV4Debugger::aboutToThrow() QV4::Function *QV4Debugger::getFunction() const { - QV4::Scope scope(m_engine); - QV4::ExecutionContext *context = m_engine->currentContext; - if (QV4::Function *function = context->getFunction()) - return function; + if (m_engine->currentStackFrame) + return m_engine->currentStackFrame->v4Function; else return m_engine->globalCode; } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.h b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.h index cd412e573d..4a755f2b72 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.h @@ -129,14 +129,14 @@ public: void runInEngine(QV4DebugJob *job); // compile-time interface - void maybeBreakAtInstruction() Q_DECL_OVERRIDE; + void maybeBreakAtInstruction() override; // execution hooks - void enteringFunction() Q_DECL_OVERRIDE; - void leavingFunction(const QV4::ReturnedValue &retVal) Q_DECL_OVERRIDE; - void aboutToThrow() Q_DECL_OVERRIDE; + void enteringFunction() override; + void leavingFunction(const QV4::ReturnedValue &retVal) override; + void aboutToThrow() override; - bool pauseAtNextOpportunity() const Q_DECL_OVERRIDE; + bool pauseAtNextOpportunity() const override; signals: void debuggerPaused(QV4Debugger *self, QV4Debugger::PauseReason reason); @@ -150,7 +150,7 @@ private: void runJobUnpaused(); QV4::ExecutionEngine *m_engine; - QV4::PersistentValue m_currentContext; + QV4::CppStackFrame *m_currentFrame = 0; QMutex m_lock; QWaitCondition m_runningCondition; State m_state; diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp index 9a34d5770a..87e75c49b5 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp @@ -79,20 +79,19 @@ void QV4DebuggerAgent::debuggerPaused(QV4Debugger *debugger, QV4Debugger::PauseR case QV4Debugger::PauseRequest: case QV4Debugger::BreakPointHit: { event.insert(QStringLiteral("event"), QStringLiteral("break")); - QVector<QV4::StackFrame> frames = debugger->stackTrace(1); - if (frames.isEmpty()) + QV4::CppStackFrame *frame = debugger->engine()->currentStackFrame; + if (!frame) break; - const QV4::StackFrame &topFrame = frames.first(); - body.insert(QStringLiteral("invocationText"), topFrame.function); - body.insert(QStringLiteral("sourceLine"), topFrame.line - 1); - if (topFrame.column > 0) - body.insert(QStringLiteral("sourceColumn"), topFrame.column); + body.insert(QStringLiteral("invocationText"), frame->function()); + body.insert(QStringLiteral("sourceLine"), qAbs(frame->lineNumber()) - 1); +// if (frame->column > 0) +// body.insert(QStringLiteral("sourceColumn"), frame->column); QJsonArray breakPoints; - foreach (int breakPointId, breakPointIds(topFrame.source, topFrame.line)) + foreach (int breakPointId, breakPointIds(frame->source(), frame->lineNumber())) breakPoints.push_back(breakPointId); body.insert(QStringLiteral("breakpoints"), breakPoints); - script.insert(QStringLiteral("name"), topFrame.source); + script.insert(QStringLiteral("name"), frame->source()); } break; case QV4Debugger::Throwing: // TODO: complete this! diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp index d57d7e7406..6f254c9e28 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp @@ -44,6 +44,7 @@ #include <private/qv4qmlcontext_p.h> #include <private/qv4qobjectwrapper_p.h> #include <private/qqmldebugservice_p.h> +#include <private/qv4jscall_p.h> #include <QtQml/qqmlengine.h> @@ -63,26 +64,21 @@ void JavaScriptJob::run() { QV4::Scope scope(engine); - QV4::ExecutionContextSaver saver(scope); - - QV4::ExecutionContext *ctx = engine->currentContext; + QV4::ScopedContext ctx(scope, engine->currentStackFrame ? engine->currentContext() + : engine->rootContext()); QObject scopeObject; - if (frameNr > 0) { - for (int i = 0; i < frameNr; ++i) { - ctx = engine->parentContext(ctx); - } - engine->pushContext(ctx); - ctx = engine->currentContext; - } + QV4::CppStackFrame *frame = engine->currentStackFrame; + + for (int i = 0; frame && i < frameNr; ++i) + frame = frame->parent; + if (frameNr > 0 && frame) + ctx = static_cast<QV4::ExecutionContext *>(&frame->jsFrame->context); if (context >= 0) { QQmlContext *extraContext = qmlContext(QQmlDebugService::objectForId(context)); - if (extraContext) { - engine->pushContext(QV4::QmlContext::create(ctx, QQmlContextData::get(extraContext), - &scopeObject)); - ctx = engine->currentContext; - } + if (extraContext) + ctx = QV4::QmlContext::create(ctx, QQmlContextData::get(extraContext), &scopeObject); } else if (frameNr < 0) { // Use QML context if available QQmlEngine *qmlEngine = engine->qmlEngine(); if (qmlEngine) { @@ -102,18 +98,15 @@ void JavaScriptJob::run() } } } - if (!engine->qmlContext()) { - engine->pushContext(QV4::QmlContext::create(ctx, QQmlContextData::get(qmlRootContext), - &scopeObject)); - ctx = engine->currentContext; - } - engine->pushContext(ctx->newWithContext(withContext->toObject(engine))); - ctx = engine->currentContext; + if (!engine->qmlContext()) + ctx = QV4::QmlContext::create(ctx, QQmlContextData::get(qmlRootContext), &scopeObject); } } - QV4::Script script(ctx, this->script); - script.strictMode = ctx->d()->strictMode; + QV4::Script script(ctx, QV4::Compiler::EvalCode, this->script); + if (const QV4::Function *function = frame ? frame->v4Function : engine->globalCode) + script.strictMode = function->isStrict(); + // In order for property lookups in QML to work, we need to disable fast v4 lookups. That // is a side-effect of inheritContext. script.inheritContext = true; @@ -214,12 +207,15 @@ void ValueLookupJob::run() // set if the engine is currently executing QML code. QScopedPointer<QObject> scopeObject; QV4::ExecutionEngine *engine = collector->engine(); + QV4::Scope scope(engine); + QV4::Heap::ExecutionContext *qmlContext = 0; if (engine->qmlEngine() && !engine->qmlContext()) { scopeObject.reset(new QObject); - engine->pushContext(QV4::QmlContext::create(engine->currentContext, + qmlContext = QV4::QmlContext::create(engine->currentContext(), QQmlContextData::get(engine->qmlEngine()->rootContext()), - scopeObject.data())); + scopeObject.data()); } + QV4::ScopedStackFrame frame(scope, qmlContext); for (const QJsonValue &handle : handles) { QV4DataCollector::Ref ref = handle.toInt(); if (!collector->isValidRef(ref)) { @@ -229,8 +225,6 @@ void ValueLookupJob::run() result[QString::number(ref)] = collector->lookupRef(ref, true); } flushRedundantRefs(); - if (scopeObject) - engine->popContext(); } const QString &ValueLookupJob::exceptionMessage() const diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp index 168a08865c..fca811cb28 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp @@ -40,13 +40,12 @@ #include "qv4debugservice.h" #include "qv4debugjob.h" #include "qqmlengine.h" -#include "qqmldebugpacket.h" #include <private/qv4engine_p.h> -#include <private/qv4isel_moth_p.h> #include <private/qv4function_p.h> #include <private/qqmldebugconnector_p.h> #include <private/qv8engine_p.h> +#include <private/qqmldebugpacket_p.h> #include <QtCore/QJsonArray> #include <QtCore/QJsonDocument> @@ -706,7 +705,6 @@ void QV4DebugServiceImpl::engineAdded(QJSEngine *engine) QV4::ExecutionEngine *ee = QV8Engine::getV4(engine->handle()); if (QQmlDebugConnector *server = QQmlDebugConnector::instance()) { if (ee) { - ee->iselFactory.reset(new QV4::Moth::ISelFactory); QV4Debugger *debugger = new QV4Debugger(ee); if (state() == Enabled) ee->setDebugger(debugger); diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h index bb13890ae4..5401956994 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h @@ -51,9 +51,9 @@ // We mean it. // -#include "qqmlconfigurabledebugservice.h" #include "qv4debuggeragent.h" #include "qv4datacollector.h" +#include <private/qqmlconfigurabledebugservice_p.h> #include <private/qqmldebugserviceinterfaces_p.h> #include <private/qv4debugging_p.h> @@ -73,14 +73,14 @@ class QV4DebugServiceImpl : public QQmlConfigurableDebugService<QV4DebugService> Q_OBJECT public: explicit QV4DebugServiceImpl(QObject *parent = 0); - ~QV4DebugServiceImpl() Q_DECL_OVERRIDE; + ~QV4DebugServiceImpl() override; - void engineAdded(QJSEngine *engine) Q_DECL_OVERRIDE; - void engineAboutToBeRemoved(QJSEngine *engine) Q_DECL_OVERRIDE; + void engineAdded(QJSEngine *engine) override; + void engineAboutToBeRemoved(QJSEngine *engine) override; - void stateAboutToBeChanged(State state) Q_DECL_OVERRIDE; + void stateAboutToBeChanged(State state) override; - void signalEmitted(const QString &signal) Q_DECL_OVERRIDE; + void signalEmitted(const QString &signal) override; void send(QJsonObject v8Payload); int selectedFrame() const; @@ -92,7 +92,7 @@ public: QV4DebuggerAgent debuggerAgent; protected: - void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; + void messageReceived(const QByteArray &) override; void sendSomethingToSomebody(const char *type, int magicNumber = 1); private: diff --git a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp index 7145645609..7ce83daed6 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp @@ -40,11 +40,11 @@ #include "globalinspector.h" #include "highlight.h" #include "inspecttool.h" -#include "qqmldebugpacket.h" #include <private/qqmldebugserviceinterfaces_p.h> #include <private/qabstractanimation_p.h> #include <private/qqmlcomponent_p.h> +#include <private/qqmldebugpacket_p.h> #include <QtGui/qwindow.h> diff --git a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro index a8844944e0..18a61f15b7 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro +++ b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro @@ -1,8 +1,6 @@ TARGET = qmldbg_inspector QT += qml-private quick-private core-private gui-private packetprotocol-private -INCLUDEPATH *= $$PWD $$PWD/../shared - SOURCES += \ $$PWD/globalinspector.cpp \ $$PWD/highlight.cpp \ @@ -11,7 +9,6 @@ SOURCES += \ $$PWD/qquickwindowinspector.cpp HEADERS += \ - $$PWD/../shared/qqmldebugpacket.h \ $$PWD/globalinspector.h \ $$PWD/highlight.h \ $$PWD/inspecttool.h\ diff --git a/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp b/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp index ab1aeebf64..d0d8d62615 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp @@ -51,15 +51,15 @@ class QQmlInspectorServiceImpl : public QQmlInspectorService public: QQmlInspectorServiceImpl(QObject *parent = 0); - void addWindow(QQuickWindow *window) Q_DECL_OVERRIDE; - void setParentWindow(QQuickWindow *window, QWindow *parent) Q_DECL_OVERRIDE; - void removeWindow(QQuickWindow *window) Q_DECL_OVERRIDE; + void addWindow(QQuickWindow *window) override; + void setParentWindow(QQuickWindow *window, QWindow *parent) override; + void removeWindow(QQuickWindow *window) override; signals: void scheduleMessage(const QByteArray &message); protected: - virtual void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; + void messageReceived(const QByteArray &) override; private: friend class QQmlInspectorServiceFactory; diff --git a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp index 97e4b4e3e4..e60644518f 100644 --- a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp +++ b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp @@ -38,10 +38,10 @@ ****************************************************************************/ #include "qlocalclientconnectionfactory.h" -#include "qqmldebugserver.h" #include <QtCore/qplugin.h> #include <QtNetwork/qlocalsocket.h> +#include <private/qqmldebugserver_p.h> Q_DECLARE_METATYPE(QLocalSocket::LocalSocketError) diff --git a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnectionfactory.h b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnectionfactory.h index b64a1fff95..95bbd8956a 100644 --- a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnectionfactory.h +++ b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnectionfactory.h @@ -40,7 +40,7 @@ #ifndef QLOCALCLIENTCONNECTIONFACTORY_H #define QLOCALCLIENTCONNECTIONFACTORY_H -#include "qqmldebugserverconnection.h" +#include <private/qqmldebugserverconnection_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_local/qmldbg_local.pro b/src/plugins/qmltooling/qmldbg_local/qmldbg_local.pro index d731e47b7e..71dba262da 100644 --- a/src/plugins/qmltooling/qmldbg_local/qmldbg_local.pro +++ b/src/plugins/qmltooling/qmldbg_local/qmldbg_local.pro @@ -5,12 +5,7 @@ SOURCES += \ $$PWD/qlocalclientconnection.cpp HEADERS += \ - $$PWD/qlocalclientconnectionfactory.h \ - $$PWD/../shared/qqmldebugserver.h \ - $$PWD/../shared/qqmldebugserverconnection.h - -INCLUDEPATH += $$PWD \ - $$PWD/../shared + $$PWD/qlocalclientconnectionfactory.h OTHER_FILES += \ $$PWD/qlocalclientconnection.json diff --git a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp index b0f59717ac..bdfed03a40 100644 --- a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp +++ b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp @@ -38,8 +38,9 @@ ****************************************************************************/ #include "qdebugmessageservice.h" -#include "qqmldebugpacket.h" + #include <private/qqmldebugconnector_p.h> +#include <private/qqmldebugpacket_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_messages/qmldbg_messages.pro b/src/plugins/qmltooling/qmldbg_messages/qmldbg_messages.pro index 5ddf7c615d..eda6df1a16 100644 --- a/src/plugins/qmltooling/qmldbg_messages/qmldbg_messages.pro +++ b/src/plugins/qmltooling/qmldbg_messages/qmldbg_messages.pro @@ -6,13 +6,9 @@ SOURCES += \ $$PWD/qdebugmessageservicefactory.cpp HEADERS += \ - $$PWD/../shared/qqmldebugpacket.h \ $$PWD/qdebugmessageservice.h \ $$PWD/qdebugmessageservicefactory.h -INCLUDEPATH += $$PWD \ - $$PWD/../shared - OTHER_FILES += \ $$PWD/qdebugmessageservice.json diff --git a/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro b/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro index e5489574be..6630a394a0 100644 --- a/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro +++ b/src/plugins/qmltooling/qmldbg_native/qmldbg_native.pro @@ -2,15 +2,11 @@ TARGET = qmldbg_native QT = qml-private core-private packetprotocol-private HEADERS += \ - $$PWD/../shared/qqmldebugpacket.h \ $$PWD/qqmlnativedebugconnector.h SOURCES += \ $$PWD/qqmlnativedebugconnector.cpp -INCLUDEPATH += $$PWD \ - $$PWD/../shared - OTHER_FILES += \ $$PWD/qqmlnativedebugconnector.json diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp index 388d2e3b22..a4b3455eff 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp @@ -38,9 +38,9 @@ ****************************************************************************/ #include "qqmlnativedebugconnector.h" -#include "qqmldebugpacket.h" #include <private/qhooks_p.h> +#include <private/qqmldebugpacket_p.h> #include <QtQml/qjsengine.h> #include <QtCore/qdebug.h> diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h index f8b7e1d527..a7f37b0f1e 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.h @@ -51,16 +51,16 @@ class QQmlNativeDebugConnector : public QQmlDebugConnector public: QQmlNativeDebugConnector(); - ~QQmlNativeDebugConnector() Q_DECL_OVERRIDE; + ~QQmlNativeDebugConnector() override; - bool blockingMode() const Q_DECL_OVERRIDE; - QQmlDebugService *service(const QString &name) const Q_DECL_OVERRIDE; - void addEngine(QJSEngine *engine) Q_DECL_OVERRIDE; - void removeEngine(QJSEngine *engine) Q_DECL_OVERRIDE; - bool hasEngine(QJSEngine *engine) const Q_DECL_OVERRIDE; - bool addService(const QString &name, QQmlDebugService *service) Q_DECL_OVERRIDE; - bool removeService(const QString &name) Q_DECL_OVERRIDE; - bool open(const QVariantHash &configuration) Q_DECL_OVERRIDE; + bool blockingMode() const override; + QQmlDebugService *service(const QString &name) const override; + void addEngine(QJSEngine *engine) override; + void removeEngine(QJSEngine *engine) override; + bool hasEngine(QJSEngine *engine) const override; + bool addService(const QString &name, QQmlDebugService *service) override; + bool removeService(const QString &name) override; + bool open(const QVariantHash &configuration) override; static void setDataStreamVersion(int version); private: diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qmldbg_nativedebugger.pro b/src/plugins/qmltooling/qmldbg_nativedebugger/qmldbg_nativedebugger.pro index 1873a6a77c..1cb5525622 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qmldbg_nativedebugger.pro +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qmldbg_nativedebugger.pro @@ -6,13 +6,9 @@ SOURCES += \ $$PWD/qqmlnativedebugservice.cpp HEADERS += \ - $$PWD/../shared/qqmldebugpacket.h \ $$PWD/qqmlnativedebugservicefactory.h \ $$PWD/qqmlnativedebugservice.h \ -INCLUDEPATH += $$PWD \ - $$PWD/../shared - OTHER_FILES += \ $$PWD/qqmlnativedebugservice.json diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp index d536fd51ed..eeedb59ce6 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qqmlnativedebugservice.h" -#include "qqmldebugpacket.h" #include <private/qqmldebugconnector_p.h> #include <private/qv4debugging_p.h> @@ -50,7 +49,7 @@ #include <private/qv4objectiterator_p.h> #include <private/qv4identifier_p.h> #include <private/qv4runtime_p.h> -#include <private/qv4isel_moth_p.h> +#include <private/qqmldebugpacket_p.h> #include <private/qqmldebugserviceinterfaces_p.h> #include <QtQml/qjsengine.h> @@ -188,16 +187,16 @@ public: QV4::ExecutionEngine *engine() const { return m_engine; } - bool pauseAtNextOpportunity() const Q_DECL_OVERRIDE { + bool pauseAtNextOpportunity() const override { return m_pauseRequested || m_service->m_breakHandler->m_haveBreakPoints || m_stepping >= StepOver; } - void maybeBreakAtInstruction() Q_DECL_OVERRIDE; - void enteringFunction() Q_DECL_OVERRIDE; - void leavingFunction(const QV4::ReturnedValue &retVal) Q_DECL_OVERRIDE; - void aboutToThrow() Q_DECL_OVERRIDE; + void maybeBreakAtInstruction() override; + void enteringFunction() override; + void leavingFunction(const QV4::ReturnedValue &retVal) override; + void aboutToThrow() override; void handleCommand(QJsonObject *response, const QString &cmd, const QJsonObject &arguments); @@ -208,7 +207,7 @@ private: void handleDebuggerDeleted(QObject *debugger); - void evaluateExpression(QV4::Scope &scope, const QString &expression); + QV4::ReturnedValue evaluateExpression(const QString &expression); bool checkCondition(const QString &expression); QStringList breakOnSignals; @@ -230,7 +229,7 @@ private: QV4::ExecutionEngine *m_engine; QQmlNativeDebugServiceImpl *m_service; - QV4::PersistentValue m_currentContext; + QV4::CppStackFrame *m_currentFrame = 0; Speed m_stepping; bool m_pauseRequested; bool m_runningJob; @@ -241,29 +240,31 @@ private: bool NativeDebugger::checkCondition(const QString &expression) { QV4::Scope scope(m_engine); - evaluateExpression(scope, expression); - return scope.result.booleanValue(); + QV4::ScopedValue r(scope, evaluateExpression(expression)); + return r->booleanValue(); } -void NativeDebugger::evaluateExpression(QV4::Scope &scope, const QString &expression) +QV4::ReturnedValue NativeDebugger::evaluateExpression(const QString &expression) { + QV4::Scope scope(m_engine); m_runningJob = true; - QV4::ExecutionContextSaver saver(scope); - - QV4::ExecutionContext *ctx = m_engine->currentContext; - m_engine->pushContext(ctx); + QV4::ExecutionContext *ctx = m_engine->currentStackFrame ? m_engine->currentContext() + : m_engine->rootContext(); - QV4::Script script(ctx, expression); - script.strictMode = ctx->d()->strictMode; + QV4::Script script(ctx, QV4::Compiler::EvalCode, expression); + if (const QV4::Function *function = m_engine->currentStackFrame + ? m_engine->currentStackFrame->v4Function : m_engine->globalCode) + script.strictMode = function->isStrict(); // In order for property lookups in QML to work, we need to disable fast v4 lookups. // That is a side-effect of inheritContext. script.inheritContext = true; script.parse(); if (!m_engine->hasException) - scope.result = script.run(); + return script.run(); m_runningJob = false; + return QV4::Encode::undefined(); } NativeDebugger::NativeDebugger(QQmlNativeDebugServiceImpl *service, QV4::ExecutionEngine *engine) @@ -314,19 +315,19 @@ void NativeDebugger::handleCommand(QJsonObject *response, const QString &cmd, handleContinue(response, NotStepping); } -static QString encodeContext(QV4::ExecutionContext *executionContext) +static QString encodeFrame(QV4::CppStackFrame *f) { QQmlDebugPacket ds; - ds << quintptr(executionContext); + ds << quintptr(f); return QString::fromLatin1(ds.data().toHex()); } -static void decodeContext(const QString &context, QV4::ExecutionContext **executionContext) +static void decodeFrame(const QString &f, QV4::CppStackFrame **frame) { - quintptr rawContext; - QQmlDebugPacket ds(QByteArray::fromHex(context.toLatin1())); - ds >> rawContext; - *executionContext = reinterpret_cast<QV4::ExecutionContext *>(rawContext); + quintptr rawFrame; + QQmlDebugPacket ds(QByteArray::fromHex(f.toLatin1())); + ds >> rawFrame; + *frame = reinterpret_cast<QV4::CppStackFrame *>(rawFrame); } void NativeDebugger::handleBacktrace(QJsonObject *response, const QJsonObject &arguments) @@ -334,25 +335,24 @@ void NativeDebugger::handleBacktrace(QJsonObject *response, const QJsonObject &a int limit = arguments.value(QLatin1String("limit")).toInt(0); QJsonArray frameArray; - QV4::ExecutionContext *executionContext = m_engine->currentContext; - for (int i = 0; i < limit && executionContext; ++i) { - if (QV4::Function *function = executionContext->getFunction()) { + QV4::CppStackFrame *f= m_engine->currentStackFrame; + for (int i = 0; i < limit && f; ++i) { + QV4::Function *function = f->v4Function; - QJsonObject frame; - frame.insert(QStringLiteral("language"), QStringLiteral("js")); - frame.insert(QStringLiteral("context"), encodeContext(executionContext)); + QJsonObject frame; + frame.insert(QStringLiteral("language"), QStringLiteral("js")); + frame.insert(QStringLiteral("context"), encodeFrame(f)); - if (QV4::Heap::String *functionName = function->name()) - frame.insert(QStringLiteral("function"), functionName->toQString()); - frame.insert(QStringLiteral("file"), function->sourceFile()); + if (QV4::Heap::String *functionName = function->name()) + frame.insert(QStringLiteral("function"), functionName->toQString()); + frame.insert(QStringLiteral("file"), function->sourceFile()); - int line = executionContext->d()->lineNumber; - frame.insert(QStringLiteral("line"), (line < 0 ? -line : line)); + int line = f->lineNumber(); + frame.insert(QStringLiteral("line"), (line < 0 ? -line : line)); - frameArray.push_back(frame); - } + frameArray.push_back(frame); - executionContext = m_engine->parentContext(executionContext); + f = f->parent; } response->insert(QStringLiteral("frames"), frameArray); @@ -457,15 +457,15 @@ void Collector::collect(QJsonArray *out, const QString &parentIName, const QStri void NativeDebugger::handleVariables(QJsonObject *response, const QJsonObject &arguments) { TRACE_PROTOCOL("Build variables"); - QV4::ExecutionContext *executionContext = 0; - decodeContext(arguments.value(QLatin1String("context")).toString(), &executionContext); - if (!executionContext) { - setError(response, QStringLiteral("No execution context passed")); + QV4::CppStackFrame *frame = 0; + decodeFrame(arguments.value(QLatin1String("context")).toString(), &frame); + if (!frame) { + setError(response, QStringLiteral("No stack frame passed")); return; } - TRACE_PROTOCOL("Context: " << executionContext); + TRACE_PROTOCOL("Context: " << frame); - QV4::ExecutionEngine *engine = executionContext->engine(); + QV4::ExecutionEngine *engine = frame->v4Function->internalClass->engine; if (!engine) { setError(response, QStringLiteral("No execution engine passed")); return; @@ -481,28 +481,16 @@ void NativeDebugger::handleVariables(QJsonObject *response, const QJsonObject &a QJsonArray output; QV4::Scope scope(engine); - if (QV4::SimpleCallContext *callContext = executionContext->asSimpleCallContext()) { - QV4::Value thisObject = callContext->thisObject(); - collector.collect(&output, QString(), QStringLiteral("this"), thisObject); - QV4::Identifier *const *variables = callContext->variables(); - QV4::Identifier *const *formals = callContext->formals(); - if (callContext->d()->type == QV4::Heap::ExecutionContext::Type_CallContext) { - QV4::CallContext *ctx = static_cast<QV4::CallContext *>(callContext); - for (unsigned i = 0, ei = ctx->variableCount(); i != ei; ++i) { - QString qName; - if (QV4::Identifier *name = variables[i]) - qName = name->string; - QV4::Value val = ctx->d()->locals[i]; - collector.collect(&output, QString(), qName, val); - } - } - for (unsigned i = 0, ei = callContext->formalCount(); i != ei; ++i) { - QString qName; - if (QV4::Identifier *name = formals[i]) - qName = name->string; - QV4::ReturnedValue rval = callContext->argument(i); - QV4::ScopedValue sval(scope, rval); - collector.collect(&output, QString(), qName, *sval); + QV4::ScopedValue thisObject(scope, frame->thisObject()); + collector.collect(&output, QString(), QStringLiteral("this"), thisObject); + QV4::Scoped<QV4::CallContext> callContext(scope, frame->callContext()); + if (callContext) { + QV4::InternalClass *ic = callContext->internalClass(); + QV4::ScopedValue v(scope); + for (uint i = 0; i < ic->size; ++i) { + QString name = ic->nameMap[i]->string; + v = callContext->d()->locals[i]; + collector.collect(&output, QString(), name, v); } } @@ -512,15 +500,15 @@ void NativeDebugger::handleVariables(QJsonObject *response, const QJsonObject &a void NativeDebugger::handleExpressions(QJsonObject *response, const QJsonObject &arguments) { TRACE_PROTOCOL("Evaluate expressions"); - QV4::ExecutionContext *executionContext = 0; - decodeContext(arguments.value(QLatin1String("context")).toString(), &executionContext); - if (!executionContext) { - setError(response, QStringLiteral("No execution context passed")); + QV4::CppStackFrame *frame = 0; + decodeFrame(arguments.value(QLatin1String("context")).toString(), &frame); + if (!frame) { + setError(response, QStringLiteral("No stack frame passed")); return; } TRACE_PROTOCOL("Context: " << executionContext); - QV4::ExecutionEngine *engine = executionContext->engine(); + QV4::ExecutionEngine *engine = frame->v4Function->internalClass->engine; if (!engine) { setError(response, QStringLiteral("No execution engine passed")); return; @@ -543,8 +531,7 @@ void NativeDebugger::handleExpressions(QJsonObject *response, const QJsonObject TRACE_PROTOCOL("Evaluate expression: " << expression); m_runningJob = true; - evaluateExpression(scope, expression); - QV4::ScopedValue result(scope, scope.result); + QV4::ScopedValue result(scope, evaluateExpression(expression)); m_runningJob = false; if (result->isUndefined()) { @@ -595,7 +582,7 @@ void NativeDebugger::handleContinue(QJsonObject *response, Speed speed) if (!m_returnedValue.isUndefined()) m_returnedValue.set(m_engine, QV4::Encode::undefined()); - m_currentContext.set(m_engine, *m_engine->currentContext); + m_currentFrame = m_engine->currentStackFrame; m_stepping = speed; } @@ -605,7 +592,7 @@ void NativeDebugger::maybeBreakAtInstruction() return; if (m_stepping == StepOver) { - if (m_currentContext.asManaged()->d() == m_engine->current) + if (m_currentFrame == m_engine->currentStackFrame) pauseAndWait(); return; } @@ -623,7 +610,8 @@ void NativeDebugger::maybeBreakAtInstruction() if (m_service->m_breakHandler->m_haveBreakPoints) { if (QV4::Function *function = getFunction()) { - const int lineNumber = m_engine->current->lineNumber; + // lineNumber will be negative for Ret instructions, so those won't match + const int lineNumber = m_engine->currentStackFrame->lineNumber(); if (reallyHitTheBreakPoint(function, lineNumber)) pauseAndWait(); } @@ -636,7 +624,7 @@ void NativeDebugger::enteringFunction() return; if (m_stepping == StepIn) { - m_currentContext.set(m_engine, *m_engine->currentContext); + m_currentFrame = m_engine->currentStackFrame; } } @@ -645,8 +633,8 @@ void NativeDebugger::leavingFunction(const QV4::ReturnedValue &retVal) if (m_runningJob) return; - if (m_stepping != NotStepping && m_currentContext.asManaged()->d() == m_engine->current) { - m_currentContext.set(m_engine, *m_engine->parentContext(m_engine->currentContext)); + if (m_stepping != NotStepping && m_currentFrame == m_engine->currentStackFrame) { + m_currentFrame = m_currentFrame->parent; m_stepping = StepOver; m_returnedValue.set(m_engine, retVal); } @@ -668,9 +656,8 @@ void NativeDebugger::aboutToThrow() QV4::Function *NativeDebugger::getFunction() const { - QV4::ExecutionContext *context = m_engine->currentContext; - if (QV4::Function *function = context->getFunction()) - return function; + if (m_engine->currentStackFrame) + return m_engine->currentStackFrame->v4Function; else return m_engine->globalCode; } @@ -681,12 +668,11 @@ void NativeDebugger::pauseAndWait() event.insert(QStringLiteral("event"), QStringLiteral("break")); event.insert(QStringLiteral("language"), QStringLiteral("js")); - if (QV4::ExecutionContext *executionContext = m_engine->currentContext) { - if (QV4::Function *function = executionContext->getFunction()) { - event.insert(QStringLiteral("file"), function->sourceFile()); - int line = executionContext->d()->lineNumber; - event.insert(QStringLiteral("line"), (line < 0 ? -line : line)); - } + if (QV4::CppStackFrame *frame = m_engine->currentStackFrame) { + QV4::Function *function = frame->v4Function; + event.insert(QStringLiteral("file"), function->sourceFile()); + int line = frame->lineNumber(); + event.insert(QStringLiteral("line"), (line < 0 ? -line : line)); } m_service->emitAsynchronousMessageToClient(event); @@ -731,7 +717,6 @@ void QQmlNativeDebugServiceImpl::engineAboutToBeAdded(QJSEngine *engine) TRACE_PROTOCOL("Adding execution engine" << ee); if (ee) { NativeDebugger *debugger = new NativeDebugger(this, ee); - ee->iselFactory.reset(new QV4::Moth::ISelFactory); if (state() == Enabled) ee->setDebugger(debugger); m_debuggers.append(QPointer<NativeDebugger>(debugger)); diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h index 58bf1bc94a..4b4661be2f 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.h @@ -73,14 +73,14 @@ class QQmlNativeDebugServiceImpl : public QQmlNativeDebugService public: QQmlNativeDebugServiceImpl(QObject *parent); - ~QQmlNativeDebugServiceImpl() Q_DECL_OVERRIDE; + ~QQmlNativeDebugServiceImpl() override; - void engineAboutToBeAdded(QJSEngine *engine) Q_DECL_OVERRIDE; - void engineAboutToBeRemoved(QJSEngine *engine) Q_DECL_OVERRIDE; + void engineAboutToBeAdded(QJSEngine *engine) override; + void engineAboutToBeRemoved(QJSEngine *engine) override; - void stateAboutToBeChanged(State state) Q_DECL_OVERRIDE; + void stateAboutToBeChanged(State state) override; - void messageReceived(const QByteArray &message) Q_DECL_OVERRIDE; + void messageReceived(const QByteArray &message) override; void emitAsynchronousMessageToClient(const QJsonObject &message); diff --git a/src/plugins/qmltooling/qmldbg_profiler/qmldbg_profiler.pro b/src/plugins/qmltooling/qmldbg_profiler/qmldbg_profiler.pro index 4629a7b81e..ac874b079e 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qmldbg_profiler.pro +++ b/src/plugins/qmltooling/qmldbg_profiler/qmldbg_profiler.pro @@ -9,17 +9,12 @@ SOURCES += \ $$PWD/qv4profileradapter.cpp HEADERS += \ - $$PWD/../shared/qqmlconfigurabledebugservice.h \ - $$PWD/../shared/qqmldebugpacket.h \ $$PWD/qqmlenginecontrolservice.h \ $$PWD/qqmlprofileradapter.h \ $$PWD/qqmlprofilerservice.h \ $$PWD/qqmlprofilerservicefactory.h \ $$PWD/qv4profileradapter.h -INCLUDEPATH += $$PWD \ - $$PWD/../shared - OTHER_FILES += \ $$PWD/qqmlprofilerservice.json diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp index 9918a95116..4eedb4bd51 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include "qqmlenginecontrolservice.h" -#include "qqmldebugpacket.h" +#include <private/qqmldebugpacket_p.h> #include <QJSEngine> QT_BEGIN_NAMESPACE @@ -53,8 +53,8 @@ void QQmlEngineControlServiceImpl::messageReceived(const QByteArray &message) { QMutexLocker lock(&dataMutex); QQmlDebugPacket d(message); - int command; - int engineId; + qint32 command; + qint32 engineId; d >> command >> engineId; QJSEngine *engine = qobject_cast<QJSEngine *>(objectForId(engineId)); if (command == StartWaitingEngine && startingEngines.contains(engine)) { @@ -112,10 +112,11 @@ void QQmlEngineControlServiceImpl::engineRemoved(QJSEngine *engine) } } -void QQmlEngineControlServiceImpl::sendMessage(QQmlEngineControlServiceImpl::MessageType type, QJSEngine *engine) +void QQmlEngineControlServiceImpl::sendMessage(QQmlEngineControlServiceImpl::MessageType type, + QJSEngine *engine) { QQmlDebugPacket d; - d << int(type) << idForObject(engine); + d << static_cast<qint32>(type) << idForObject(engine); emit messageToClient(name(), d.data()); } diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h index 6392944519..3c5daa0f4f 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.h @@ -81,15 +81,15 @@ protected: QList<QJSEngine *> stoppingEngines; bool blockingMode; - void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; - void engineAboutToBeAdded(QJSEngine *) Q_DECL_OVERRIDE; - void engineAboutToBeRemoved(QJSEngine *) Q_DECL_OVERRIDE; - void engineAdded(QJSEngine *) Q_DECL_OVERRIDE; - void engineRemoved(QJSEngine *) Q_DECL_OVERRIDE; + void messageReceived(const QByteArray &) override; + void engineAboutToBeAdded(QJSEngine *) override; + void engineAboutToBeRemoved(QJSEngine *) override; + void engineAdded(QJSEngine *) override; + void engineRemoved(QJSEngine *) override; void sendMessage(MessageType type, QJSEngine *engine); - void stateChanged(State) Q_DECL_OVERRIDE; + void stateChanged(State) override; }; QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp index d676731ba7..5ff1b1f97e 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp @@ -38,8 +38,8 @@ ****************************************************************************/ #include "qqmlprofileradapter.h" -#include "qqmldebugpacket.h" +#include <private/qqmldebugpacket_p.h> #include <private/qqmldebugserviceinterfaces_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h index 7531cd1dff..b14b72d254 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.h @@ -62,7 +62,7 @@ public: QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEnginePrivate *engine); QQmlProfilerAdapter(QQmlProfilerService *service, QQmlTypeLoader *loader); qint64 sendMessages(qint64 until, QList<QByteArray> &messages, - bool trackLocations) Q_DECL_OVERRIDE; + bool trackLocations) override; void receiveData(const QVector<QQmlProfilerData> &new_data, const QQmlProfiler::LocationHash &locations); diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index affd2a417e..a2bc4c09a3 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -41,9 +41,9 @@ #include "qv4profileradapter.h" #include "qqmlprofileradapter.h" #include "qqmlprofilerservicefactory.h" -#include "qqmldebugpacket.h" #include <private/qjsengine_p.h> +#include <private/qqmldebugpacket_p.h> #include <private/qqmldebugpluginmanager_p.h> #include <QtCore/qurl.h> @@ -240,7 +240,7 @@ void QQmlProfilerServiceImpl::startProfiling(QJSEngine *engine, quint64 features QQmlDebugPacket d; - d << m_timer.nsecsElapsed() << (int)Event << (int)StartTrace; + d << m_timer.nsecsElapsed() << static_cast<qint32>(Event) << static_cast<qint32>(StartTrace); bool startedAny = false; if (engine != 0) { const auto range = qAsConst(m_engineProfilers).equal_range(engine); @@ -339,7 +339,8 @@ void QQmlProfilerServiceImpl::sendMessages() QQmlDebugPacket traceEnd; if (m_waitingForStop) { - traceEnd << m_timer.nsecsElapsed() << (int)Event << (int)EndTrace; + traceEnd << m_timer.nsecsElapsed() << static_cast<qint32>(Event) + << static_cast<qint32>(EndTrace); QSet<QJSEngine *> seen; for (QQmlAbstractProfilerAdapter *profiler : qAsConst(m_startTimes)) { @@ -384,7 +385,7 @@ void QQmlProfilerServiceImpl::sendMessages() if (!stillRunning) { // Complete is only sent once, when no engines are running anymore. QQmlDebugPacket ds; - ds << (qint64)-1 << (int)Complete; + ds << static_cast<qint64>(-1) << static_cast<qint32>(Complete); messages << ds.data(); m_waitingForStop = false; } @@ -422,7 +423,7 @@ void QQmlProfilerServiceImpl::messageReceived(const QByteArray &message) int engineId = -1; quint64 features = std::numeric_limits<quint64>::max(); bool enabled; - uint flushInterval = 0; + quint32 flushInterval = 0; stream >> enabled; if (!stream.atEnd()) stream >> engineId; @@ -430,7 +431,9 @@ void QQmlProfilerServiceImpl::messageReceived(const QByteArray &message) stream >> features; if (!stream.atEnd()) { stream >> flushInterval; - m_flushTimer.setInterval(flushInterval); + m_flushTimer.setInterval( + static_cast<int>(qMin(flushInterval, + static_cast<quint32>(std::numeric_limits<int>::max())))); auto timerStart = static_cast<void(QTimer::*)()>(&QTimer::start); if (flushInterval > 0) { connect(&m_flushTimer, &QTimer::timeout, this, &QQmlProfilerServiceImpl::flush); diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h index bbfc32b681..a5e060a1ab 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qqmlconfigurabledebugservice.h" +#include <private/qqmlconfigurabledebugservice_p.h> #include <private/qqmldebugserviceinterfaces_p.h> #include <private/qqmlprofilerdefinitions_p.h> #include <private/qqmlabstractprofileradapter_p.h> @@ -78,30 +78,30 @@ class QQmlProfilerServiceImpl : Q_OBJECT public: - void engineAboutToBeAdded(QJSEngine *engine) Q_DECL_OVERRIDE; - void engineAboutToBeRemoved(QJSEngine *engine) Q_DECL_OVERRIDE; - void engineAdded(QJSEngine *engine) Q_DECL_OVERRIDE; - void engineRemoved(QJSEngine *engine) Q_DECL_OVERRIDE; + void engineAboutToBeAdded(QJSEngine *engine) override; + void engineAboutToBeRemoved(QJSEngine *engine) override; + void engineAdded(QJSEngine *engine) override; + void engineRemoved(QJSEngine *engine) override; - void addGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) Q_DECL_OVERRIDE; - void removeGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) Q_DECL_OVERRIDE; + void addGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) override; + void removeGlobalProfiler(QQmlAbstractProfilerAdapter *profiler) override; void startProfiling(QJSEngine *engine, - quint64 features = std::numeric_limits<quint64>::max()) Q_DECL_OVERRIDE; - void stopProfiling(QJSEngine *engine) Q_DECL_OVERRIDE; + quint64 features = std::numeric_limits<quint64>::max()) override; + void stopProfiling(QJSEngine *engine) override; QQmlProfilerServiceImpl(QObject *parent = 0); - ~QQmlProfilerServiceImpl() Q_DECL_OVERRIDE; + ~QQmlProfilerServiceImpl() override; - void dataReady(QQmlAbstractProfilerAdapter *profiler) Q_DECL_OVERRIDE; + void dataReady(QQmlAbstractProfilerAdapter *profiler) override; signals: void startFlushTimer(); void stopFlushTimer(); protected: - virtual void stateAboutToBeChanged(State state) Q_DECL_OVERRIDE; - virtual void messageReceived(const QByteArray &) Q_DECL_OVERRIDE; + void stateAboutToBeChanged(State state) override; + void messageReceived(const QByteArray &) override; private: friend class QQmlProfilerServiceFactory; diff --git a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h index 5d5b83f7ca..7ac378acd9 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h @@ -53,7 +53,7 @@ #include <private/qv4profiling_p.h> #include <private/qqmlabstractprofileradapter_p.h> -#include "qqmldebugpacket.h" +#include <private/qqmldebugpacket_p.h> #include <QStack> #include <QList> diff --git a/src/plugins/qmltooling/qmldbg_quickprofiler/qmldbg_quickprofiler.pro b/src/plugins/qmltooling/qmldbg_quickprofiler/qmldbg_quickprofiler.pro index 6ca0a184ca..f165917041 100644 --- a/src/plugins/qmltooling/qmldbg_quickprofiler/qmldbg_quickprofiler.pro +++ b/src/plugins/qmltooling/qmldbg_quickprofiler/qmldbg_quickprofiler.pro @@ -5,8 +5,6 @@ PLUGIN_TYPE = qmltooling PLUGIN_CLASS_NAME = QQuickProfilerAdapterFactory load(qt_plugin) -INCLUDEPATH += $$PWD/../shared - SOURCES += \ $$PWD/qquickprofileradapter.cpp \ $$PWD/qquickprofileradapterfactory.cpp @@ -14,7 +12,6 @@ SOURCES += \ HEADERS += \ $$PWD/qquickprofileradapter.h \ $$PWD/qquickprofileradapterfactory.h \ - $$PWD/../shared/qqmldebugpacket.h OTHER_FILES += \ qquickprofileradapter.json diff --git a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp index 35beb0ee0d..a05d11664d 100644 --- a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp @@ -38,8 +38,9 @@ ****************************************************************************/ #include "qquickprofileradapter.h" -#include "qqmldebugpacket.h" + #include <QCoreApplication> +#include <private/qqmldebugpacket_p.h> #include <private/qqmldebugserviceinterfaces_p.h> #include <private/qquickprofiler_p.h> diff --git a/src/plugins/qmltooling/qmldbg_server/qmldbg_server.pro b/src/plugins/qmltooling/qmldbg_server/qmldbg_server.pro index fffdb4c888..d7d24a4d39 100644 --- a/src/plugins/qmltooling/qmldbg_server/qmldbg_server.pro +++ b/src/plugins/qmltooling/qmldbg_server/qmldbg_server.pro @@ -5,13 +5,7 @@ SOURCES += \ $$PWD/qqmldebugserver.cpp HEADERS += \ - $$PWD/qqmldebugserverfactory.h \ - $$PWD/../shared/qqmldebugserver.h \ - $$PWD/../shared/qqmldebugserverconnection.h \ - $$PWD/../shared/qqmldebugpacket.h - -INCLUDEPATH += $$PWD \ - $$PWD/../shared + $$PWD/qqmldebugserverfactory.h OTHER_FILES += \ qqmldebugserver.json diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index 0a7421842a..f87ade568b 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -37,17 +37,17 @@ ** ****************************************************************************/ -#include "qqmldebugserver.h" #include "qqmldebugserverfactory.h" -#include "qqmldebugserverconnection.h" -#include "qqmldebugpacket.h" +#include <private/qqmldebugserver_p.h> +#include <private/qqmldebugserverconnection_p.h> #include <private/qqmldebugservice_p.h> #include <private/qjsengine_p.h> #include <private/qqmlglobal_p.h> #include <private/qqmldebugpluginmanager_p.h> #include <private/qqmldebugserviceinterfaces_p.h> #include <private/qpacketprotocol_p.h> +#include <private/qqmldebugpacket_p.h> #include <QtCore/QAtomicInt> #include <QtCore/QDir> @@ -131,19 +131,19 @@ class QQmlDebugServerImpl : public QQmlDebugServer public: QQmlDebugServerImpl(); - bool blockingMode() const Q_DECL_OVERRIDE; + bool blockingMode() const override; - QQmlDebugService *service(const QString &name) const Q_DECL_OVERRIDE; + QQmlDebugService *service(const QString &name) const override; - void addEngine(QJSEngine *engine) Q_DECL_OVERRIDE; - void removeEngine(QJSEngine *engine) Q_DECL_OVERRIDE; - bool hasEngine(QJSEngine *engine) const Q_DECL_OVERRIDE; + void addEngine(QJSEngine *engine) override; + void removeEngine(QJSEngine *engine) override; + bool hasEngine(QJSEngine *engine) const override; - bool addService(const QString &name, QQmlDebugService *service) Q_DECL_OVERRIDE; - bool removeService(const QString &name) Q_DECL_OVERRIDE; + bool addService(const QString &name, QQmlDebugService *service) override; + bool removeService(const QString &name) override; - bool open(const QVariantHash &configuration) Q_DECL_OVERRIDE; - void setDevice(QIODevice *socket) Q_DECL_OVERRIDE; + bool open(const QVariantHash &configuration) override; + void setDevice(QIODevice *socket) override; void parseArguments(); @@ -767,4 +767,3 @@ QQmlDebugConnector *QQmlDebugServerFactory::create(const QString &key) QT_END_NAMESPACE #include "qqmldebugserver.moc" -#include "moc_qqmldebugserver.cpp" diff --git a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro index 1face1813e..a0e9d06fd5 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro +++ b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro @@ -5,12 +5,7 @@ SOURCES += \ $$PWD/qtcpserverconnection.cpp HEADERS += \ - $$PWD/qtcpserverconnectionfactory.h \ - $$PWD/../shared/qqmldebugserver.h \ - $$PWD/../shared/qqmldebugserverconnection.h - -INCLUDEPATH += $$PWD \ - $$PWD/../shared + $$PWD/qtcpserverconnectionfactory.h OTHER_FILES += \ $$PWD/qtcpserverconnection.json diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp index af4f5292ba..c2aafda863 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp +++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp @@ -38,7 +38,8 @@ ****************************************************************************/ #include "qtcpserverconnectionfactory.h" -#include "qqmldebugserver.h" + +#include <private/qqmldebugserver_p.h> #include <QtCore/qplugin.h> #include <QtNetwork/qtcpserver.h> diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnectionfactory.h b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnectionfactory.h index d3b0e00584..d1282c9d47 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnectionfactory.h +++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnectionfactory.h @@ -40,7 +40,7 @@ #ifndef QTCPSERVERCONNECTIONFACTORY_H #define QTCPSERVERCONNECTIONFACTORY_H -#include "qqmldebugserverconnection.h" +#include <private/qqmldebugserverconnection_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro index 27c51b53c8..119415372b 100644 --- a/src/plugins/qmltooling/qmltooling.pro +++ b/src/plugins/qmltooling/qmltooling.pro @@ -14,24 +14,23 @@ qmldbg_native.depends = packetprotocol qmldbg_server.depends = packetprotocol qtConfig(qml-network) { + qtConfig(localserver): SUBDIRS += qmldbg_local + SUBDIRS += \ - qmldbg_local \ qmldbg_tcp } -qtConfig(qml-interpreter) { - # Services - SUBDIRS += \ - qmldbg_debugger \ - qmldbg_profiler \ - qmldbg_messages \ - qmldbg_nativedebugger - - qmldbg_debugger.depends = packetprotocol - qmldbg_profiler.depends = packetprotocol - qmldbg_messages.depends = packetprotocol - qmldbg_nativedebugger.depends = packetprotocol -} +# Services +SUBDIRS += \ + qmldbg_messages \ + qmldbg_profiler \ + qmldbg_debugger \ + qmldbg_nativedebugger + +qmldbg_messages.depends = packetprotocol +qmldbg_profiler.depends = packetprotocol +qmldbg_debugger.depends = packetprotocol +qmldbg_nativedebugger.depends = packetprotocol qtHaveModule(quick) { SUBDIRS += \ diff --git a/src/plugins/qmltooling/shared/qqmlconfigurabledebugservice.h b/src/plugins/qmltooling/shared/qqmlconfigurabledebugservice.h deleted file mode 100644 index 85ff9b182f..0000000000 --- a/src/plugins/qmltooling/shared/qqmlconfigurabledebugservice.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#ifndef QQMLCONFIGURABLEDEBUGSEVICE_H -#define QQMLCONFIGURABLEDEBUGSEVICE_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qqmldebugservice_p.h> -#include <private/qqmldebugconnector_p.h> -#include <QtCore/qmutex.h> - -QT_BEGIN_NAMESPACE - -template <class Base> -class QQmlConfigurableDebugService : public Base -{ -protected: - QQmlConfigurableDebugService(float version, QObject *parent = 0) : - Base(version, parent), m_configMutex(QMutex::Recursive) - { - init(); - } - - void stopWaiting() - { - QMutexLocker lock(&m_configMutex); - m_waitingForConfiguration = false; - for (QJSEngine *engine : qAsConst(m_waitingEngines)) - emit Base::attachedToEngine(engine); - m_waitingEngines.clear(); - } - - void init() - { - QMutexLocker lock(&m_configMutex); - // If we're not enabled or not blocking, don't wait for configuration - m_waitingForConfiguration = (Base::state() == QQmlDebugService::Enabled && - QQmlDebugConnector::instance()->blockingMode()); - } - - void stateChanged(QQmlDebugService::State newState) Q_DECL_OVERRIDE - { - if (newState != QQmlDebugService::Enabled) - stopWaiting(); - else - init(); - } - - void engineAboutToBeAdded(QJSEngine *engine) Q_DECL_OVERRIDE - { - QMutexLocker lock(&m_configMutex); - if (m_waitingForConfiguration) - m_waitingEngines.append(engine); - else - emit Base::attachedToEngine(engine); - } - - QMutex m_configMutex; - QList<QJSEngine *> m_waitingEngines; - bool m_waitingForConfiguration; -}; - -QT_END_NAMESPACE - -#endif // QQMLCONFIGURABLEDEBUGSEVICE_H diff --git a/src/plugins/qmltooling/shared/qqmldebugserver.h b/src/plugins/qmltooling/shared/qqmldebugserver.h deleted file mode 100644 index 109f1e246c..0000000000 --- a/src/plugins/qmltooling/shared/qqmldebugserver.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQMLDEBUGSERVER_H -#define QQMLDEBUGSERVER_H - -#include <private/qqmldebugconnector_p.h> -#include <private/qtqmlglobal_p.h> - -#include <QtCore/QIODevice> - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -QT_BEGIN_NAMESPACE - -class QQmlDebugServer : public QQmlDebugConnector -{ - Q_OBJECT -public: - virtual void setDevice(QIODevice *socket) = 0; -}; - -QT_END_NAMESPACE - -#endif // QQMLDEBUGSERVER_H diff --git a/src/plugins/qmltooling/shared/qqmldebugserverconnection.h b/src/plugins/qmltooling/shared/qqmldebugserverconnection.h deleted file mode 100644 index 3fac15acb2..0000000000 --- a/src/plugins/qmltooling/shared/qqmldebugserverconnection.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQMLDEBUGSERVERCONNECTION_H -#define QQMLDEBUGSERVERCONNECTION_H - -#include <private/qtqmlglobal_p.h> -#include <QtCore/qobject.h> - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -QT_BEGIN_NAMESPACE - - -class QQmlDebugServer; -class QQmlDebugServerConnection : public QObject -{ - Q_OBJECT -public: - QQmlDebugServerConnection(QObject *parent = 0) : QObject(parent) {} - - virtual void setServer(QQmlDebugServer *server) = 0; - virtual bool setPortRange(int portFrom, int portTo, bool block, const QString &hostaddress) = 0; - virtual bool setFileName(const QString &fileName, bool block) = 0; - virtual bool isConnected() const = 0; - virtual void disconnect() = 0; - virtual void waitForConnection() = 0; - virtual void flush() = 0; -}; - -class QQmlDebugServerConnectionFactory : public QObject -{ - Q_OBJECT -public: - virtual QQmlDebugServerConnection *create(const QString &key) = 0; -}; - -#define QQmlDebugServerConnectionFactory_iid "org.qt-project.Qt.QQmlDebugServerConnectionFactory" -Q_DECLARE_INTERFACE(QQmlDebugServerConnectionFactory, QQmlDebugServerConnectionFactory_iid) - -QT_END_NAMESPACE - -#endif // QQMLDEBUGSERVERCONNECTION_H |