From 07b118197a1e4bfd7f47b34903b934160b6c66bd Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Wed, 19 May 2010 15:36:23 +0200
Subject: [PATCH] debugger: Open memory editor at pointee address, not at
 pointer address

---
 src/plugins/debugger/watchhandler.h  | 2 +-
 src/plugins/debugger/watchwindow.cpp | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h
index 9a4dad79a80..78f8ac98ea1 100644
--- a/src/plugins/debugger/watchhandler.h
+++ b/src/plugins/debugger/watchhandler.h
@@ -61,7 +61,7 @@ enum WatchRoles
     TypeFormatListRole,
     TypeFormatRole,  // Used to communicate alternative formats to the view.
     IndividualFormatRole,
-    AddressRole,     // Some memory address related to the object.
+    AddressRole,     // Address of the object.
 };
 
 enum IntegerFormat
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index 209944278a0..c8e7b507a87 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -37,6 +37,7 @@
 #include "debuggerdialogs.h"
 #include "debuggermanager.h"
 #include "idebuggerengine.h"
+#include "watchutils.h"
 
 #include <utils/qtcassert.h>
 #include <utils/savedaction.h>
@@ -299,9 +300,12 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
     const bool canShowMemory = engineCapabilities & ShowMemoryCapability;
     actWatchUnknownMemory->setEnabled(actionsEnabled && canShowMemory);
 
-    if (canShowMemory && !address.isEmpty())
+    QString editAddress = address;
+    if (isPointerType(type))
+        editAddress = model()->data(mi1).toString();
+    if (canShowMemory && !editAddress.isEmpty())
         actWatchKnownMemory =
-            new QAction(tr("Open Memory Editor at %1").arg(address), &menu);
+            new QAction(tr("Open Memory Editor at %1").arg(editAddress), &menu);
     menu.addSeparator();
 
     QAction *actSetWatchpoint = 0;
-- 
GitLab