From adba4c954c8e59c8c1d80d201390213a9ead9e3e Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Tue, 16 Nov 2010 18:20:52 +0100
Subject: [PATCH] debugger: remove breakpoint notification indirection through
 the engine

---
 src/plugins/debugger/breakhandler.cpp       | 12 +++++++
 src/plugins/debugger/breakhandler.h         |  2 ++
 src/plugins/debugger/debuggerengine.cpp     | 37 ---------------------
 src/plugins/debugger/debuggerengine.h       |  8 -----
 src/plugins/debugger/lldb/ipcenginehost.cpp | 15 +++++----
 5 files changed, 22 insertions(+), 52 deletions(-)

diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index d73a34ad46b..a2f09490321 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -676,6 +676,18 @@ void BreakHandler::notifyBreakpointReleased(BreakpointId id)
     layoutChanged();
 }
 
+void BreakHandler::notifyBreakpointAdjusted(BreakpointId id,
+        const BreakpointParameters &data)
+{
+    QTC_ASSERT(state(id) == BreakpointInserted, /**/);
+    Iterator it = m_storage.find(id);
+    QTC_ASSERT(it != m_storage.end(), return);
+    it->data = data;
+    if (it->needsChange())
+        setState(id, BreakpointChangeRequested);
+}
+
+
 void BreakHandler::ackCondition(BreakpointId id)
 {
     Iterator it = m_storage.find(id);
diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h
index 0bc1de3efd8..1fb82988a97 100644
--- a/src/plugins/debugger/breakhandler.h
+++ b/src/plugins/debugger/breakhandler.h
@@ -143,6 +143,8 @@ public:
     void notifyBreakpointRemoveOk(BreakpointId id);
     void notifyBreakpointRemoveFailed(BreakpointId id);
     void notifyBreakpointReleased(BreakpointId id);
+    void notifyBreakpointAdjusted(BreakpointId id,
+            const BreakpointParameters &data);
 
 private:
 public:
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 5b190d99c74..d489b92b11c 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -1280,53 +1280,16 @@ void DebuggerEngine::insertBreakpoint(BreakpointId)
     QTC_ASSERT(false, /**/);
 }
 
-void DebuggerEngine::notifyBreakpointInsertOk(BreakpointId id)
-{
-    breakHandler()->notifyBreakpointInsertOk(id);
-}
-
-void DebuggerEngine::notifyBreakpointInsertFailed(BreakpointId id)
-{
-    breakHandler()->notifyBreakpointInsertFailed(id);
-}
-
 void DebuggerEngine::removeBreakpoint(BreakpointId)
 {
     QTC_ASSERT(false, /**/);
 }
 
-void DebuggerEngine::notifyBreakpointRemoveOk(BreakpointId id)
-{
-    breakHandler()->notifyBreakpointRemoveOk(id);
-}
-
-void DebuggerEngine::notifyBreakpointRemoveFailed(BreakpointId id)
-{
-    breakHandler()->notifyBreakpointRemoveFailed(id);
-}
-
 void DebuggerEngine::changeBreakpoint(BreakpointId)
 {
     QTC_ASSERT(false, /**/);
 }
 
-void DebuggerEngine::notifyBreakpointChangeOk(BreakpointId id)
-{
-    breakHandler()->notifyBreakpointChangeOk(id);
-}
-
-void DebuggerEngine::notifyBreakpointChangeFailed(BreakpointId id)
-{
-    breakHandler()->notifyBreakpointChangeFailed(id);
-}
-
-void DebuggerEngine::notifyBreakpointAdjusted(BreakpointId id,
-    const BreakpointParameters &data)
-{
-    QTC_ASSERT(false, /* FIXME */);
-    breakHandler()->setBreakpointData(id, data);
-}
-
 void DebuggerEngine::selectThread(int)
 {
 }
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index 1de1e7ab60b..cb439dd387e 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -187,16 +187,8 @@ public:
     virtual void attemptBreakpointSynchronization();
     virtual bool acceptsBreakpoint(BreakpointId id) const;  // FIXME: make pure
     virtual void insertBreakpoint(BreakpointId id);  // FIXME: make pure
