Debugger: try harder to find static meta object

Improves dumping of QObjects when the staticMetaObject is defined in a
different module than the object itself.

Change-Id: Ic02103016d14b4925978d8afeaf2dbcc5dcebf85
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2024-02-01 07:04:05 +01:00
parent 2ea3f5382b
commit a6eb6dd909

View File

@@ -407,10 +407,16 @@ class Dumper(DumperBase):
return mem return mem
def findStaticMetaObject(self, type): def findStaticMetaObject(self, type):
typeName = type.name ptr = 0
if type.moduleName is not None: if type.moduleName is not None:
typeName = type.moduleName + '!' + typeName # Try to find the static meta object in the same module as the type definition. This is
ptr = cdbext.getAddressByName(typeName + '::staticMetaObject') # an optimization that improves the performance of looking up the meta object for not
# exported types.
ptr = cdbext.getAddressByName(type.moduleName + '!' + type.name + '::staticMetaObject')
if ptr == 0:
# If we do not find the meta object in the same module or we do not have the module name
# we fall back to the slow lookup over all modules.
ptr = cdbext.getAddressByName(type.name + '::staticMetaObject')
return ptr return ptr
def warn(self, msg): def warn(self, msg):