diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp index ece39457dd5f51cb753e457eb28ecf6c7bdce2f4..269e37d7c0ad21d9885dd49e2633ae7e80f2924e 100644 --- a/src/plugins/debugger/breakpoint.cpp +++ b/src/plugins/debugger/breakpoint.cpp @@ -60,7 +60,7 @@ static quint64 nextBPId() { } BreakpointData::BreakpointData() : - id(nextBPId()), enabled(true), + id(nextBPId()), uiDirty(false), enabled(true), pending(true), type(BreakpointByFileAndLine), ignoreCount(0), lineNumber(0), address(0), useFullPath(false), @@ -102,6 +102,7 @@ BreakpointData::~BreakpointData() void BreakpointData::clear() { + uiDirty = false; pending = true; bpNumber.clear(); bpCondition.clear(); diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h index ff117bb103ba33f9a1298e0f37e93388feaf48be..e155457ffd2ba18fee3f67f57f38d7dfd9f84e21 100644 --- a/src/plugins/debugger/breakpoint.h +++ b/src/plugins/debugger/breakpoint.h @@ -97,6 +97,8 @@ private: public: quint64 id; + BreakpointState state; + bool uiDirty; // ui has changed stuff bool enabled; // Should we talk to the debugger engine? bool pending; // Does the debugger engine know about us already? diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index 1f5a3ddfe0921112cef9c01477d4a7a44c6fd7e1..14aa6588b899537019832bf41797d008536737f6 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -519,6 +519,7 @@ void BreakWindow::editBreakpoints(const QModelIndexList &list) data->condition = newCondition.toLatin1(); data->ignoreCount = newIgnoreCount.toInt(); data->threadSpec = newThreadSpec.toLatin1(); + data->uiDirty = true; } synchronizeBreakpoints(); } diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 927a2c5baea094825cac3762cbdcb206842662bb..425d56fbbf0345feea29a4f08b9e819ef6c04afa 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -1220,6 +1220,27 @@ void DebuggerEngine::updateAll() void DebuggerEngine::attemptBreakpointSynchronization() { + for (int i = 0; i < breakHandler()->size(); i++) { + BreakpointData *bp = breakHandler()->at(i); + if (!m_breakpoints.contains(bp->id)) { + m_breakpoints.insert(bp->id, bp); + } + QTC_ASSERT(m_breakpoints[bp->id] == bp, qDebug() << "corrupted breakpoint map"); + if (bp->uiDirty) { + bp->uiDirty = false; + bp->state = BreakpointChangeRequested; + changeBreakpoint(*bp); + } + } + + Breakpoints bps = breakHandler()->takeRemovedBreakpoints(); + foreach (BreakpointData *bp, bps) { + if (m_breakpoints.contains(bp->id)) { + bp->state = BreakpointRemovalRequested; + removeBreakpoint(bp->id); + } else + delete bp; + } } bool DebuggerEngine::acceptsBreakpoint(const BreakpointData *) @@ -1227,6 +1248,86 @@ bool DebuggerEngine::acceptsBreakpoint(const BreakpointData *) return true; } +void DebuggerEngine::addBreakpoint(const BreakpointData &) +{ +} + +void DebuggerEngine::notifyAddBreakpointOk(quint64 id) +{ + BreakpointData *bp = m_breakpoints[id]; + if (!bp) + return; + bp->state = BreakpointOk; +} + +void DebuggerEngine::notifyAddBreakpointFailed(quint64 id) +{ + BreakpointData *bp = m_breakpoints[id]; + if (!bp) + return; + bp->state = BreakpointDead; +} + +void DebuggerEngine::removeBreakpoint(quint64) +{ +} + +void DebuggerEngine::notifyRemoveBreakpointOk(quint64 id) +{ + BreakpointData *bp = m_breakpoints.take(id); + if (!bp) + return; + bp->state = BreakpointDead; + delete bp; +} + +void DebuggerEngine::notifyRemoveBreakpointFailed(quint64 id) +{ + BreakpointData *bp = m_breakpoints[id]; + if (!bp) + return; + bp->state = BreakpointOk; +} + +void DebuggerEngine::changeBreakpoint(const BreakpointData &) +{ +} + +void DebuggerEngine::notifyChangeBreakpointOk(quint64 id) +{ + BreakpointData *bp = m_breakpoints[id]; + if (!bp) + return; + bp->state = BreakpointOk; +} + +void DebuggerEngine::notifyChangeBreakpointFailed(quint64 id) +{ + BreakpointData *bp = m_breakpoints[id]; + if (!bp) + return; + bp->state = BreakpointDead; +} + +void DebuggerEngine::notifyBreakpointAdjusted(const BreakpointData & rbp) +{ + BreakpointData *bp = m_breakpoints[rbp.id]; + if (!bp) + return; + bp->bpNumber = rbp.bpNumber; + bp->bpCondition = rbp.bpCondition; + bp->bpIgnoreCount = rbp.bpIgnoreCount; + bp->bpFileName = rbp.bpFileName; + bp->bpFullName = rbp.bpFullName; + bp->bpLineNumber = rbp.bpLineNumber; + bp->bpCorrectedLineNumber = rbp.bpCorrectedLineNumber; + bp->bpThreadSpec = rbp.bpThreadSpec; + bp->bpFuncName = rbp.bpFuncName; + bp->bpAddress = rbp.bpAddress; + bp->bpMultiple = rbp.bpMultiple; + bp->bpEnabled = rbp.bpEnabled; +} + void DebuggerEngine::selectThread(int) { } diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 43d3c0da25dd5dec122c8837ce522a816e5616ca..3c91236638c4b2ef088f96a1e672e2debb46c8f7 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -186,6 +186,18 @@ public: virtual void attemptBreakpointSynchronization(); virtual bool acceptsBreakpoint(const Internal::BreakpointData *); + + virtual void addBreakpoint(const Internal::BreakpointData &bp); + virtual void notifyAddBreakpointOk(quint64 id); + virtual void notifyAddBreakpointFailed(quint64 id); + virtual void removeBreakpoint(quint64 id); + virtual void notifyRemoveBreakpointOk(quint64 id); + virtual void notifyRemoveBreakpointFailed(quint64 id); + virtual void changeBreakpoint(const Internal::BreakpointData &bp); + virtual void notifyChangeBreakpointOk(quint64 id); + virtual void notifyChangeBreakpointFailed(quint64 id); + virtual void notifyBreakpointAdjusted(const Internal::BreakpointData &bp); + virtual void selectThread(int index); virtual void assignValueInDebugger(const Internal::WatchData *data, @@ -342,6 +354,7 @@ private: friend class DebuggerEnginePrivate; DebuggerEnginePrivate *d; + QHash<quint64, Internal::BreakpointData *> m_breakpoints; }; } // namespace Debugger