From f9c585281e97660237a22cad2c40b2511ba909e6 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Tue, 16 Nov 2010 17:09:25 +0100
Subject: [PATCH] debugger: fix display of '"' chars

Task-number: QTCREATORBUG-3084
---
 share/qtcreator/gdbmacros/dumper.py                   |  6 ++++++
 .../manual/gdbdebugger/simple/simple_gdbtest_app.cpp  | 11 +++++++++++
 2 files changed, 17 insertions(+)

diff --git a/share/qtcreator/gdbmacros/dumper.py b/share/qtcreator/gdbmacros/dumper.py
index 021b9bac7c1..3c1227db575 100644
--- a/share/qtcreator/gdbmacros/dumper.py
+++ b/share/qtcreator/gdbmacros/dumper.py
@@ -1472,6 +1472,12 @@ class Dumper:
                 value = item.value
                 type = value.type
 
+        if type.code == gdb.TYPE_CODE_INT or type.code == gdb.TYPE_CODE_CHAR:
+            self.putType(realtype)
+            self.putValue(int(value))
+            self.putNumChild(0)
+            return
+
         typedefStrippedType = stripTypedefs(type)
 
         if isSimpleType(typedefStrippedType):
diff --git a/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp b/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp
index 96d62dbdf06..81a486f3ce3 100644
--- a/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp
+++ b/tests/manual/gdbdebugger/simple/simple_gdbtest_app.cpp
@@ -1959,6 +1959,16 @@ void testConditional(const QString &str)
     res += "x";
 }
 
+void testChar()
+{
+    char s[5];
+    s[0] = 0;
+    strcat(s,"\""); // add a quote
+    strcat(s,"\""); // add a quote
+    strcat(s,"\""); // add a quote
+    strcat(s,"\""); // add a quote
+}
+
 void testStuff()
 {
     testConditional("foo");
@@ -2099,6 +2109,7 @@ int main(int argc, char *argv[])
     testColor();
     testQRegion();
     testTypedef();
+    testChar();
     testStuff();
     testPeekAndPoke3();
     testFunctionPointer();
-- 
GitLab