From 70153d1c73e9160f5463487cf2b05c91582b0821 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Fri, 16 Apr 2010 16:36:00 +0200
Subject: [PATCH] Debugger[CDB]: Disable watchers.

As they work only in a very limited way and slow down debugging.
---
 src/plugins/debugger/debuggerconstants.h | 1 +
 src/plugins/debugger/gdb/gdbengine.cpp   | 3 ++-
 src/plugins/debugger/watchwindow.cpp     | 9 +++++++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h
index d6077bf8e6b..d958246fbf8 100644
--- a/src/plugins/debugger/debuggerconstants.h
+++ b/src/plugins/debugger/debuggerconstants.h
@@ -130,6 +130,7 @@ enum DebuggerCapabilities
     BreakOnThrowAndCatchCapability = 0x200,
     ReturnFromFunctionCapability = 0x400,
     CreateFullBacktraceCapability = 0x800,
+    AddWatcherCapability = 0x1000
 };
 
 enum LogChannel
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index f1568171b1d..fec4766adc1 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -1817,7 +1817,8 @@ unsigned GdbEngine::debuggerCapabilities() const
         | JumpToLineCapability | ReloadModuleCapability
         | ReloadModuleSymbolsCapability | BreakOnThrowAndCatchCapability
         | ReturnFromFunctionCapability 
-        | CreateFullBacktraceCapability;
+        | CreateFullBacktraceCapability
+        | AddWatcherCapability;
 }
 
 void GdbEngine::continueInferiorInternal()
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index 07c0c13358c..af071542d19 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -273,11 +273,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
 
     QMenu menu;
 
+    const bool actionsEnabled = m_manager->debuggerActionsEnabled();
+    const unsigned engineCapabilities = m_manager->debuggerCapabilities();
+    const bool canHandleWatches = actionsEnabled && (engineCapabilities & AddWatcherCapability);
+
     QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Watch Item"));
+    actInsertNewWatchItem->setEnabled(canHandleWatches);
     QAction *actSelectWidgetToWatch = menu.addAction(tr("Select Widget to Watch"));
+    actSelectWidgetToWatch->setEnabled(canHandleWatches);
 
-    const bool actionsEnabled = m_manager->debuggerActionsEnabled();
-    const unsigned engineCapabilities = m_manager->debuggerCapabilities();
     const QString address = model()->data(mi0, AddressRole).toString();
     QAction *actWatchKnownMemory = 0;
     QAction *actWatchUnknownMemory = new QAction(tr("Open Memory Editor..."), &menu);
@@ -292,6 +296,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
     QAction *actWatchOrRemove;
     if (m_type == LocalsType) {
         actWatchOrRemove = theDebuggerAction(WatchExpression)->updatedAction(exp);
+        actWatchOrRemove->setEnabled(canHandleWatches);
     } else {
         actWatchOrRemove = theDebuggerAction(RemoveWatchExpression)->updatedAction(exp);
         // Also for the case where the user cleared the expression.
-- 
GitLab