Merge remote-tracking branch 'origin/4.12' into qds-1.50

Change-Id: Ia70d4b47f578021f29197a22b3e07e792342d05c
This commit is contained in:
Tim Jenssen
2020-05-15 17:20:20 +02:00
56 changed files with 575 additions and 433 deletions

View File

@@ -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()

View File

@@ -341,7 +341,12 @@ class Dumper(DumperBase):
#DumperBase.warn('ARRAY')
nativeTargetType = nativeType.target().unqualified()
targetType = self.fromNativeType(nativeTargetType)
count = nativeType.sizeof // nativeTargetType.sizeof
if nativeType.sizeof == 0:
# QTCREATORBUG-23998, note that nativeType.name == None here,
# whereas str(nativeType) returns sth like 'QObject [5]'
count = self.arrayItemCountFromTypeName(str(nativeType), 1)
else:
count = nativeType.sizeof // nativeTargetType.sizeof
return self.createArrayType(targetType, count)
if code == gdb.TYPE_CODE_TYPEDEF: