Debugger: Disable breakpoint relocation in JS
authorKai Koehne <kai.koehne@nokia.com>
Tue, 22 Nov 2011 14:32:46 +0000 (15:32 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 29 Nov 2011 14:30:20 +0000 (15:30 +0100)
Because we pass scripts lazily to v8, breakpoints can be relocated to
lines unexpected to the user. Therefore disable breakpoint relocation
alltogether for the time being.

Change-Id: I34b4b9b1267270014c3a17cb6cad1e3c7eded074
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
src/declarative/qml/v8/qv8engine.cpp
tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp

index 7c4ebff..e5bb26c 100644 (file)
@@ -130,8 +130,10 @@ QV8Engine::QV8Engine(QJSEngine* qq, QJSEngine::ContextOwnership ownership)
     qMetaTypeId<QList<int> >();
 
     QByteArray v8args = qgetenv("V8ARGS");
-    if (!v8args.isEmpty())
-        v8::V8::SetFlagsFromString(v8args.constData(), v8args.length());
+    // change default v8 behaviour to not relocate breakpoints across lines
+    if (!v8args.contains("breakpoint_relocation"))
+        v8args.append(" --nobreakpoint_relocation");
+    v8::V8::SetFlagsFromString(v8args.constData(), v8args.length());
 
     v8::HandleScope handle_scope;
     qPersistentRegister(m_context);
index 1c94617..0646abb 100644 (file)
@@ -1062,7 +1062,7 @@ void tst_QDeclarativeDebugJS::gc()
     //void gc()
 
     QVERIFY(init());
-    client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(TEST_JSFILE), 2, -1, true);
+    client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(TEST_JSFILE), 43, -1, true);
     client->startDebugging();
     QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(stopped())));
 
@@ -1172,6 +1172,7 @@ void tst_QDeclarativeDebugJS::setBreakpointInScriptOnComment()
 
     client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(TEST_JSFILE), sourceLine, -1, true);
     client->startDebugging();
+    QEXPECT_FAIL("", "Relocation of breakpoints is disabled right now", Abort);
     QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(stopped())));
 
     QString jsonString(client->response);
@@ -1193,6 +1194,7 @@ void tst_QDeclarativeDebugJS::setBreakpointInScriptOnEmptyLine()
 
     client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(TEST_JSFILE), sourceLine, -1, true);
     client->startDebugging();
+    QEXPECT_FAIL("", "Relocation of breakpoints is disabled right now", Abort);
     QVERIFY(QDeclarativeDebugTest::waitForSignal(client, SIGNAL(stopped())));
 
     QString jsonString(client->response);
@@ -1271,8 +1273,8 @@ void tst_QDeclarativeDebugJS::changeBreakpoint()
 {
     //void changeBreakpoint(int breakpoint, bool enabled = false, QString condition = QString(), int ignoreCount = -1)
 
-    int sourceLine1 = 77;
-    int sourceLine2 = 78;
+    int sourceLine1 = 78;
+    int sourceLine2 = 79;
     QVERIFY(init());
 
     client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(TEST_QMLFILE), sourceLine1, -1, true);
@@ -1385,8 +1387,8 @@ void tst_QDeclarativeDebugJS::clearBreakpoint()
 {
     //void clearBreakpoint(int breakpoint);
 
-    int sourceLine1 = 77;
-    int sourceLine2 = 78;
+    int sourceLine1 = 78;
+    int sourceLine2 = 79;
     QVERIFY(init());
 
     client->setBreakpoint(QLatin1String(SCRIPT), QLatin1String(TEST_QMLFILE), sourceLine1, -1, true);