-    virtual void notifyBreakpointInsertOk(BreakpointId id);
-    virtual void notifyBreakpointInsertFailed(BreakpointId id);
     virtual void removeBreakpoint(BreakpointId id);  // FIXME: make pure
-    virtual void notifyBreakpointRemoveOk(BreakpointId id);
-    virtual void notifyBreakpointRemoveFailed(BreakpointId id);
     virtual void changeBreakpoint(BreakpointId id);  // FIXME: make pure
-    virtual void notifyBreakpointChangeOk(BreakpointId id);
-    virtual void notifyBreakpointChangeFailed(BreakpointId id);
-    virtual void notifyBreakpointAdjusted(BreakpointId id,
-        const Internal::BreakpointParameters &data);
 
     virtual void assignValueInDebugger(const Internal::WatchData *data,
         const QString &expr, const QVariant &value);
diff --git a/src/plugins/debugger/lldb/ipcenginehost.cpp b/src/plugins/debugger/lldb/ipcenginehost.cpp
index 5314c8a5637..436b17cb5f9 100644
--- a/src/plugins/debugger/lldb/ipcenginehost.cpp
+++ b/src/plugins/debugger/lldb/ipcenginehost.cpp
@@ -290,6 +290,7 @@ void IPCEngineHost::updateWatchData(const WatchData &data,
 
 void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
 {
+    BreakHandler *handler;
     switch (f) {
         default:
             showMessage(QLatin1String("IPC Error: unhandled id in guest to host call"));
@@ -475,7 +476,7 @@ void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
                 SET_NATIVE_BYTE_ORDER(s);
                 BreakpointId id;
                 s >> id;
-                notifyBreakpointInsertOk(id);
+                handler->notifyBreakpointInsertOk(id);
             }
         case IPCEngineGuest::NotifyAddBreakpointFailed:
             {
@@ -483,7 +484,7 @@ void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
                 SET_NATIVE_BYTE_ORDER(s);
                 BreakpointId id;
                 s >> id;
-                notifyBreakpointInsertFailed(id);
+                handler->notifyBreakpointInsertFailed(id);
             }
         case IPCEngineGuest::NotifyRemoveBreakpointOk:
             {
@@ -491,7 +492,7 @@ void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
                 SET_NATIVE_BYTE_ORDER(s);
                 BreakpointId id;
                 s >> id;
-                notifyBreakpointRemoveOk(id);
+                handler->notifyBreakpointRemoveOk(id);
             }
         case IPCEngineGuest::NotifyRemoveBreakpointFailed:
             {
@@ -499,7 +500,7 @@ void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
                 SET_NATIVE_BYTE_ORDER(s);
                 BreakpointId id;
                 s >> id;
-                notifyBreakpointRemoveFailed(id);
+                handler->notifyBreakpointRemoveFailed(id);
             }
         case IPCEngineGuest::NotifyChangeBreakpointOk:
             {
@@ -507,7 +508,7 @@ void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
                 SET_NATIVE_BYTE_ORDER(s);
                 BreakpointId id;
                 s >> id;
-                notifyBreakpointChangeOk(id);
+                handler->notifyBreakpointChangeOk(id);
             }
         case IPCEngineGuest::NotifyChangeBreakpointFailed:
             {
@@ -515,7 +516,7 @@ void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
                 SET_NATIVE_BYTE_ORDER(s);
                 BreakpointId id;
                 s >> id;
-                notifyBreakpointChangeFailed(id);
+                handler->notifyBreakpointChangeFailed(id);
             }
         case IPCEngineGuest::NotifyBreakpointAdjusted:
             {
@@ -524,7 +525,7 @@ void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload)
                 BreakpointId id;
                 BreakpointParameters d;
                 s >> id >> d;
-                notifyBreakpointAdjusted(id, d);
+                handler->notifyBreakpointAdjusted(id, d);
             }
     }
 }
-- 
GitLab