summaryrefslogtreecommitdiff
path: root/share/qtcreator/debugger/dumper.py
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2020-05-07 09:56:52 +0200
committerhjk <hjk@qt.io>2020-05-14 10:52:18 +0000
commit7a63a47ef03e9fed7215e9f622661e672e23aa60 (patch)
tree9da67edb0576f4140cd6feb745f7bfd64a19789f /share/qtcreator/debugger/dumper.py
parentf51258a17c898d1dc8f11bcda8b039fad68ad09e (diff)
downloadqt-creator-7a63a47ef03e9fed7215e9f622661e672e23aa60.tar.gz
Debugger: Work around for gdb reporting zero array sizes in some cases
Task-number: QTCREATORBUG-23998 Change-Id: I101d032705b66faf50260067f6aa604214f09298 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
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()