From 4e1452fd59ca4d66e1f2bc3b73a042d562488a0d Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Tue, 16 Nov 2010 18:14:00 +0100 Subject: [PATCH] debugger: handle disabled breakpoints on debugger startup again --- src/plugins/debugger/breakhandler.cpp | 48 +++++++++++++++----------- src/plugins/debugger/breakhandler.h | 1 + src/plugins/debugger/gdb/gdbengine.cpp | 1 - 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index b6b6a14ed54..d73a34ad46b 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -592,6 +592,7 @@ static bool isAllowedTransition(BreakpointState from, BreakpointState to) void BreakHandler::setState(BreakpointId id, BreakpointState state) { Iterator it = m_storage.find(id); + //qDebug() << "BREAKPOINT STATE TRANSITION" << id << it->state << state; QTC_ASSERT(it != m_storage.end(), return); QTC_ASSERT(isAllowedTransition(it->state, state), qDebug() << "UNEXPECTED BREAKPOINT STATE TRANSITION" @@ -605,45 +606,33 @@ void BreakHandler::setState(BreakpointId id, BreakpointState state) it->state = state; } -static bool needsChange(const BreakpointParameters &data, - const BreakpointResponse &response) -{ - if (!data.conditionsMatch(response.condition)) - return true; - if (data.ignoreCount != response.ignoreCount) - return true; - if (data.enabled != response.enabled) - return true; - return false; -} - void BreakHandler::notifyBreakpointInsertProceeding(BreakpointId id) { - QTC_ASSERT(state(id)== BreakpointInsertRequested, /**/); + QTC_ASSERT(state(id) == BreakpointInsertRequested, /**/); setState(id, BreakpointInsertProceeding); } void BreakHandler::notifyBreakpointInsertOk(BreakpointId id) { - QTC_ASSERT(state(id)== BreakpointInsertProceeding, /**/); + QTC_ASSERT(state(id) == BreakpointInsertProceeding, /**/); setState(id, BreakpointInserted); ConstIterator it = m_storage.find(id); QTC_ASSERT(it != m_storage.end(), return); - if (needsChange(it->data, it->response)) { - setState(id, BreakpointChangeRequested); - scheduleSynchronization(); - } + //if (it0->needsChange(it->data, it->response)) { + // setState(id, BreakpointChangeRequested); + // scheduleSynchronization(); + //} } void BreakHandler::notifyBreakpointInsertFailed(BreakpointId id) { - QTC_ASSERT(state(id)== BreakpointInsertProceeding, /**/); + QTC_ASSERT(state(id) == BreakpointInsertProceeding, /**/); setState(id, BreakpointDead); } void BreakHandler::notifyBreakpointRemoveProceeding(BreakpointId id) { - QTC_ASSERT(state(id)== BreakpointRemoveRequested, /**/); + QTC_ASSERT(state(id) == BreakpointRemoveRequested, /**/); setState(id, BreakpointRemoveProceeding); } @@ -911,6 +900,14 @@ void BreakHandler::setResponse(BreakpointId id, const BreakpointResponse &data) QTC_ASSERT(it != m_storage.end(), return); it->response = data; updateMarker(id); + //qDebug() << "SET RESPONSE: " << id << it->state << it->needsChange(); + if (it->state == BreakpointChangeProceeding + || it->state == BreakpointInsertProceeding) { + if (it->needsChange()) + setState(id, BreakpointChangeRequested); + else + setState(id, BreakpointInserted); + } } void BreakHandler::setBreakpointData(BreakpointId id, const BreakpointParameters &data) @@ -967,6 +964,17 @@ static QString stateToString(BreakpointState state) } }; +bool BreakHandler::BreakpointItem::needsChange() const +{ + if (!data.conditionsMatch(response.condition)) + return true; + if (data.ignoreCount != response.ignoreCount) + return true; + if (data.enabled != response.enabled) + return true; + return false; +} + bool BreakHandler::BreakpointItem::isLocatedAt (const QString &fileName, int lineNumber, bool useMarkerPosition) const { diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index 7adbbf4d718..0bc1de3efd8 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -177,6 +177,7 @@ private: void destroyMarker(); bool isPending() const { return response.pending; } + bool needsChange() const; bool isLocatedAt(const QString &fileName, int lineNumber, bool useMarkerPosition) const; QString toToolTip() const; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 5c9c2a91458..2b71b9b2e67 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -2103,7 +2103,6 @@ void GdbEngine::updateBreakpointDataFromOutput(BreakpointId id, const GdbMi &bkp response.fileName = name; breakHandler()->setResponse(id, response); - breakHandler()->notifyBreakpointInsertOk(id); } QString GdbEngine::breakLocation(const QString &file) const -- GitLab