diff options
author | The Qt Project <gerrit-noreply@qt-project.org> | 2020-05-15 12:49:43 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2020-05-15 12:49:43 +0000 |
commit | 8f1be3f343b3f598a6d8aa222cd2dba8ad160338 (patch) | |
tree | 806e6fd331fa786f7a8dd97f43f00a6530ad7a68 /share | |
parent | eac5bc2a060554c3fdd19611b6d8074dc7f9863f (diff) | |
parent | 52b7ec058b4cd18b1da3944c1e69a583a56aba63 (diff) | |
download | qt-creator-8f1be3f343b3f598a6d8aa222cd2dba8ad160338.tar.gz |
Merge "Merge remote-tracking branch 'origin/4.12'"
Diffstat (limited to 'share')
-rw-r--r-- | share/qtcreator/debugger/dumper.py | 13 | ||||
-rw-r--r-- | share/qtcreator/debugger/gdbbridge.py | 7 |
2 files changed, 13 insertions, 7 deletions
diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py index ad8f495428..80d8d47fee 100644 --- a/share/qtcreator/debugger/dumper.py +++ b/share/qtcreator/debugger/dumper.py @@ -40,8 +40,8 @@ try: # that will never use this. import json except ModuleNotFoundError: - DumperBase.warn("Python module json not found. " - "Native combined debugging might not work.") + print("Python module json not found. " + "Native combined debugging might not work.") pass @@ -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() diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index bcaf8ed314..ecc53a8f32 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -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: |