aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2020-09-24 14:05:13 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2020-09-24 14:31:43 +0000
commit0ab97e1159fbf235520b12b50a9c82a50b655b53 (patch)
tree5e55165295bbd409ffb868eb5791c849c9b38d38 /share/qtcreator
parenta0af404faa6769b66035a22264d33b0e27e3dd71 (diff)
Debugger: Show actual type for 'gchar *' elements etc
When 'char *' typedefs (and the like) are used, this makes the actual (i.e. the typedef's) type name shown instead of the one that the type is a typedef for. For example, 'gchar' is shown as type for all elements of a 'gchar*' when expanding that one in the debugger's locals or expressions view. Original display of text representation for 'char *' typedefs etc. had been added with commit 70c4889ac9a0d75c93809dd5bb321fcb2272a202 ("Debugger: Show text representation for 'char *' typedefs etc", 2020-06-26). Move the typedef resolution one level down so the original type name is still available for display. This also extends the existing 'gchar *' test case accordingly. Change-Id: I9558360b3bf96906d6dc39a63706bb8ce28c2f1c Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'share/qtcreator')
-rw-r--r--share/qtcreator/debugger/dumper.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py
index 68cafc5209..9b31a54289 100644
--- a/share/qtcreator/debugger/dumper.py
+++ b/share/qtcreator/debugger/dumper.py
@@ -1228,7 +1228,11 @@ class DumperBase():
# This is shared by pointer and array formatting.
def tryPutSimpleFormattedPointer(self, ptr, typeName, innerType, displayFormat, limit):
if displayFormat == DisplayFormat.Automatic:
- if innerType.name in ('char', 'signed char', 'unsigned char', 'CHAR'):
+ targetType = innerType
+ if innerType.code == TypeCode.Typedef:
+ targetType = innerType.ltarget
+
+ if targetType.name in ('char', 'signed char', 'unsigned char', 'CHAR'):
# Use UTF-8 as default for char *.
self.putType(typeName)
(elided, shown, data) = self.readToFirstZero(ptr, 1, limit)
@@ -1237,7 +1241,7 @@ class DumperBase():
self.putArrayData(ptr, shown, innerType)
return True
- if innerType.name in ('wchar_t', 'WCHAR'):
+ if targetType.name in ('wchar_t', 'WCHAR'):
self.putType(typeName)
charSize = self.lookupType('wchar_t').size()
(elided, data) = self.encodeCArray(ptr, charSize, limit)
@@ -1336,10 +1340,7 @@ class DumperBase():
return
displayFormat = self.currentItemFormat(value.type.name)
-
innerType = value.type.target() # .unqualified()
- if innerType.code == TypeCode.Typedef:
- innerType = innerType.ltarget
if innerType.name == 'void':
#DumperBase.warn('VOID POINTER: %s' % displayFormat)