diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 8b9fede408553df4675421c97afec899a737f1d9..f18dce585ecbccf2da70bcecd3f0832ea5a8dcd8 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -114,11 +114,8 @@ static const char winPythonVersionC[] = "python2.5";
 
 #define CB(callback) &GdbEngine::callback, STRINGIFY(callback)
 
-QByteArray GdbEngine::tooltipINameForExpression(const QByteArray &exp)
+QByteArray GdbEngine::tooltipIName()
 {
-    // FIXME: 'exp' can contain illegal characters
-    //return "tooltip." + exp;
-    Q_UNUSED(exp)
     return "tooltip.x";
 }
 
@@ -3204,10 +3201,17 @@ QPoint GdbEngine::m_toolTipPos;
 
 bool GdbEngine::showToolTip()
 {
+    QByteArray iname = tooltipIName();
+
+    if (!theDebuggerBoolSetting(UseToolTipsInMainEditor)) {
+        watchHandler()->removeData(iname);
+        return true;
+    }
+
     WatchModel *model = watchHandler()->model(TooltipsWatch);
-    QByteArray iname = tooltipINameForExpression(m_toolTipExpression.toLatin1());
     WatchItem *item = model->findItem(iname, model->rootItem());
     if (!item) {
+        watchHandler()->removeData(iname);
         hideDebuggerToolTip();
         return false;
     }
@@ -3301,7 +3305,7 @@ void GdbEngine::setToolTipExpression(const QPoint &mousePos,
     WatchData toolTip;
     toolTip.exp = exp.toLatin1();
     toolTip.name = exp;
-    toolTip.iname = tooltipINameForExpression(toolTip.exp);
+    toolTip.iname = tooltipIName();
     watchHandler()->removeData(toolTip.iname);
     watchHandler()->insertData(toolTip);
 }
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index 3787b8202e145e52d2e1245c4c6ed49331fb96b7..c703573f51f6f392e35ecf193cc7d9df6a7e1b9b 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -520,7 +520,7 @@ private: ////////// View & Data Stuff //////////
 
     static QString m_toolTipExpression;
     static QPoint m_toolTipPos;
-    static QByteArray tooltipINameForExpression(const QByteArray &exp);
+    static QByteArray tooltipIName();
 };
 
 } // namespace Internal
diff --git a/src/plugins/debugger/gdb/pythongdbengine.cpp b/src/plugins/debugger/gdb/pythongdbengine.cpp
index a2d45dd178e30cb90bb3b684fd78708a8443adbc..b4bf14664e08e5a5c296808710f716340456fc96 100644
--- a/src/plugins/debugger/gdb/pythongdbengine.cpp
+++ b/src/plugins/debugger/gdb/pythongdbengine.cpp
@@ -61,8 +61,7 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
 
     QByteArray watchers;
     if (!m_toolTipExpression.isEmpty())
-        watchers += m_toolTipExpression.toLatin1()
-            + '#' + tooltipINameForExpression(m_toolTipExpression.toLatin1());
+        watchers += m_toolTipExpression.toLatin1() + '#' + tooltipIName();
 
     QHash<QByteArray, int> watcherNames = handler->watcherNames();
     QHashIterator<QByteArray, int> it(watcherNames);
diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp
index 8a4f93a5f6ed3e24803365151c3caf5c545a0e1b..6eb30b48bd1e408b459cf2fc906a2c22d0208941 100644
--- a/tests/manual/gdbdebugger/simple/app.cpp
+++ b/tests/manual/gdbdebugger/simple/app.cpp
@@ -187,13 +187,20 @@ private:
     QHash<QObject *, Map::iterator> h;
 };
 
-class X : virtual public Foo
+class X : public Foo
 {
 public:
     X() {
     }
 };
 
+class XX : virtual public Foo
+{
+public:
+    XX() {
+    }
+};
+
 class Y : virtual public Foo
 {
 public:
@@ -201,13 +208,24 @@ public:
     }
 };
 
+class D : public X, public Y
+{
+    int diamond;
+};
+
 void testArray()
 {
-    X xxx;
+#if 1
+    X x;
+    XX xx;
+    D diamond;
+    Foo *f = &xx;
+    Foo ff;
     double d[3][3];
     for (int i = 0; i != 3; ++i)
         for (int j = 0; j != 3; ++j)
             d[i][j] = i + j;
+#endif
 
     char c[20];
     c[0] = 'a';
@@ -215,11 +233,12 @@ void testArray()
     c[2] = 'c';
     c[3] = 'd';
 
-    QString x[20];
-    x[0] = "a";
-    x[1] = "b";
-    x[2] = "c";
-    x[3] = "d";
+#if 1
+    QString s[20];
+    s[0] = "a";
+    s[1] = "b";
+    s[2] = "c";
+    s[3] = "d";
 
     Foo foo[10];
     //for (int i = 0; i != sizeof(foo)/sizeof(foo[0]); ++i) {
@@ -227,6 +246,7 @@ void testArray()
         foo[i].a = i;
         foo[i].doit();
     }
+#endif
 }
 
 #ifndef Q_CC_RVCT