aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/debugger/dumper.py
diff options
context:
space:
mode:
Diffstat (limited to 'share/qtcreator/debugger/dumper.py')
-rw-r--r--share/qtcreator/debugger/dumper.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py
index da8c322582..80d8d47fee 100644
--- a/share/qtcreator/debugger/dumper.py
+++ b/share/qtcreator/debugger/dumper.py
@@ -1089,6 +1089,10 @@ class DumperBase():
return '_ZN%sE' % ''.join(map(lambda x: '%d%s' % (len(x), x),
typeName.split('::')))
+ def arrayItemCountFromTypeName(self, typeName, fallbackMax=1):
+ itemCount = typeName[typeName.find('[') + 1:typeName.find(']')]
+ return int(itemCount) if itemCount else fallbackMax
+
def putCStyleArray(self, value):
arrayType = value.type.unqualified()
innerType = arrayType.ltarget
@@ -1107,10 +1111,7 @@ class DumperBase():
# This should not happen. But it does, see QTCREATORBUG-14755.
# GDB/GCC produce sizeof == 0 for QProcess arr[3]
# And in the Nim string dumper.
- s = value.type.name
- itemCount = s[s.find('[') + 1:s.find(']')]
- if not itemCount:
- itemCount = '100'
+ itemCount = self.arrayItemCountFromTypeName(value.type.name, 100)
arrayByteSize = int(itemCount) * innerType.size()
n = arrayByteSize // innerType.size()