From: Kai Koehne Date: Tue, 22 Nov 2011 14:32:46 +0000 (+0100) Subject: Debugger: Disable breakpoint relocation in JS X-Git-Tag: qt-v5.0.0-alpha1~991 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa59f1e675ca39990e56380e659e9e6490370c83;p=profile%2Fivi%2Fqtdeclarative.git Debugger: Disable breakpoint relocation in JS 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 --- diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp index 7c4ebff..e5bb26c 100644 --- a/src/declarative/qml/v8/qv8engine.cpp +++ b/src/declarative/qml/v8/qv8engine.cpp @@ -130,8 +130,10 @@ QV8Engine::QV8Engine(QJSEngine* qq, QJSEngine::ContextOwnership ownership) qMetaTypeId >(); 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); diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp b/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp index 1c94617..0646abb 100644 --- a/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp +++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp @@ -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);