forked from qt-creator/qt-creator
Debugger: merge put array code from cdbbridge into dumper base
Basically the same. Only the type lookup of the inner type needs to be avoided for performance reasons. Change-Id: I2747ab44c23b764482b4a063d3618fae2e3c4d46 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -629,87 +629,6 @@ class Dumper(DumperBase):
|
|||||||
if self.showQObjectNames:
|
if self.showQObjectNames:
|
||||||
self.tryPutQObjectGuts(value)
|
self.tryPutQObjectGuts(value)
|
||||||
|
|
||||||
def putCStyleArray(self, value: DumperBase.Value):
|
|
||||||
arrayType = value.type
|
|
||||||
innerType = arrayType.target()
|
|
||||||
address = value.address()
|
|
||||||
if address:
|
|
||||||
self.putValue('@0x%x' % address, priority=-1)
|
|
||||||
else:
|
|
||||||
self.putEmptyValue()
|
|
||||||
self.putType(arrayType)
|
|
||||||
|
|
||||||
displayFormat = self.currentItemFormat()
|
|
||||||
arrayByteSize = arrayType.size()
|
|
||||||
n = self.arrayItemCountFromTypeName(value.type.name, 100)
|
|
||||||
|
|
||||||
p = value.address()
|
|
||||||
if displayFormat != DisplayFormat.Raw and p:
|
|
||||||
if innerType.name.strip() in (
|
|
||||||
'char',
|
|
||||||
'int8_t',
|
|
||||||
'qint8',
|
|
||||||
'wchar_t',
|
|
||||||
'unsigned char',
|
|
||||||
'uint8_t',
|
|
||||||
'quint8',
|
|
||||||
'signed char',
|
|
||||||
'CHAR',
|
|
||||||
'WCHAR',
|
|
||||||
'char8_t',
|
|
||||||
'char16_t',
|
|
||||||
'char32_t'
|
|
||||||
):
|
|
||||||
self.putCharArrayHelper(p, n, innerType, self.currentItemFormat(),
|
|
||||||
makeExpandable=False)
|
|
||||||
else:
|
|
||||||
self.tryPutSimpleFormattedPointer(p, arrayType, innerType,
|
|
||||||
displayFormat, arrayByteSize)
|
|
||||||
self.putNumChild(n)
|
|
||||||
|
|
||||||
if self.isExpanded():
|
|
||||||
if n > 100:
|
|
||||||
addrStep = innerType.size()
|
|
||||||
with Children(self, n, innerType, addrBase=address, addrStep=addrStep):
|
|
||||||
for i in self.childRange():
|
|
||||||
self.putSubItem(i, self.createValue(address + i * addrStep, innerType))
|
|
||||||
else:
|
|
||||||
with Children(self):
|
|
||||||
n = 0
|
|
||||||
for item in self.listValueChildren(value):
|
|
||||||
with SubItem(self, n):
|
|
||||||
n += 1
|
|
||||||
self.putItem(item)
|
|
||||||
|
|
||||||
|
|
||||||
def putArrayData(self, base, n, innerType, childNumChild=None):
|
|
||||||
self.checkIntType(base)
|
|
||||||
self.checkIntType(n)
|
|
||||||
addrBase = base
|
|
||||||
innerType = self.createType(innerType)
|
|
||||||
innerSize = innerType.size()
|
|
||||||
self.putNumChild(n)
|
|
||||||
#DumperBase.warn('ADDRESS: 0x%x INNERSIZE: %s INNERTYPE: %s' % (addrBase, innerSize, innerType))
|
|
||||||
enc = self.type_encoding_cache.get(innerType.typeid, None)
|
|
||||||
maxNumChild = self.maxArrayCount()
|
|
||||||
if enc:
|
|
||||||
self.put('childtype="%s",' % innerType.name)
|
|
||||||
self.put('addrbase="0x%x",' % addrBase)
|
|
||||||
self.put('addrstep="0x%x",' % innerSize)
|
|
||||||
self.put('arrayencoding="%s",' % enc)
|
|
||||||
self.put('endian="%s",' % self.packCode)
|
|
||||||
if n > maxNumChild:
|
|
||||||
self.put('childrenelided="%s",' % n)
|
|
||||||
n = maxNumChild
|
|
||||||
self.put('arraydata="')
|
|
||||||
self.put(self.readMemory(addrBase, n * innerSize))
|
|
||||||
self.put('",')
|
|
||||||
else:
|
|
||||||
with Children(self, n, innerType, childNumChild, maxNumChild,
|
|
||||||
addrBase=addrBase, addrStep=innerSize):
|
|
||||||
for i in self.childRange():
|
|
||||||
self.putSubItem(i, self.createValue(addrBase + i * innerSize, innerType))
|
|
||||||
|
|
||||||
def fetchInternalFunctions(self):
|
def fetchInternalFunctions(self):
|
||||||
coreModuleName = self.qtCoreModuleName()
|
coreModuleName = self.qtCoreModuleName()
|
||||||
ns = self.qtNamespace()
|
ns = self.qtNamespace()
|
||||||
|
@@ -1305,14 +1305,17 @@ class DumperBase():
|
|||||||
|
|
||||||
displayFormat = self.currentItemFormat()
|
displayFormat = self.currentItemFormat()
|
||||||
arrayByteSize = arrayType.size()
|
arrayByteSize = arrayType.size()
|
||||||
|
n = self.arrayItemCountFromTypeName(value.type.name, 100)
|
||||||
if arrayByteSize == 0:
|
if arrayByteSize == 0:
|
||||||
# This should not happen. But it does, see QTCREATORBUG-14755.
|
# This should not happen. But it does, see QTCREATORBUG-14755.
|
||||||
# GDB/GCC produce sizeof == 0 for QProcess arr[3]
|
# GDB/GCC produce sizeof == 0 for QProcess arr[3]
|
||||||
# And in the Nim string dumper.
|
# And in the Nim string dumper.
|
||||||
itemCount = self.arrayItemCountFromTypeName(value.type.name, 100)
|
arrayByteSize = n * innerType.size()
|
||||||
arrayByteSize = int(itemCount) * innerType.size()
|
elif not self.isCdb:
|
||||||
|
# Do not check the inner type size for cdb since this requires a potentially expensive
|
||||||
|
# type lookup
|
||||||
n = arrayByteSize // innerType.size()
|
n = arrayByteSize // innerType.size()
|
||||||
|
|
||||||
p = value.address()
|
p = value.address()
|
||||||
if displayFormat != DisplayFormat.Raw and p:
|
if displayFormat != DisplayFormat.Raw and p:
|
||||||
if innerType.name in (
|
if innerType.name in (
|
||||||
|
Reference in New Issue
Block a user