diff options
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp | 75 |
1 files changed, 36 insertions, 39 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp index e3b2bc0870..5b96163b48 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlnativedebugservice.cpp @@ -143,15 +143,15 @@ public: void BreakPointHandler::handleSetBreakpoint(QJsonObject *response, const QJsonObject &arguments) { TRACE_PROTOCOL("SET BREAKPOINT" << arguments); - QString type = arguments.value(QStringLiteral("type")).toString(); + QString type = arguments.value(QLatin1String("type")).toString(); - QString fileName = arguments.value(QStringLiteral("file")).toString(); + QString fileName = arguments.value(QLatin1String("file")).toString(); if (fileName.isEmpty()) { setError(response, QStringLiteral("breakpoint has no file name")); return; } - int line = arguments.value(QStringLiteral("line")).toInt(-1); + int line = arguments.value(QLatin1String("line")).toInt(-1); if (line < 0) { setError(response, QStringLiteral("breakpoint has an invalid line number")); return; @@ -161,9 +161,9 @@ void BreakPointHandler::handleSetBreakpoint(QJsonObject *response, const QJsonOb bp.id = m_lastBreakpoint++; bp.fileName = fileName.mid(fileName.lastIndexOf('/') + 1); bp.lineNumber = line; - bp.enabled = arguments.value(QStringLiteral("enabled")).toBool(true); - bp.condition = arguments.value(QStringLiteral("condition")).toString(); - bp.ignoreCount = arguments.value(QStringLiteral("ignorecount")).toInt(); + bp.enabled = arguments.value(QLatin1String("enabled")).toBool(true); + bp.condition = arguments.value(QLatin1String("condition")).toString(); + bp.ignoreCount = arguments.value(QLatin1String("ignorecount")).toInt(); m_breakPoints.append(bp); m_haveBreakPoints = true; @@ -174,7 +174,7 @@ void BreakPointHandler::handleSetBreakpoint(QJsonObject *response, const QJsonOb void BreakPointHandler::handleRemoveBreakpoint(QJsonObject *response, const QJsonObject &arguments) { - int id = arguments.value(QStringLiteral("id")).toInt(); + int id = arguments.value(QLatin1String("id")).toInt(); removeBreakPoint(id); response->insert(QStringLiteral("id"), id); } @@ -208,7 +208,7 @@ private: void handleDebuggerDeleted(QObject *debugger); - QV4::ReturnedValue evaluateExpression(QV4::Scope &scope, const QString &expression); + void evaluateExpression(QV4::Scope &scope, const QString &expression); bool checkCondition(const QString &expression); QStringList breakOnSignals; @@ -241,12 +241,11 @@ private: bool NativeDebugger::checkCondition(const QString &expression) { QV4::Scope scope(m_engine); - QV4::ReturnedValue result = evaluateExpression(scope, expression); - QV4::ScopedValue val(scope, result); - return val->booleanValue(); + evaluateExpression(scope, expression); + return scope.result.booleanValue(); } -QV4::ReturnedValue NativeDebugger::evaluateExpression(QV4::Scope &scope, const QString &expression) +void NativeDebugger::evaluateExpression(QV4::Scope &scope, const QString &expression) { m_runningJob = true; @@ -261,12 +260,10 @@ QV4::ReturnedValue NativeDebugger::evaluateExpression(QV4::Scope &scope, const Q // That is a side-effect of inheritContext. script.inheritContext = true; script.parse(); - QV4::ScopedValue result(scope); if (!m_engine->hasException) - result = script.run(); + scope.result = script.run(); m_runningJob = false; - return result->asReturnedValue(); } NativeDebugger::NativeDebugger(QQmlNativeDebugServiceImpl *service, QV4::ExecutionEngine *engine) @@ -301,19 +298,19 @@ void NativeDebugger::signalEmitted(const QString &signal) void NativeDebugger::handleCommand(QJsonObject *response, const QString &cmd, const QJsonObject &arguments) { - if (cmd == QStringLiteral("backtrace")) + if (cmd == QLatin1String("backtrace")) handleBacktrace(response, arguments); - else if (cmd == QStringLiteral("variables")) + else if (cmd == QLatin1String("variables")) handleVariables(response, arguments); - else if (cmd == QStringLiteral("expressions")) + else if (cmd == QLatin1String("expressions")) handleExpressions(response, arguments); - else if (cmd == QStringLiteral("stepin")) + else if (cmd == QLatin1String("stepin")) handleContinue(response, StepIn); - else if (cmd == QStringLiteral("stepout")) + else if (cmd == QLatin1String("stepout")) handleContinue(response, StepOut); - else if (cmd == QStringLiteral("stepover")) + else if (cmd == QLatin1String("stepover")) handleContinue(response, StepOver); - else if (cmd == QStringLiteral("continue")) + else if (cmd == QLatin1String("continue")) handleContinue(response, NotStepping); } @@ -334,7 +331,7 @@ static void decodeContext(const QString &context, QV4::ExecutionContext **execut void NativeDebugger::handleBacktrace(QJsonObject *response, const QJsonObject &arguments) { - int limit = arguments.value(QStringLiteral("limit")).toInt(0); + int limit = arguments.value(QLatin1String("limit")).toInt(0); QJsonArray frameArray; QV4::ExecutionContext *executionContext = m_engine->currentContext; @@ -374,7 +371,7 @@ void Collector::collect(QJsonArray *out, const QString &parentIName, const QStri dict.insert(QStringLiteral("iname"), iname); dict.insert(QStringLiteral("name"), nonEmptyName); - QV4::ScopedValue typeString(scope, QV4::Runtime::typeofValue(m_engine, value)); + QV4::ScopedValue typeString(scope, QV4::Runtime::method_typeofValue(m_engine, value)); dict.insert(QStringLiteral("type"), typeString->toQStringNoThrow()); switch (value.type()) { @@ -463,7 +460,7 @@ void NativeDebugger::handleVariables(QJsonObject *response, const QJsonObject &a { TRACE_PROTOCOL("Build variables"); QV4::ExecutionContext *executionContext = 0; - decodeContext(arguments.value(QStringLiteral("context")).toString(), &executionContext); + decodeContext(arguments.value(QLatin1String("context")).toString(), &executionContext); if (!executionContext) { setError(response, QStringLiteral("No execution context passed")); return; @@ -478,7 +475,7 @@ void NativeDebugger::handleVariables(QJsonObject *response, const QJsonObject &a TRACE_PROTOCOL("Engine: " << engine); Collector collector(engine); - QJsonArray expanded = arguments.value(QStringLiteral("expanded")).toArray(); + QJsonArray expanded = arguments.value(QLatin1String("expanded")).toArray(); foreach (const QJsonValue &ex, expanded) collector.m_expanded.append(ex.toString()); TRACE_PROTOCOL("Expanded: " << collector.m_expanded); @@ -515,7 +512,7 @@ void NativeDebugger::handleExpressions(QJsonObject *response, const QJsonObject { TRACE_PROTOCOL("Evaluate expressions"); QV4::ExecutionContext *executionContext = 0; - decodeContext(arguments.value(QStringLiteral("context")).toString(), &executionContext); + decodeContext(arguments.value(QLatin1String("context")).toString(), &executionContext); if (!executionContext) { setError(response, QStringLiteral("No execution context passed")); return; @@ -530,7 +527,7 @@ void NativeDebugger::handleExpressions(QJsonObject *response, const QJsonObject TRACE_PROTOCOL("Engines: " << engine << m_engine); Collector collector(engine); - QJsonArray expanded = arguments.value(QStringLiteral("expanded")).toArray(); + QJsonArray expanded = arguments.value(QLatin1String("expanded")).toArray(); foreach (const QJsonValue &ex, expanded) collector.m_expanded.append(ex.toString()); TRACE_PROTOCOL("Expanded: " << collector.m_expanded); @@ -538,15 +535,15 @@ void NativeDebugger::handleExpressions(QJsonObject *response, const QJsonObject QJsonArray output; QV4::Scope scope(engine); - QJsonArray expressions = arguments.value(QStringLiteral("expressions")).toArray(); + QJsonArray expressions = arguments.value(QLatin1String("expressions")).toArray(); foreach (const QJsonValue &expr, expressions) { - QString expression = expr.toObject().value(QStringLiteral("expression")).toString(); - QString name = expr.toObject().value(QStringLiteral("name")).toString(); + QString expression = expr.toObject().value(QLatin1String("expression")).toString(); + QString name = expr.toObject().value(QLatin1String("name")).toString(); TRACE_PROTOCOL("Evaluate expression: " << expression); m_runningJob = true; - QV4::ReturnedValue eval = evaluateExpression(scope, expression); - QV4::ScopedValue result(scope, eval); + evaluateExpression(scope, expression); + QV4::ScopedValue result(scope, scope.result); m_runningJob = false; if (result->isUndefined()) { @@ -764,7 +761,7 @@ void QQmlNativeDebugServiceImpl::stateAboutToBeChanged(QQmlDebugService::State s if (state == Enabled) { foreach (NativeDebugger *debugger, m_debuggers) { QV4::ExecutionEngine *engine = debugger->engine(); - if (!engine->debugger) + if (!engine->debugger()) engine->setDebugger(debugger); } } @@ -776,14 +773,14 @@ void QQmlNativeDebugServiceImpl::messageReceived(const QByteArray &message) TRACE_PROTOCOL("Native message received: " << message); QJsonObject request = QJsonDocument::fromJson(message).object(); QJsonObject response; - QJsonObject arguments = request.value(QStringLiteral("arguments")).toObject(); - QString cmd = request.value(QStringLiteral("command")).toString(); + QJsonObject arguments = request.value(QLatin1String("arguments")).toObject(); + QString cmd = request.value(QLatin1String("command")).toString(); - if (cmd == QStringLiteral("setbreakpoint")) { + if (cmd == QLatin1String("setbreakpoint")) { m_breakHandler->handleSetBreakpoint(&response, arguments); - } else if (cmd == QStringLiteral("removebreakpoint")) { + } else if (cmd == QLatin1String("removebreakpoint")) { m_breakHandler->handleRemoveBreakpoint(&response, arguments); - } else if (cmd == QStringLiteral("echo")) { + } else if (cmd == QLatin1String("echo")) { response.insert(QStringLiteral("result"), arguments); } else { foreach (NativeDebugger *debugger, m_debuggers) |