aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2012-03-16 21:00:42 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-19 14:35:55 +0100
commit69835e0f3477cd85dab8ddce672e6f1c792d8bfc (patch)
tree60cfc7d7dd6104edf1b0a298d938045c6e5860e0
parentbfedb27838864e7acddebc6c0f731d617c3d1c22 (diff)
Debugger: Always disable v4 optimizer if v8 debugger is activated
Don't rely on QML_DISABLE_OPTIMIZER environment variable being set. Change-Id: Ib1a9d83eb9698adcd3c9a5bbcc74cba382836078 Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
-rw-r--r--src/qml/debugger/qv8debugservice.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml4
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp24
3 files changed, 26 insertions, 4 deletions
diff --git a/src/qml/debugger/qv8debugservice.cpp b/src/qml/debugger/qv8debugservice.cpp
index a6aeda31d5..7d54a59ac0 100644
--- a/src/qml/debugger/qv8debugservice.cpp
+++ b/src/qml/debugger/qv8debugservice.cpp
@@ -42,6 +42,7 @@
#include "qv8debugservice_p.h"
#include "qqmldebugservice_p_p.h"
#include <private/qjsconverter_impl_p.h>
+#include <private/qv4compiler_p.h>
#include <private/qv8engine_p.h>
#include <QtCore/QHash>
@@ -192,6 +193,7 @@ void QV8DebugService::init()
Q_D(QV8DebugService);
v8::Debug::SetMessageHandler2(DebugMessageHandler);
v8::Debug::SetDebugMessageDispatchHandler(DebugMessageDispatchHandler);
+ QV4Compiler::enableV4(false);
d->initializeMutex.unlock();
}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml b/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml
index 1f0f9e22c9..0a1a5eb610 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml
+++ b/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml
@@ -47,7 +47,9 @@ Item {
Component.onCompleted: {
//Comment
- var b = 6;
+ var x = 6;
}
+
+ width : height + 2
}
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index f4a9a4add7..8293ec6cda 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -191,6 +191,7 @@ private slots:
void setBreakpointInScriptInDifferentFile();
void setBreakpointInScriptOnComment();
void setBreakpointInScriptOnEmptyLine();
+ void setBreakpointInScriptOnOptimizedBinding();
void setBreakpointInScriptWithCondition();
//void setBreakpointInFunction(); //NOT SUPPORTED
void setBreakpointOnEvent();
@@ -1019,9 +1020,6 @@ bool tst_QQmlDebugJS::init(const QString &qmlFile, bool blockMode)
process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene");
client = new QJSDebugClient(connection);
- QStringList systemEnvironment = QProcess::systemEnvironment();
- systemEnvironment << "QML_DISABLE_OPTIMIZER=1";
- process->setEnvironment(systemEnvironment);
if (blockMode)
process->start(QStringList() << QLatin1String(BLOCKMODE) << testFile(qmlFile));
else
@@ -1295,6 +1293,26 @@ void tst_QQmlDebugJS::setBreakpointInScriptOnEmptyLine()
QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(BREAKPOINTRELOCATION_QMLFILE));
}
+void tst_QQmlDebugJS::setBreakpointInScriptOnOptimizedBinding()
+{
+ //void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
+
+ int sourceLine = 52;
+ QVERIFY(init(BREAKPOINTRELOCATION_QMLFILE));
+
+ client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QLatin1String(BREAKPOINTRELOCATION_QMLFILE), sourceLine, -1, true);
+ client->connect();
+ QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped())));
+
+ QString jsonString(client->response);
+ QVariantMap value = client->parser.call(QJSValueList() << QJSValue(jsonString)).toVariant().toMap();
+
+ QVariantMap body = value.value("body").toMap();
+
+ QCOMPARE(body.value("sourceLine").toInt(), sourceLine);
+ QCOMPARE(QFileInfo(body.value("script").toMap().value("name").toString()).fileName(), QLatin1String(BREAKPOINTRELOCATION_QMLFILE));
+}
+
void tst_QQmlDebugJS::setBreakpointInScriptWithCondition()
{
//void setBreakpoint(QString type, QString target, int line = -1, int column = -1, bool enabled = false, QString condition = QString(), int ignoreCount = -1)