From 4ad493c9588a77d2b788c1b1fffbeb6bbf1109c3 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Thu, 4 Nov 2010 11:27:23 +0100
Subject: [PATCH] debugger: re-enable functions and cleanup after breakhandler
 move

---
 src/plugins/debugger/debuggerengine.cpp | 21 ++++++++++-----------
 src/plugins/debugger/watchhandler.cpp   |  3 ---
 src/plugins/debugger/watchwindow.cpp    | 20 ++++++++++++--------
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 58dd1ac1001..5b9d29dedeb 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -353,29 +353,28 @@ void DebuggerEnginePrivate::handleContextMenuRequest(const QVariant &parameters)
 {
     const QList<QVariant> list = parameters.toList();
     QTC_ASSERT(list.size() == 3, qDebug() << list; return);
-//    TextEditor::ITextEditor *editor =
-//        (TextEditor::ITextEditor *)(list.at(0).value<quint64>());
+    TextEditor::ITextEditor *editor =
+        (TextEditor::ITextEditor *)(list.at(0).value<quint64>());
     int lineNumber = list.at(1).toInt();
     QMenu *menu = (QMenu *)(list.at(2).value<quint64>());
 
     BreakpointData *data = 0;
     QString fileName;
     quint64 address = 0;
-/*
-FIXME:
+
     if (editor->property("DisassemblerView").toBool()) {
         fileName = editor->file()->fileName();
         QString line = editor->contents()
             .section('\n', lineNumber - 1, lineNumber - 1);
         BreakpointData needle;
-        address = needle.address = DisassemblerViewAgent::addressFromDisassemblyLine(line);
+        address = DisassemblerViewAgent::addressFromDisassemblyLine(line);
+        needle.address = address;
         needle.bpLineNumber = -1;
-        data = m_breakHandler.findSimilarBreakpoint(&needle);
+        data = m_engine->breakHandler()->findSimilarBreakpoint(&needle);
     } else {
         fileName = editor->file()->fileName();
-        data = m_breakHandler.findBreakpoint(fileName, lineNumber);
+        data = m_engine->breakHandler()->findBreakpoint(fileName, lineNumber);
     }
-*/
 
     QList<QVariant> args;
     args.append(fileName);
@@ -392,7 +391,7 @@ FIXME:
             act = new QAction(tr("Remove Breakpoint %1").arg(number), menu);
         act->setData(args);
         connect(act, SIGNAL(triggered()),
-            this, SLOT(breakpointSetRemoveMarginActionTriggered()));
+            SLOT(breakpointSetRemoveMarginActionTriggered()));
         menu->addAction(act);
 
         QAction *act2;
@@ -415,7 +414,7 @@ FIXME:
             editAction = new QAction(tr("Edit Breakpoint..."), menu);
         else
             editAction = new QAction(tr("Edit Breakpoint %1...").arg(number), menu);
-        connect(editAction, SIGNAL(triggered()), this, SLOT(slotEditBreakpoint()));
+        connect(editAction, SIGNAL(triggered()), SLOT(slotEditBreakpoint()));
         editAction->setData(qVariantFromValue(data));
         menu->addAction(editAction);
     } else {
@@ -426,7 +425,7 @@ FIXME:
         QAction *act = new QAction(text, menu);
         act->setData(args);
         connect(act, SIGNAL(triggered()),
-            this, SLOT(breakpointSetRemoveMarginActionTriggered()));
+            SLOT(breakpointSetRemoveMarginActionTriggered()));
         menu->addAction(act);
     }
 }
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index e4c4c649067..e6ff28c4c1f 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -825,8 +825,6 @@ bool WatchModel::setData(const QModelIndex &index, const QVariant &value, int ro
             return true;
         }
 
-/*
-    FIXME BP:
         case RequestToggleWatchRole: {
             BreakHandler *handler = engine()->breakHandler();
             const quint64 address = value.toULongLong();
@@ -842,7 +840,6 @@ bool WatchModel::setData(const QModelIndex &index, const QVariant &value, int ro
             engine()->attemptBreakpointSynchronization();
             return true;
         }
-*/
 
         case RequestShowMemoryRole: {
             (void) new MemoryViewAgent(engine(), value.toULongLong());
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index 253f41e912d..c9c34760382 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -69,7 +69,8 @@ public:
     {
         // Value column: Custom editor. Apply integer-specific settings.
         if (index.column() == 1) {
-            const QVariant::Type type = static_cast<QVariant::Type>(index.data(LocalsEditTypeRole).toInt());
+            const QVariant::Type type =
+                static_cast<QVariant::Type>(index.data(LocalsEditTypeRole).toInt());
             switch (type) {
             case QVariant::Bool:
                 return new BooleanComboBox(parent);
@@ -296,7 +297,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
     const unsigned engineCapabilities = modelData(EngineCapabilitiesRole).toUInt();
     const bool canHandleWatches =
         actionsEnabled && (engineCapabilities & AddWatcherCapability);
-    const DebuggerState state = static_cast<DebuggerState>(modelData(EngineStateRole).toInt());
+    const DebuggerState state =
+        static_cast<DebuggerState>(modelData(EngineStateRole).toInt());
 
     QMenu menu;
     QAction *actInsertNewWatchItem = menu.addAction(tr("Insert New Watch Item"));
@@ -329,14 +331,13 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
     const bool canSetWatchpoint = engineCapabilities & WatchpointCapability;
     if (canSetWatchpoint && address) {
         actSetWatchPointAtVariableAddress =
-            new QAction(tr("Break on Changes at Object's Address (0x%1)")
+            new QAction(tr("Add Watchpoint at Object's Address (0x%1)")
                 .arg(address, 0, 16), &menu);
-        actSetWatchPointAtVariableAddress->setCheckable(true);
         actSetWatchPointAtVariableAddress->
             setChecked(mi0.data(LocalsIsWatchpointAtAddressRole).toBool());
         if (createPointerActions) {
             actSetWatchPointAtPointerValue =
-                new QAction(tr("Break on Changes at Referenced Address (0x%1)")
+                new QAction(tr("Add Watchpoint at Referenced Address (0x%1)")
                     .arg(pointerValue, 0, 16), &menu);
             actSetWatchPointAtPointerValue->setCheckable(true);
             actSetWatchPointAtPointerValue->
@@ -344,9 +345,12 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
         }
     } else {
         actSetWatchPointAtVariableAddress =
-            new QAction(tr("Break on Changing Contents"), &menu);
+            new QAction(tr("At Watchpoint"), &menu);
         actSetWatchPointAtVariableAddress->setEnabled(false);
     }
+    actSetWatchPointAtVariableAddress->setToolTip(
+        tr("Setting a watchpoint on an address will cause the program "
+           "to stop when the data at the address it modified"));
 
     QString actionName = exp.isEmpty() ? tr("Watch Expression")
         : tr("Watch Expression \"%1\"").arg(exp);
@@ -357,8 +361,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
     actionName = exp.isEmpty() ? tr("Remove Watch Expression")
         : tr("Remove Watch Expression \"%1\"").arg(exp);
     QAction *actRemoveWatchExpression = new QAction(actionName, &menu);
-    actRemoveWatchExpression->setEnabled((canHandleWatches || state == DebuggerNotReady)
-                                         && !exp.isEmpty());
+    actRemoveWatchExpression->setEnabled(
+        (canHandleWatches || state == DebuggerNotReady) && !exp.isEmpty());
 
     if (m_type == LocalsType)
         menu.addAction(actWatchExpression);
-- 
GitLab