From 21e50d82df21f3cb21c14b0f0af12b6ae23f4ea4 Mon Sep 17 00:00:00 2001 From: Aurindam Jana <aurindam.jana@nokia.com> Date: Wed, 24 Aug 2011 17:32:12 +0200 Subject: [PATCH] Debugger: Set breakpoints on actual locations in code This fix sets moves breakpoints on commented lines to the next executable line. Change-Id: Ie9ca8a7c6e0360ce4a916053ef7aedd1cc28484d Reviewed-on: http://codereview.qt.nokia.com/3525 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com> --- src/plugins/debugger/qml/qmlv8debuggerclient.cpp | 9 ++------- src/plugins/debugger/qml/qscriptdebuggerclient.cpp | 7 +++---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp index 28642c2760d..157c028c6a6 100644 --- a/src/plugins/debugger/qml/qmlv8debuggerclient.cpp +++ b/src/plugins/debugger/qml/qmlv8debuggerclient.cpp @@ -416,12 +416,8 @@ void QmlV8DebuggerClient::messageReceived(const QByteArray &data) QString event(value.findChild("event").toVariant().toString()); if (event == "break") { - //Check if this break is due to a breakpoint - QList<QVariant> breakpoints = value.findChild("body").findChild("breakpoints").toVariant().toList(); - if (breakpoints.count()) { - d->engine->inferiorSpontaneousStop(); - listBreakpoints(); - } + d->engine->inferiorSpontaneousStop(); + listBreakpoints(); } } } @@ -577,7 +573,6 @@ void QmlV8DebuggerClient::updateBreakpoints(QByteArray &message) { JsonValue response(message); - JsonValue refs = response.findChild("refs"); JsonValue body = response.findChild("body"); QList<JsonValue> breakpoints = body.findChild("breakpoints").children(); diff --git a/src/plugins/debugger/qml/qscriptdebuggerclient.cpp b/src/plugins/debugger/qml/qscriptdebuggerclient.cpp index dc815ee66de..755485200ec 100644 --- a/src/plugins/debugger/qml/qscriptdebuggerclient.cpp +++ b/src/plugins/debugger/qml/qscriptdebuggerclient.cpp @@ -218,10 +218,6 @@ void QScriptDebuggerClient::insertBreakpoint(BreakpointModelId id) bp.lineNumber = handler->lineNumber(id); bp.functionName = handler->functionName(id).toUtf8(); d->breakpoints.insert(bp); - - if (handler->state(id) == BreakpointInsertProceeding) { - handler->notifyBreakpointInsertOk(id); - } } void QScriptDebuggerClient::removeBreakpoint(BreakpointModelId id) @@ -412,6 +408,9 @@ void QScriptDebuggerClient::messageReceived(const QByteArray &data) BreakHandler *handler = d->engine->breakHandler(); foreach (BreakpointModelId id, handler->engineBreakpointIds(d->engine)) { QString processedFilename = handler->fileName(id); + QTC_ASSERT(handler->state(id) == BreakpointInsertProceeding,/**/); + handler->notifyBreakpointInsertOk(id); + if (processedFilename == file && handler->lineNumber(id) == line) { QTC_ASSERT(handler->state(id) == BreakpointInserted,/**/); BreakpointResponse br = handler->response(id); -- GitLab