From 32d3db8200ddc395d0ea1f734c04ae8843057608 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Mon, 7 Dec 2009 12:06:01 +0100
Subject: [PATCH] debugger: special handling for char*

---
 src/plugins/debugger/watchhandler.cpp | 3 ++-
 src/plugins/debugger/watchutils.cpp   | 9 +++++++++
 src/plugins/debugger/watchutils.h     | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index b1c1a818e61..c8b25794722 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -166,7 +166,8 @@ void WatchData::setValue(const QString &value0)
     // "numchild" is sometimes lying
     //MODEL_DEBUG("\n\n\nPOINTER: " << type << value);
     if (isPointerType(type))
-        setHasChildren(value != "0x0" && value != "<null>");
+        setHasChildren(value != "0x0" && value != "<null>"
+            && !isCharPointerType(type));
 
     // pointer type information is available in the 'type'
     // column. No need to duplicate it here.
diff --git a/src/plugins/debugger/watchutils.cpp b/src/plugins/debugger/watchutils.cpp
index 5b45d90aff6..c5c9aac5006 100644
--- a/src/plugins/debugger/watchutils.cpp
+++ b/src/plugins/debugger/watchutils.cpp
@@ -268,6 +268,13 @@ bool isPointerType(const QString &type)
     return type.endsWith(QLatin1Char('*')) || type.endsWith(QLatin1String("* const"));
 }
 
+bool isCharPointerType(const QString &type)
+{
+    return type == QLatin1String("char *")
+        || type == QLatin1String("const char *")
+        || type == QLatin1String("char const *");
+}
+
 bool isAccessSpecifier(const QString &str)
 {
     static const QStringList items = QStringList()
@@ -569,6 +576,8 @@ GuessChildrenResult guessChildren(const QString &type)
 {
     if (isIntOrFloatType(type))
         return HasNoChildren;
+    if (isCharPointerType(type))
+        return HasNoChildren;
     if (isPointerType(type))
         return HasChildren;
     if (type.endsWith(QLatin1String("QString")))
diff --git a/src/plugins/debugger/watchutils.h b/src/plugins/debugger/watchutils.h
index c7cf4bfdbed..477eed2d33a 100644
--- a/src/plugins/debugger/watchutils.h
+++ b/src/plugins/debugger/watchutils.h
@@ -70,6 +70,7 @@ bool hasLetterOrNumber(const QString &exp);
 bool hasSideEffects(const QString &exp);
 bool isKeyWord(const QString &exp);
 bool isPointerType(const QString &type);
+bool isCharPointerType(const QString &type);
 bool isAccessSpecifier(const QString &str);
 bool startsWithDigit(const QString &str);
 QString stripPointerType(QString type);
-- 
GitLab