Debugger: Make QObject connections a bit better accessible

Change-Id: I5e70a61db73f89dc48efc82bc6aa4e42c44ba6d5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2017-03-15 12:12:05 +01:00
parent b814bea0ab
commit fd0bf9df64
3 changed files with 56 additions and 19 deletions

View File

@@ -1863,10 +1863,6 @@ class DumperBase:
self.putTypedPointer('[extraData]', extraData, self.putTypedPointer('[extraData]', extraData,
ns + 'QObjectPrivate::ExtraData') ns + 'QObjectPrivate::ExtraData')
if connectionListsPtr:
self.putTypedPointer('[connectionLists]', connectionListsPtr,
ns + 'QObjectConnectionListVector')
with SubItem(self, '[metaObject]'): with SubItem(self, '[metaObject]'):
self.putAddress(metaObjectPtr) self.putAddress(metaObjectPtr)
self.putNumChild(1) self.putNumChild(1)
@@ -1874,6 +1870,40 @@ class DumperBase:
with Children(self): with Children(self):
self.putQObjectGutsHelper(0, 0, -1, metaObjectPtr, 'QMetaObject') self.putQObjectGutsHelper(0, 0, -1, metaObjectPtr, 'QMetaObject')
with SubItem(self, '[connections]'):
if connectionListsPtr:
typeName = ns + 'QVector<' + ns + 'QObjectPrivate::ConnectionList>'
self.putItem(self.createValue(connectionListsPtr, typeName))
else:
self.putItemCount(0)
with SubItem(self, '[signals]'):
self.putItemCount(signalCount)
if self.isExpanded():
with Children(self):
j = -1
for i in range(signalCount):
t = self.split('IIIII', dataPtr + 56 + 20 * i)
flags = t[4]
if flags != 0x06:
continue
j += 1
with SubItem(self, j):
name = self.metaString(metaObjectPtr, t[0], revision)
self.putType(' ')
self.putValue(name)
self.putNumChild(1)
with Children(self):
putt('[nameindex]', t[0])
#putt('[type]', 'signal')
putt('[argc]', t[1])
putt('[parameter]', t[2])
putt('[tag]', t[3])
putt('[flags]', t[4])
putt('[localindex]', str(i))
putt('[globalindex]', str(globalOffset + i))
#self.putQObjectConnections(dd)
if isQMetaObject or isQObject: if isQMetaObject or isQObject:
with SubItem(self, '[properties]'): with SubItem(self, '[properties]'):
@@ -2012,20 +2042,6 @@ class DumperBase:
self.putValue(globalOffset + localIndex) self.putValue(globalOffset + localIndex)
#with SubItem(self, '[signals]'):
# self.putItemCount(signalCount)
# signalNames = metaData(52, -14, 5)
# warn('NAMES: %s' % signalNames)
# if self.isExpanded():
# with Children(self):
# putt('A', 'b')
# for i in range(signalCount):
# k = signalNames[i]
# with SubItem(self, k):
# self.putEmptyValue()
# if dd:
# self.putQObjectConnections(dd)
def putQObjectConnections(self, dd): def putQObjectConnections(self, dd):
with SubItem(self, '[connections]'): with SubItem(self, '[connections]'):
ptrSize = self.ptrSize() ptrSize = self.ptrSize()

View File

@@ -1078,6 +1078,26 @@ def qdump__QMetaObject(d, value):
d.putMembersItem(value) d.putMembersItem(value)
def qdump__QObjectPrivate__ConnectionList(d, value):
d.putNumChild(1)
if d.isExpanded():
i = 0
with Children(d):
first, last = value.split('pp')
currentConnection = first
connectionType = d.createType('QObjectPrivate::Connection')
while currentConnection and currentConnection != last:
sender, receiver, slotObj, nextConnectionList, nextp, prev = \
d.split('pppppp', currentConnection)
d.putSubItem(i, d.createValue(currentConnection, connectionType))
currentConnection = nextp
i += 1
d.putFields(value)
d.putItemCount(i)
else:
d.putSpecialValue('minimumitemcount', 0)
def qdump__QPixmap(d, value): def qdump__QPixmap(d, value):
if d.qtVersion() < 0x050000: if d.qtVersion() < 0x050000:
(vtbl, painters, dataPtr) = value.split('ppp'); (vtbl, painters, dataPtr) = value.split('ppp');

View File

@@ -2723,7 +2723,8 @@ void tst_Dumpers::dumper_data()
+ Check("ob", "\"An Object\"", "@QWidget") + Check("ob", "\"An Object\"", "@QWidget")
+ Check("ob1", "\"Another Object\"", "@QObject") + Check("ob1", "\"Another Object\"", "@QObject")
+ Check("ob2", "\"A Subobject\"", "@QObject"); + Check("ob2", "\"A Subobject\"", "@QObject")
+ Check("ob.[extra].[connections].0.0.receiver", "\"Another Object\"", "@QObject");
QString senderData = QString senderData =