From 3d39451b15757f3fca93dddc4982f74a4104da80 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Mon, 16 Jan 2012 18:49:01 +0100
Subject: [PATCH] debugger: show address of the target object when
 auto-dereferencing

Task-number: QTCREATORBUG-6813
Change-Id: Iaf1436a41cd22f46e8a8c369f942a3dba127cc6e
Reviewed-by: hjk <qthjk@ovi.com>
---
 src/plugins/debugger/watchhandler.cpp            |  2 +-
 tests/manual/debugger/simple/simple_test_app.cpp | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index b744e1765d2..07b86092041 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -726,7 +726,7 @@ QString WatchModel::display(const WatchItem *item, int col) const
                 truncateValue(formattedValue(*item)));
             if (item->referencingAddress) {
                 result += QLatin1String(" @");
-                result += QString::fromLatin1(item->hexAddress());
+                result += QString::fromLatin1(item->hexReferencingAddress());
             }
             break;
         case 2:
diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp
index 1311ad6ae99..57588a16401 100644
--- a/tests/manual/debugger/simple/simple_test_app.cpp
+++ b/tests/manual/debugger/simple/simple_test_app.cpp
@@ -5478,6 +5478,20 @@ namespace bug5799 {
 } // namespace bug5799
 
 
+namespace bug6813 {
+
+    // https://bugreports.qt.nokia.com/browse/QTCREATORBUG-6813
+    void test6813()
+    {
+      int foo = 0;
+      int *bar = &foo;
+      //std::cout << "&foo: " << &foo << "; bar: " << bar << "; &bar: " << &bar;
+      dummyStatement(&foo, &bar);
+    }
+
+} // namespace bug6813
+
+
 namespace qc41700 {
 
     // http://www.qtcentre.org/threads/41700-How-to-watch-STL-containers-iterators-during-debugging
@@ -5844,6 +5858,7 @@ int main(int argc, char *argv[])
     bug5106::test5106();
     bug5184::test5184();
     bug5799::test5799();
+    bug6813::test6813();
     bug6465::test6465();
     gdb13393::test13393();
     gdb10586::test10586();
-- 
GitLab